@adaas/a-utils 0.0.9 → 0.1.1

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 (175) hide show
  1. package/dist/index.d.ts +21 -15
  2. package/dist/index.js +53 -22
  3. package/dist/index.js.map +1 -1
  4. package/dist/src/constants/errors.constants.d.ts +0 -65
  5. package/dist/src/constants/errors.constants.js +0 -72
  6. package/dist/src/constants/errors.constants.js.map +1 -1
  7. package/dist/src/lib/A-Channel/A-Channel.component.d.ts +3 -0
  8. package/dist/src/lib/A-Channel/A-Channel.component.js +8 -0
  9. package/dist/src/lib/A-Channel/A-Channel.component.js.map +1 -0
  10. package/dist/src/lib/A-Channel/A-Channel.error.d.ts +3 -0
  11. package/dist/src/lib/A-Channel/A-Channel.error.js +8 -0
  12. package/dist/src/lib/A-Channel/A-Channel.error.js.map +1 -0
  13. package/dist/src/lib/A-Channel/A-Channel.types.d.ts +0 -0
  14. package/dist/src/lib/A-Channel/A-Channel.types.js +2 -0
  15. package/dist/src/lib/A-Channel/A-Channel.types.js.map +1 -0
  16. package/dist/src/lib/A-Command/A-Command.constants.d.ts +22 -0
  17. package/dist/src/lib/A-Command/A-Command.constants.js +28 -0
  18. package/dist/src/lib/A-Command/A-Command.constants.js.map +1 -0
  19. package/dist/src/lib/A-Command/A-Command.entity.d.ts +133 -0
  20. package/dist/src/lib/A-Command/A-Command.entity.js +273 -0
  21. package/dist/src/lib/A-Command/A-Command.entity.js.map +1 -0
  22. package/dist/src/lib/A-Command/A-Command.error.d.ts +3 -0
  23. package/dist/src/lib/A-Command/A-Command.error.js +8 -0
  24. package/dist/src/lib/A-Command/A-Command.error.js.map +1 -0
  25. package/dist/src/lib/A-Command/A-Command.types.d.ts +73 -0
  26. package/dist/src/lib/A-Command/A-Command.types.js +4 -0
  27. package/dist/src/lib/A-Command/A-Command.types.js.map +1 -0
  28. package/dist/src/lib/A-Config/A-Config.constants.d.ts +3 -0
  29. package/dist/src/lib/A-Config/A-Config.constants.js +6 -0
  30. package/dist/src/lib/A-Config/A-Config.constants.js.map +1 -0
  31. package/dist/src/lib/A-Config/A-Config.container.d.ts +8 -0
  32. package/dist/src/lib/A-Config/A-Config.container.js +75 -0
  33. package/dist/src/lib/A-Config/A-Config.container.js.map +1 -0
  34. package/dist/src/lib/A-Config/A-Config.context.d.ts +29 -0
  35. package/dist/src/lib/A-Config/A-Config.context.js +63 -0
  36. package/dist/src/lib/A-Config/A-Config.context.js.map +1 -0
  37. package/dist/src/lib/A-Config/A-Config.error.d.ts +4 -0
  38. package/dist/src/lib/A-Config/A-Config.error.js +9 -0
  39. package/dist/src/lib/A-Config/A-Config.error.js.map +1 -0
  40. package/dist/src/lib/A-Config/A-Config.types.d.ts +19 -0
  41. package/dist/src/lib/A-Config/A-Config.types.js +7 -0
  42. package/dist/src/lib/A-Config/A-Config.types.js.map +1 -0
  43. package/dist/src/lib/A-Config/components/ConfigReader.component.d.ts +30 -0
  44. package/dist/src/lib/A-Config/components/ConfigReader.component.js +85 -0
  45. package/dist/src/lib/A-Config/components/ConfigReader.component.js.map +1 -0
  46. package/dist/src/lib/A-Config/components/ENVConfigReader.component.d.ts +10 -0
  47. package/dist/src/lib/A-Config/components/ENVConfigReader.component.js +37 -0
  48. package/dist/src/lib/A-Config/components/ENVConfigReader.component.js.map +1 -0
  49. package/dist/src/lib/A-Config/components/FileConfigReader.component.d.ts +11 -0
  50. package/dist/src/lib/A-Config/components/FileConfigReader.component.js +47 -0
  51. package/dist/src/lib/A-Config/components/FileConfigReader.component.js.map +1 -0
  52. package/dist/src/lib/A-Logger/A-Logger.component.d.ts +29 -0
  53. package/dist/src/lib/A-Logger/A-Logger.component.js +152 -0
  54. package/dist/src/lib/A-Logger/A-Logger.component.js.map +1 -0
  55. package/dist/src/lib/A-Logger/A-Logger.types.d.ts +0 -0
  56. package/dist/src/lib/A-Logger/A-Logger.types.js +2 -0
  57. package/dist/src/lib/A-Logger/A-Logger.types.js.map +1 -0
  58. package/dist/src/lib/A-Memory/A-Memory.context.d.ts +64 -0
  59. package/dist/src/lib/A-Memory/A-Memory.context.js +105 -0
  60. package/dist/src/lib/A-Memory/A-Memory.context.js.map +1 -0
  61. package/dist/src/lib/A-Polyfill/A-Polyfill.component.d.ts +20 -0
  62. package/dist/src/lib/A-Polyfill/A-Polyfill.component.js +53 -0
  63. package/dist/src/lib/A-Polyfill/A-Polyfill.component.js.map +1 -0
  64. package/dist/src/{global/A_Polyfills.d.ts → lib/A-Polyfill/A-Polyfill.types.d.ts} +1 -13
  65. package/dist/src/lib/A-Polyfill/A-Polyfill.types.js +2 -0
  66. package/dist/src/lib/A-Polyfill/A-Polyfill.types.js.map +1 -0
  67. package/dist/src/lib/A-Polyfill/A-Polyfills.class.d.ts +10 -0
  68. package/dist/src/{global/A_Polyfills.js → lib/A-Polyfill/A-Polyfills.class.js} +4 -4
  69. package/dist/src/lib/A-Polyfill/A-Polyfills.class.js.map +1 -0
  70. package/dist/src/{global/A_Deferred.class.d.ts → lib/A-Schedule/A-Deferred.class.d.ts} +4 -0
  71. package/dist/src/{global/A_Deferred.class.js → lib/A-Schedule/A-Deferred.class.js} +5 -1
  72. package/dist/src/lib/A-Schedule/A-Deferred.class.js.map +1 -0
  73. package/dist/src/lib/A-Schedule/A-Schedule.component.d.ts +57 -0
  74. package/dist/src/lib/A-Schedule/A-Schedule.component.js +49 -0
  75. package/dist/src/lib/A-Schedule/A-Schedule.component.js.map +1 -0
  76. package/dist/src/{types/A_ScheduleObject.types.d.ts → lib/A-Schedule/A-Schedule.types.d.ts} +2 -1
  77. package/dist/src/{types/ASEID.types.js → lib/A-Schedule/A-Schedule.types.js} +1 -3
  78. package/dist/src/lib/A-Schedule/A-Schedule.types.js.map +1 -0
  79. package/dist/src/lib/A-Schedule/A-ScheduleObject.class.d.ts +29 -0
  80. package/dist/src/{global/A_ScheduleObject.class.js → lib/A-Schedule/A-ScheduleObject.class.js} +25 -5
  81. package/dist/src/lib/A-Schedule/A-ScheduleObject.class.js.map +1 -0
  82. package/index.ts +33 -58
  83. package/jest.config.ts +3 -3
  84. package/package.json +6 -6
  85. package/src/constants/errors.constants.ts +0 -78
  86. package/src/lib/A-Channel/A-Channel.component.ts +8 -0
  87. package/src/lib/A-Channel/A-Channel.error.ts +6 -0
  88. package/src/lib/A-Channel/A-Channel.types.ts +0 -0
  89. package/src/lib/A-Command/A-Command.constants.ts +31 -0
  90. package/src/lib/A-Command/A-Command.entity.ts +327 -0
  91. package/src/lib/A-Command/A-Command.error.ts +6 -0
  92. package/src/lib/A-Command/A-Command.types.ts +100 -0
  93. package/src/lib/A-Config/A-Config.constants.ts +13 -0
  94. package/src/lib/A-Config/A-Config.container.ts +63 -0
  95. package/src/lib/A-Config/A-Config.context.ts +117 -0
  96. package/src/lib/A-Config/A-Config.error.ts +7 -0
  97. package/src/lib/A-Config/A-Config.types.ts +26 -0
  98. package/src/lib/A-Config/components/ConfigReader.component.ts +67 -0
  99. package/src/lib/A-Config/components/ENVConfigReader.component.ts +31 -0
  100. package/src/lib/A-Config/components/FileConfigReader.component.ts +42 -0
  101. package/src/lib/A-Logger/A-Logger.component.ts +190 -0
  102. package/src/lib/A-Logger/A-Logger.types.ts +0 -0
  103. package/src/lib/A-Memory/A-Memory.context.ts +115 -0
  104. package/src/lib/A-Polyfill/A-Polyfill.component.ts +45 -0
  105. package/src/lib/A-Polyfill/A-Polyfill.types.ts +10 -0
  106. package/src/{global/A_Polyfills.ts → lib/A-Polyfill/A-Polyfills.class.ts} +2 -16
  107. package/src/{global/A_Deferred.class.ts → lib/A-Schedule/A-Deferred.class.ts} +4 -0
  108. package/src/lib/A-Schedule/A-Schedule.component.ts +89 -0
  109. package/src/{types/A_ScheduleObject.types.ts → lib/A-Schedule/A-Schedule.types.ts} +7 -2
  110. package/src/{global/A_ScheduleObject.class.ts → lib/A-Schedule/A-ScheduleObject.class.ts} +25 -7
  111. package/tests/A-Channel.test.ts +16 -0
  112. package/tests/A-Command.test.ts +133 -0
  113. package/tests/A-Config.test.ts +185 -0
  114. package/tests/A-Polyfill.test.ts +67 -0
  115. package/tests/A-Schedule.test.ts +84 -0
  116. package/tests/jest.setup.ts +35 -0
  117. package/tsconfig.build.json +56 -0
  118. package/tsconfig.json +2 -2
  119. package/dist/src/global/ASEID.class.d.ts +0 -77
  120. package/dist/src/global/ASEID.class.js +0 -129
  121. package/dist/src/global/ASEID.class.js.map +0 -1
  122. package/dist/src/global/A_Deferred.class.js.map +0 -1
  123. package/dist/src/global/A_Entity.class.d.ts +0 -49
  124. package/dist/src/global/A_Entity.class.js +0 -94
  125. package/dist/src/global/A_Entity.class.js.map +0 -1
  126. package/dist/src/global/A_Error.class.d.ts +0 -13
  127. package/dist/src/global/A_Error.class.js +0 -63
  128. package/dist/src/global/A_Error.class.js.map +0 -1
  129. package/dist/src/global/A_Polyfills.js.map +0 -1
  130. package/dist/src/global/A_ScheduleObject.class.d.ts +0 -9
  131. package/dist/src/global/A_ScheduleObject.class.js.map +0 -1
  132. package/dist/src/global/A_ServerError.class.d.ts +0 -13
  133. package/dist/src/global/A_ServerError.class.js +0 -57
  134. package/dist/src/global/A_ServerError.class.js.map +0 -1
  135. package/dist/src/helpers/A_Common.helper.d.ts +0 -42
  136. package/dist/src/helpers/A_Common.helper.js +0 -214
  137. package/dist/src/helpers/A_Common.helper.js.map +0 -1
  138. package/dist/src/helpers/A_ID.helper.d.ts +0 -17
  139. package/dist/src/helpers/A_ID.helper.js +0 -26
  140. package/dist/src/helpers/A_ID.helper.js.map +0 -1
  141. package/dist/src/helpers/A_Schedule.helper.d.ts +0 -6
  142. package/dist/src/helpers/A_Schedule.helper.js +0 -21
  143. package/dist/src/helpers/A_Schedule.helper.js.map +0 -1
  144. package/dist/src/types/ASEID.types.d.ts +0 -65
  145. package/dist/src/types/ASEID.types.js.map +0 -1
  146. package/dist/src/types/A_Common.types.d.ts +0 -59
  147. package/dist/src/types/A_Common.types.js +0 -3
  148. package/dist/src/types/A_Common.types.js.map +0 -1
  149. package/dist/src/types/A_Entity.types.d.ts +0 -13
  150. package/dist/src/types/A_Entity.types.js +0 -4
  151. package/dist/src/types/A_Entity.types.js.map +0 -1
  152. package/dist/src/types/A_Error.type.d.ts +0 -7
  153. package/dist/src/types/A_Error.type.js +0 -3
  154. package/dist/src/types/A_Error.type.js.map +0 -1
  155. package/dist/src/types/A_Error.types.d.ts +0 -7
  156. package/dist/src/types/A_Error.types.js +0 -3
  157. package/dist/src/types/A_Error.types.js.map +0 -1
  158. package/dist/src/types/A_ScheduleObject.types.js +0 -3
  159. package/dist/src/types/A_ScheduleObject.types.js.map +0 -1
  160. package/dist/src/types/A_ServerError.types.d.ts +0 -4
  161. package/dist/src/types/A_ServerError.types.js +0 -3
  162. package/dist/src/types/A_ServerError.types.js.map +0 -1
  163. package/src/global/ASEID.class.ts +0 -208
  164. package/src/global/A_Error.class.ts +0 -88
  165. package/src/global/A_ServerError.class.ts +0 -70
  166. package/src/helpers/A_Common.helper.ts +0 -265
  167. package/src/helpers/A_ID.helper.ts +0 -32
  168. package/src/helpers/A_Schedule.helper.ts +0 -25
  169. package/src/types/ASEID.types.ts +0 -86
  170. package/src/types/A_Common.types.ts +0 -111
  171. package/src/types/A_Entity.types.ts +0 -17
  172. package/src/types/A_Error.types.ts +0 -10
  173. package/src/types/A_ServerError.types.ts +0 -7
  174. package/tests/default.test.ts +0 -173
  175. package/tests/polyfill.test.ts +0 -37
@@ -0,0 +1,30 @@
1
+ import { A_Component, A_Scope } from "@adaas/a-concept";
2
+ import { A_Config } from "../A-Config.context";
3
+ import { A_Polyfill } from "../../A-Polyfill/A-Polyfill.component";
4
+ /**
5
+ * Config Reader
6
+ */
7
+ export declare class ConfigReader extends A_Component {
8
+ protected scope: A_Scope;
9
+ protected polyfill: A_Polyfill;
10
+ constructor(scope: A_Scope, polyfill: A_Polyfill);
11
+ inject(config: A_Config): Promise<void>;
12
+ /**
13
+ * Get the configuration property by Name
14
+ * @param property
15
+ */
16
+ resolve<_ReturnType = any>(property: string): _ReturnType;
17
+ /**
18
+ * This method reads the configuration and sets the values to the context
19
+ *
20
+ * @returns
21
+ */
22
+ read<T extends string>(variables?: Array<T>): Promise<Record<T, any>>;
23
+ /**
24
+ * Finds the root directory of the project by locating the folder containing package.json
25
+ *
26
+ * @param {string} startPath - The initial directory to start searching from (default is __dirname)
27
+ * @returns {string|null} - The path to the root directory or null if package.json is not found
28
+ */
29
+ protected getProjectRoot(startPath?: string): Promise<string>;
30
+ }
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
9
+ return function (target, key) { decorator(target, key, paramIndex); }
10
+ };
11
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
13
+ return new (P || (P = Promise))(function (resolve, reject) {
14
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
15
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
16
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
17
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
18
+ });
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.ConfigReader = void 0;
22
+ const a_concept_1 = require("@adaas/a-concept");
23
+ const A_Config_context_1 = require("../A-Config.context");
24
+ const A_Config_constants_1 = require("../A-Config.constants");
25
+ const A_Polyfill_component_1 = require("../../A-Polyfill/A-Polyfill.component");
26
+ /**
27
+ * Config Reader
28
+ */
29
+ let ConfigReader = class ConfigReader extends a_concept_1.A_Component {
30
+ constructor(scope, polyfill) {
31
+ super();
32
+ this.scope = scope;
33
+ this.polyfill = polyfill;
34
+ }
35
+ inject(config) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ const data = yield this.read([
38
+ ...config.CONFIG_PROPERTIES,
39
+ ...a_concept_1.A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY,
40
+ ...A_Config_constants_1.A_CONSTANTS__CONFIG_ENV_VARIABLES_ARRAY
41
+ ]);
42
+ config.set(data);
43
+ const rootDir = yield this.getProjectRoot();
44
+ config.set('A_CONCEPT_ROOT_FOLDER', rootDir);
45
+ });
46
+ }
47
+ /**
48
+ * Get the configuration property by Name
49
+ * @param property
50
+ */
51
+ resolve(property) {
52
+ return property;
53
+ }
54
+ /**
55
+ * This method reads the configuration and sets the values to the context
56
+ *
57
+ * @returns
58
+ */
59
+ read() {
60
+ return __awaiter(this, arguments, void 0, function* (variables = []) {
61
+ return {};
62
+ });
63
+ }
64
+ /**
65
+ * Finds the root directory of the project by locating the folder containing package.json
66
+ *
67
+ * @param {string} startPath - The initial directory to start searching from (default is __dirname)
68
+ * @returns {string|null} - The path to the root directory or null if package.json is not found
69
+ */
70
+ getProjectRoot() {
71
+ return __awaiter(this, arguments, void 0, function* (startPath = __dirname) {
72
+ return process.cwd();
73
+ });
74
+ }
75
+ };
76
+ exports.ConfigReader = ConfigReader;
77
+ __decorate([
78
+ a_concept_1.A_Concept.Load(),
79
+ __param(0, (0, a_concept_1.A_Inject)(A_Config_context_1.A_Config))
80
+ ], ConfigReader.prototype, "inject", null);
81
+ exports.ConfigReader = ConfigReader = __decorate([
82
+ __param(0, (0, a_concept_1.A_Inject)(a_concept_1.A_Scope)),
83
+ __param(1, (0, a_concept_1.A_Inject)(A_Polyfill_component_1.A_Polyfill))
84
+ ], ConfigReader);
85
+ //# sourceMappingURL=ConfigReader.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfigReader.component.js","sourceRoot":"","sources":["../../../../../src/lib/A-Config/components/ConfigReader.component.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,gDAAuH;AACvH,0DAA+C;AAC/C,8DAAgF;AAChF,gFAAmE;AAEnE;;GAEG;AACI,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,uBAAW;IAEzC,YACiC,KAAc,EACX,QAAoB;QAEpD,KAAK,EAAE,CAAC;QAHqB,UAAK,GAAL,KAAK,CAAS;QACX,aAAQ,GAAR,QAAQ,CAAY;IAGxD,CAAC;IAIK,MAAM,CACY,MAAgB;;YAGpC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC;gBACzB,GAAG,MAAM,CAAC,iBAAiB;gBAC3B,GAAG,oDAAwC;gBAC3C,GAAG,4DAAuC;aAC7C,CAAC,CAAC;YAEH,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAEjB,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;YAE5C,MAAM,CAAC,GAAG,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;QACjD,CAAC;KAAA;IAGD;;;OAGG;IACH,OAAO,CAAoB,QAAgB;QACvC,OAAO,QAAuB,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACG,IAAI;6DACN,YAAsB,EAAE;YAExB,OAAO,EAAoB,CAAC;QAChC,CAAC;KAAA;IAGD;;;;;OAKG;IACa,cAAc;6DAAC,SAAS,GAAG,SAAS;YAChD,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC;QACzB,CAAC;KAAA;CACJ,CAAA;AA1DY,oCAAY;AAWf;IADL,qBAAS,CAAC,IAAI,EAAE;IAEZ,WAAA,IAAA,oBAAQ,EAAC,2BAAQ,CAAC,CAAA;0CActB;uBA1BQ,YAAY;IAGhB,WAAA,IAAA,oBAAQ,EAAC,mBAAO,CAAC,CAAA;IACjB,WAAA,IAAA,oBAAQ,EAAC,iCAAU,CAAC,CAAA;GAJhB,YAAY,CA0DxB"}
@@ -0,0 +1,10 @@
1
+ import { ConfigReader } from "./ConfigReader.component";
2
+ export declare class ENVConfigReader extends ConfigReader {
3
+ /**
4
+ * Get the configuration property Name
5
+ * @param property
6
+ */
7
+ getConfigurationProperty_ENV_Alias(property: string): string;
8
+ resolve<_ReturnType = any>(property: string): _ReturnType;
9
+ read<T extends string>(variables?: Array<T>): Promise<Record<T, any>>;
10
+ }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ENVConfigReader = void 0;
13
+ const a_concept_1 = require("@adaas/a-concept");
14
+ const ConfigReader_component_1 = require("./ConfigReader.component");
15
+ class ENVConfigReader extends ConfigReader_component_1.ConfigReader {
16
+ /**
17
+ * Get the configuration property Name
18
+ * @param property
19
+ */
20
+ getConfigurationProperty_ENV_Alias(property) {
21
+ return a_concept_1.A_FormatterHelper.toUpperSnakeCase(property);
22
+ }
23
+ resolve(property) {
24
+ return process.env[this.getConfigurationProperty_ENV_Alias(property)];
25
+ }
26
+ read() {
27
+ return __awaiter(this, arguments, void 0, function* (variables = []) {
28
+ const config = {};
29
+ variables.forEach(variable => {
30
+ config[variable] = this.resolve(variable);
31
+ });
32
+ return config;
33
+ });
34
+ }
35
+ }
36
+ exports.ENVConfigReader = ENVConfigReader;
37
+ //# sourceMappingURL=ENVConfigReader.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ENVConfigReader.component.js","sourceRoot":"","sources":["../../../../../src/lib/A-Config/components/ENVConfigReader.component.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gDAAqD;AACrD,qEAAwD;AAGxD,MAAa,eAAgB,SAAQ,qCAAY;IAG7C;;;OAGG;IACH,kCAAkC,CAAC,QAAgB;QAC/C,OAAO,6BAAiB,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACxD,CAAC;IAGD,OAAO,CAAoB,QAAgB;QACvC,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,kCAAkC,CAAC,QAAQ,CAAC,CAAgB,CAAC;IACzF,CAAC;IAGK,IAAI;6DAAmB,YAAsB,EAAE;YACjD,MAAM,MAAM,GAAmB,EAAoB,CAAC;YAEpD,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;gBACzB,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAC9C,CAAC,CAAC,CAAC;YAEH,OAAO,MAAM,CAAC;QAClB,CAAC;KAAA;CACJ;AA1BD,0CA0BC"}
@@ -0,0 +1,11 @@
1
+ import { ConfigReader } from "./ConfigReader.component";
2
+ export declare class FileConfigReader extends ConfigReader {
3
+ private FileData;
4
+ /**
5
+ * Get the configuration property Name
6
+ * @param property
7
+ */
8
+ getConfigurationProperty_File_Alias(property: string): string;
9
+ resolve<_ReturnType = any>(property: string): _ReturnType;
10
+ read<T extends string>(variables?: Array<T>): Promise<Record<T, any>>;
11
+ }
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.FileConfigReader = void 0;
13
+ const a_concept_1 = require("@adaas/a-concept");
14
+ const ConfigReader_component_1 = require("./ConfigReader.component");
15
+ class FileConfigReader extends ConfigReader_component_1.ConfigReader {
16
+ constructor() {
17
+ super(...arguments);
18
+ this.FileData = new Map();
19
+ }
20
+ /**
21
+ * Get the configuration property Name
22
+ * @param property
23
+ */
24
+ getConfigurationProperty_File_Alias(property) {
25
+ return a_concept_1.A_FormatterHelper.toCamelCase(property);
26
+ }
27
+ resolve(property) {
28
+ return this.FileData.get(this.getConfigurationProperty_File_Alias(property));
29
+ }
30
+ read(variables) {
31
+ return __awaiter(this, void 0, void 0, function* () {
32
+ const fs = yield this.polyfill.fs();
33
+ try {
34
+ const data = fs.readFileSync(`${a_concept_1.A_Context.concept}.conf.json`, 'utf8');
35
+ const config = JSON.parse(data);
36
+ this.FileData = new Map(Object.entries(config));
37
+ return config;
38
+ }
39
+ catch (error) {
40
+ // this.context.Logger.error(error);
41
+ return {};
42
+ }
43
+ });
44
+ }
45
+ }
46
+ exports.FileConfigReader = FileConfigReader;
47
+ //# sourceMappingURL=FileConfigReader.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileConfigReader.component.js","sourceRoot":"","sources":["../../../../../src/lib/A-Config/components/FileConfigReader.component.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gDAAgE;AAChE,qEAAwD;AAExD,MAAa,gBAAiB,SAAQ,qCAAY;IAAlD;;QAEY,aAAQ,GAAqB,IAAI,GAAG,EAAe,CAAC;IAoChE,CAAC;IAlCG;;;OAGG;IACH,mCAAmC,CAAC,QAAgB;QAChD,OAAO,6BAAiB,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IACnD,CAAC;IAGD,OAAO,CAAoB,QAAgB;QACvC,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,mCAAmC,CAAC,QAAQ,CAAC,CAAgB,CAAC;IAChG,CAAC;IAGK,IAAI,CACN,SAAoB;;YAGpB,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YAEpC,IAAI,CAAC;gBACD,MAAM,IAAI,GAAG,EAAE,CAAC,YAAY,CAAC,GAAG,qBAAS,CAAC,OAAO,YAAY,EAAE,MAAM,CAAC,CAAC;gBAEvE,MAAM,MAAM,GAAmB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBAEhD,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;gBAEhD,OAAO,MAAM,CAAC;YAElB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,oCAAoC;gBACpC,OAAO,EAAoB,CAAC;YAChC,CAAC;QACL,CAAC;KAAA;CACJ;AAtCD,4CAsCC"}
@@ -0,0 +1,29 @@
1
+ import { A_Component, A_Error, A_Scope } from "@adaas/a-concept";
2
+ import { A_Config } from "../A-Config/A-Config.context";
3
+ export declare class A_Logger extends A_Component {
4
+ protected scope: A_Scope;
5
+ protected config: A_Config;
6
+ constructor(scope: A_Scope, config: A_Config);
7
+ readonly colors: {
8
+ readonly green: "32";
9
+ readonly blue: "34";
10
+ readonly red: "31";
11
+ readonly yellow: "33";
12
+ readonly gray: "90";
13
+ readonly magenta: "35";
14
+ readonly cyan: "36";
15
+ readonly white: "37";
16
+ readonly pink: "95";
17
+ };
18
+ get scopeLength(): number;
19
+ compile(color: keyof typeof this.colors, ...args: any[]): Array<string>;
20
+ protected get allowedToLog(): boolean;
21
+ log(color: keyof typeof this.colors, ...args: any[]): any;
22
+ log(...args: any[]): any;
23
+ warning(...args: any[]): void;
24
+ error(...args: any[]): void;
25
+ protected log_A_Error(error: A_Error): void;
26
+ protected compile_A_Error(error: A_Error): string;
27
+ protected compile_Error(error: Error): string;
28
+ protected getTime(): string;
29
+ }
@@ -0,0 +1,152 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
9
+ return function (target, key) { decorator(target, key, paramIndex); }
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.A_Logger = void 0;
13
+ const a_concept_1 = require("@adaas/a-concept");
14
+ const A_Config_context_1 = require("../A-Config/A-Config.context");
15
+ let A_Logger = class A_Logger extends a_concept_1.A_Component {
16
+ constructor(scope, config) {
17
+ super();
18
+ this.scope = scope;
19
+ this.config = config;
20
+ this.colors = {
21
+ green: '32',
22
+ blue: '34',
23
+ red: '31',
24
+ yellow: '33',
25
+ gray: '90',
26
+ magenta: '35',
27
+ cyan: '36',
28
+ white: '37',
29
+ pink: '95',
30
+ };
31
+ }
32
+ get scopeLength() {
33
+ return this.scope.name.length;
34
+ }
35
+ compile(color, ...args) {
36
+ return [
37
+ `\x1b[${this.colors[color]}m[${this.scope.name}] |${this.getTime()}|`,
38
+ (args.length > 1
39
+ ? '\n' + `${' '.repeat(this.scopeLength + 3)}|-------------------------------`
40
+ : ''),
41
+ ...(args
42
+ .map((arg, i) => {
43
+ switch (true) {
44
+ case arg instanceof a_concept_1.A_Error:
45
+ return this.compile_A_Error(arg);
46
+ case arg instanceof Error:
47
+ return this.compile_Error(arg);
48
+ case typeof arg === 'object':
49
+ return JSON.stringify(arg, null, 2)
50
+ .replace(/\n/g, '\n' + `${' '.repeat(this.scopeLength + 3)}| `);
51
+ default:
52
+ return String(((i > 0 || args.length > 1) ? '\n' : '')
53
+ + arg)
54
+ .replace(/\n/g, '\n' + `${' '.repeat(this.scopeLength + 3)}| `);
55
+ }
56
+ })),
57
+ (args.length > 1
58
+ ? '\n' + `${' '.repeat(this.scopeLength + 3)}|-------------------------------\x1b[0m`
59
+ : '\x1b[0m')
60
+ ];
61
+ }
62
+ get allowedToLog() {
63
+ return this.config.get('CONFIG_VERBOSE') !== undefined
64
+ && this.config.get('CONFIG_VERBOSE') !== 'false'
65
+ && this.config.get('CONFIG_VERBOSE') !== false;
66
+ }
67
+ log(param1, ...args) {
68
+ if (!this.allowedToLog)
69
+ return;
70
+ if (typeof param1 === 'string' && this.colors[param1]) {
71
+ console.log(...this.compile(param1, ...args));
72
+ return;
73
+ }
74
+ else {
75
+ console.log(...this.compile('blue', param1, ...args));
76
+ }
77
+ }
78
+ warning(...args) {
79
+ if (!this.allowedToLog)
80
+ return;
81
+ console.log(...this.compile('yellow', ...args));
82
+ }
83
+ error(...args) {
84
+ if (this.config.get('CONFIG_IGNORE_ERRORS'))
85
+ return;
86
+ return console.log(...this.compile('red', ...args));
87
+ }
88
+ log_A_Error(error) {
89
+ var _a, _b;
90
+ const time = this.getTime();
91
+ console.log(`\x1b[31m[${this.scope.name}] |${time}| ERROR ${error.code}
92
+ ${' '.repeat(this.scopeLength + 3)}| ${error.message}
93
+ ${' '.repeat(this.scopeLength + 3)}| ${error.description}
94
+ ${' '.repeat(this.scopeLength + 3)}|-------------------------------
95
+ ${' '.repeat(this.scopeLength + 3)}| ${((_a = error.stack) === null || _a === void 0 ? void 0 : _a.split('\n').map((line, index) => index === 0 ? line : `${' '.repeat(this.scopeLength + 3)}| ${line}`).join('\n')) || 'No stack trace'}
96
+ ${' '.repeat(this.scopeLength + 3)}|-------------------------------
97
+ \x1b[0m`
98
+ + (error.originalError ? `\x1b[31m${' '.repeat(this.scopeLength + 3)}| Wrapped From ${error.originalError.message}
99
+ ${' '.repeat(this.scopeLength + 3)}|-------------------------------
100
+ ${' '.repeat(this.scopeLength + 3)}| ${((_b = error.originalError.stack) === null || _b === void 0 ? void 0 : _b.split('\n').map((line, index) => index === 0 ? line : `${' '.repeat(this.scopeLength + 3)}| ${line}`).join('\n')) || 'No stack trace'}
101
+ ${' '.repeat(this.scopeLength + 3)}|-------------------------------
102
+ \x1b[0m` : '')
103
+ + (error.link ? `\x1b[31m${' '.repeat(this.scopeLength + 3)}| Read in docs: ${error.link}
104
+ ${' '.repeat(this.scopeLength + 3)}|-------------------------------
105
+ \x1b[0m` : ''));
106
+ }
107
+ compile_A_Error(error) {
108
+ var _a, _b;
109
+ const time = this.getTime();
110
+ return '\n' +
111
+ `${' '.repeat(this.scopeLength + 3)}|-------------------------------` +
112
+ '\n' +
113
+ `${' '.repeat(this.scopeLength + 3)}| Error: | ${error.code}
114
+ ${' '.repeat(this.scopeLength + 3)}|-------------------------------
115
+ ${' '.repeat(this.scopeLength + 3)}|${' '.repeat(10)}| ${error.message}
116
+ ${' '.repeat(this.scopeLength + 3)}|${' '.repeat(10)}| ${error.description}
117
+ ${' '.repeat(this.scopeLength + 3)}|-------------------------------
118
+ ${' '.repeat(this.scopeLength + 3)}| ${((_a = error.stack) === null || _a === void 0 ? void 0 : _a.split('\n').map((line, index) => index === 0 ? line : `${' '.repeat(this.scopeLength + 3)}| ${line}`).join('\n')) || 'No stack trace'}
119
+ ${' '.repeat(this.scopeLength + 3)}|-------------------------------`
120
+ +
121
+ (error.originalError ? `${' '.repeat(this.scopeLength + 3)}| Wrapped From ${error.originalError.message}
122
+ ${' '.repeat(this.scopeLength + 3)}|-------------------------------
123
+ ${' '.repeat(this.scopeLength + 3)}| ${((_b = error.originalError.stack) === null || _b === void 0 ? void 0 : _b.split('\n').map((line, index) => index === 0 ? line : `${' '.repeat(this.scopeLength + 3)}| ${line}`).join('\n')) || 'No stack trace'}
124
+ ${' '.repeat(this.scopeLength + 3)}|-------------------------------` : '')
125
+ +
126
+ (error.link ? `${' '.repeat(this.scopeLength + 3)}| Read in docs: ${error.link}
127
+ ${' '.repeat(this.scopeLength + 3)}|-------------------------------` : '');
128
+ }
129
+ compile_Error(error) {
130
+ var _a;
131
+ return JSON.stringify({
132
+ name: error.name,
133
+ message: error.message,
134
+ stack: (_a = error.stack) === null || _a === void 0 ? void 0 : _a.split('\n').map((line, index) => index === 0 ? line : `${' '.repeat(this.scopeLength + 3)}| ${line}`).join('\n')
135
+ }, null, 2)
136
+ .replace(/\n/g, '\n' + `${' '.repeat(this.scopeLength + 3)}| `)
137
+ .replace(/\\n/g, '\n');
138
+ }
139
+ getTime() {
140
+ const now = new Date();
141
+ const minutes = String(now.getMinutes()).padStart(2, '0');
142
+ const seconds = String(now.getSeconds()).padStart(2, '0');
143
+ const milliseconds = String(now.getMilliseconds()).padStart(4, '0');
144
+ return `${minutes}:${seconds}:${milliseconds}`;
145
+ }
146
+ };
147
+ exports.A_Logger = A_Logger;
148
+ exports.A_Logger = A_Logger = __decorate([
149
+ __param(0, (0, a_concept_1.A_Inject)(a_concept_1.A_Scope)),
150
+ __param(1, (0, a_concept_1.A_Inject)(A_Config_context_1.A_Config))
151
+ ], A_Logger);
152
+ //# sourceMappingURL=A-Logger.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"A-Logger.component.js","sourceRoot":"","sources":["../../../../src/lib/A-Logger/A-Logger.component.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gDAA2E;AAC3E,mEAAwD;AAIjD,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,uBAAW;IAErC,YACuB,KAAwB,EACvB,MAA0B;QAE9C,KAAK,EAAE,CAAC;QAHqB,UAAK,GAAL,KAAK,CAAS;QACb,WAAM,GAAN,MAAM,CAAU;QAKzC,WAAM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AC,WAAW,GAAG,CAAC,CAAC,IAAI,CAAC;aAC9D,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IAC9B,CAAC;IAIS,OAAO;QACb,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QAC1D,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QAC1D,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QACpE,OAAO,GAAG,OAAO,IAAI,OAAO,IAAI,YAAY,EAAE,CAAC;IACnD,CAAC;CACJ,CAAA;AAxLY,4BAAQ;mBAAR,QAAQ;IAGZ,WAAA,IAAA,oBAAQ,EAAC,mBAAO,CAAC,CAAA;IACjB,WAAA,IAAA,oBAAQ,EAAC,2BAAQ,CAAC,CAAA;GAJd,QAAQ,CAwLpB"}
File without changes
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=A-Logger.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"A-Logger.types.js","sourceRoot":"","sources":["../../../../src/lib/A-Logger/A-Logger.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,64 @@
1
+ import { A_Error, A_Fragment } from "@adaas/a-concept";
2
+ export declare class A_Memory<_MemoryType extends Record<string, any> = Record<string, any>, _SerializedType extends Record<string, any> = Record<string, any>> extends A_Fragment {
3
+ /**
4
+ * Internal storage of all intermediate values
5
+ */
6
+ protected _memory: Map<keyof _MemoryType, _MemoryType[keyof _MemoryType]>;
7
+ /**
8
+ * Errors encountered during the execution
9
+ */
10
+ protected _errors: Set<A_Error>;
11
+ /**
12
+ * Memory object that allows to store intermediate values and errors
13
+ *
14
+ * @param initialValues
15
+ */
16
+ constructor(initialValues?: _MemoryType);
17
+ get Errors(): Set<A_Error> | undefined;
18
+ /**
19
+ * Verifies that all required keys are present in the proxy values
20
+ *
21
+ * @param requiredKeys
22
+ * @returns
23
+ */
24
+ verifyPrerequisites(requiredKeys: Array<keyof _MemoryType>): Promise<boolean>;
25
+ /**
26
+ * Adds an error to the context
27
+ *
28
+ * @param error
29
+ */
30
+ error(error: A_Error): Promise<void>;
31
+ /**
32
+ * Saves a value in the context memory
33
+ *
34
+ * @param key
35
+ * @param value
36
+ */
37
+ set<K extends keyof _MemoryType>(
38
+ /**
39
+ * Key to save the value under
40
+ */
41
+ key: K,
42
+ /**
43
+ * Value to save
44
+ */
45
+ value: _MemoryType[K]): Promise<void>;
46
+ /**
47
+ * Removes a value from the context memory by key
48
+ *
49
+ * @param key
50
+ */
51
+ drop(key: keyof _MemoryType): Promise<void>;
52
+ /**
53
+ * Clears all stored values in the context memory
54
+ */
55
+ clear(): Promise<void>;
56
+ /**
57
+ * Converts all stored values to a plain object
58
+ *
59
+ * [!] By default uses all saved in memory values
60
+ *
61
+ * @returns
62
+ */
63
+ toJSON(): _SerializedType;
64
+ }
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.A_Memory = void 0;
13
+ const a_concept_1 = require("@adaas/a-concept");
14
+ class A_Memory extends a_concept_1.A_Fragment {
15
+ /**
16
+ * Memory object that allows to store intermediate values and errors
17
+ *
18
+ * @param initialValues
19
+ */
20
+ constructor(initialValues) {
21
+ super();
22
+ this._memory = new Map(Object.entries(initialValues || {}));
23
+ this._errors = new Set();
24
+ }
25
+ get Errors() {
26
+ return this._errors.size > 0 ? this._errors : undefined;
27
+ }
28
+ /**
29
+ * Verifies that all required keys are present in the proxy values
30
+ *
31
+ * @param requiredKeys
32
+ * @returns
33
+ */
34
+ verifyPrerequisites(requiredKeys) {
35
+ return __awaiter(this, void 0, void 0, function* () {
36
+ return requiredKeys.every(key => this._memory.has(key));
37
+ });
38
+ }
39
+ /**
40
+ * Adds an error to the context
41
+ *
42
+ * @param error
43
+ */
44
+ error(error) {
45
+ return __awaiter(this, void 0, void 0, function* () {
46
+ this._errors.add(error);
47
+ });
48
+ }
49
+ /**
50
+ * Saves a value in the context memory
51
+ *
52
+ * @param key
53
+ * @param value
54
+ */
55
+ set(
56
+ /**
57
+ * Key to save the value under
58
+ */
59
+ key,
60
+ /**
61
+ * Value to save
62
+ */
63
+ value) {
64
+ return __awaiter(this, void 0, void 0, function* () {
65
+ this._memory.set(key, value);
66
+ });
67
+ }
68
+ /**
69
+ * Removes a value from the context memory by key
70
+ *
71
+ * @param key
72
+ */
73
+ drop(key) {
74
+ return __awaiter(this, void 0, void 0, function* () {
75
+ this._memory.delete(key);
76
+ });
77
+ }
78
+ /**
79
+ * Clears all stored values in the context memory
80
+ */
81
+ clear() {
82
+ return __awaiter(this, void 0, void 0, function* () {
83
+ this._memory.clear();
84
+ });
85
+ }
86
+ /**
87
+ * Converts all stored values to a plain object
88
+ *
89
+ * [!] By default uses all saved in memory values
90
+ *
91
+ * @returns
92
+ */
93
+ toJSON() {
94
+ const obj = {};
95
+ this._memory.forEach((value, key) => {
96
+ obj[key] =
97
+ typeof value === 'object' && value !== null && 'toJSON' in value && typeof value.toJSON === 'function'
98
+ ? value.toJSON()
99
+ : value;
100
+ });
101
+ return obj;
102
+ }
103
+ }
104
+ exports.A_Memory = A_Memory;
105
+ //# sourceMappingURL=A-Memory.context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"A-Memory.context.js","sourceRoot":"","sources":["../../../../src/lib/A-Memory/A-Memory.context.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gDAAuD;AAGvD,MAAa,QAGX,SAAQ,sBAAU;IAchB;;;;OAIG;IACH,YAAY,aAA2B;QACnC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,aAAa,IAAI,EAAE,CAAC,CAAC,CAAC;QAC5D,IAAI,CAAC,OAAO,GAAG,IAAI,GAAG,EAAE,CAAC;IAC7B,CAAC;IAGD,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5D,CAAC;IAGD;;;;;OAKG;IACG,mBAAmB,CACrB,YAAsC;;YAEtC,OAAO,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QAC5D,CAAC;KAAA;IAED;;;;OAIG;IACG,KAAK,CAAC,KAAc;;YACtB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC;KAAA;IAED;;;;;OAKG;IACG,GAAG;IACL;;OAEG;IACH,GAAM;IACN;;OAEG;IACH,KAAqB;;YAErB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACjC,CAAC;KAAA;IAGD;;;;OAIG;IACG,IAAI,CAAC,GAAsB;;YAC7B,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC7B,CAAC;KAAA;IAED;;OAEG;IACG,KAAK;;YACP,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACzB,CAAC;KAAA;IAGD;;;;;;OAMG;IACH,MAAM;QACF,MAAM,GAAG,GAAwB,EAAE,CAAC;QAEpC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;YAChC,GAAG,CAAC,GAAa,CAAC;gBACd,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,QAAQ,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,MAAM,KAAK,UAAU;oBAClG,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE;oBAChB,CAAC,CAAC,KAAK,CAAC;QACpB,CAAC,CAAC,CAAC;QAEH,OAAO,GAAsB,CAAC;IAClC,CAAC;CACJ;AA/GD,4BA+GC"}
@@ -0,0 +1,20 @@
1
+ import { A_Component } from "@adaas/a-concept";
2
+ import { A_PolyfillClass } from "./A-Polyfills.class";
3
+ export declare class A_Polyfill extends A_Component {
4
+ protected _polyfill: A_PolyfillClass;
5
+ load(): Promise<void>;
6
+ /**
7
+ * Allows to use the 'fs' polyfill methods regardless of the environment
8
+ * This method loads the 'fs' polyfill and returns its instance
9
+ *
10
+ * @returns
11
+ */
12
+ fs(): Promise<Ifspolyfill>;
13
+ /**
14
+ * Allows to use the 'crypto' polyfill methods regardless of the environment
15
+ * This method loads the 'crypto' polyfill and returns its instance
16
+ *
17
+ * @returns
18
+ */
19
+ crypto(): Promise<IcryptoInterface>;
20
+ }