@leyyo/common 1.2.7 → 1.3.2

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 (289) hide show
  1. package/README.md +395 -3
  2. package/dist/class/index.d.ts +2 -0
  3. package/dist/{list → class}/index.js +1 -1
  4. package/dist/class/index.js.map +1 -0
  5. package/dist/{list → class}/list.d.ts +1 -1
  6. package/dist/class/list.js.map +1 -0
  7. package/dist/{log → class}/logger.instance.d.ts +10 -12
  8. package/dist/class/logger.instance.js +150 -0
  9. package/dist/class/logger.instance.js.map +1 -0
  10. package/dist/common/array.fn.d.ts +46 -0
  11. package/dist/common/array.fn.js +123 -0
  12. package/dist/common/array.fn.js.map +1 -0
  13. package/dist/common/deploy.fn.d.ts +18 -0
  14. package/dist/common/deploy.fn.js +73 -0
  15. package/dist/common/deploy.fn.js.map +1 -0
  16. package/dist/common/enum.fn.d.ts +63 -0
  17. package/dist/common/enum.fn.js +191 -0
  18. package/dist/common/enum.fn.js.map +1 -0
  19. package/dist/common/error.fn.d.ts +91 -0
  20. package/dist/common/error.fn.js +400 -0
  21. package/dist/common/error.fn.js.map +1 -0
  22. package/dist/common/event.fn.d.ts +45 -0
  23. package/dist/common/event.fn.js +160 -0
  24. package/dist/common/event.fn.js.map +1 -0
  25. package/dist/common/exporter.fn.d.ts +7 -0
  26. package/dist/common/exporter.fn.js +49 -0
  27. package/dist/common/exporter.fn.js.map +1 -0
  28. package/dist/common/fqn.fn.d.ts +27 -0
  29. package/dist/common/fqn.fn.js +104 -0
  30. package/dist/common/fqn.fn.js.map +1 -0
  31. package/dist/common/index.d.ts +14 -0
  32. package/dist/{hub → common}/index.js +14 -1
  33. package/dist/common/index.js.map +1 -0
  34. package/dist/common/lifecycle.fn.d.ts +24 -0
  35. package/dist/common/lifecycle.fn.js +135 -0
  36. package/dist/common/lifecycle.fn.js.map +1 -0
  37. package/dist/common/list.fn.d.ts +47 -0
  38. package/dist/common/list.fn.js +122 -0
  39. package/dist/common/list.fn.js.map +1 -0
  40. package/dist/common/loader.fn.d.ts +15 -0
  41. package/dist/common/loader.fn.js +38 -0
  42. package/dist/common/loader.fn.js.map +1 -0
  43. package/dist/common/log.fn.d.ts +42 -0
  44. package/dist/common/log.fn.js +333 -0
  45. package/dist/common/log.fn.js.map +1 -0
  46. package/dist/common/map.fn.d.ts +46 -0
  47. package/dist/common/map.fn.js +123 -0
  48. package/dist/common/map.fn.js.map +1 -0
  49. package/dist/common/opt.fn.d.ts +48 -0
  50. package/dist/common/opt.fn.js +137 -0
  51. package/dist/common/opt.fn.js.map +1 -0
  52. package/dist/common/set.fn.d.ts +46 -0
  53. package/dist/common/set.fn.js +123 -0
  54. package/dist/common/set.fn.js.map +1 -0
  55. package/dist/common/test.fn.d.ts +26 -0
  56. package/dist/common/test.fn.js +81 -0
  57. package/dist/common/test.fn.js.map +1 -0
  58. package/dist/const/index.d.ts +23 -0
  59. package/dist/const/index.js +28 -0
  60. package/dist/const/index.js.map +1 -0
  61. package/dist/enum/index.d.ts +1 -0
  62. package/dist/{deploy → enum}/index.js +1 -1
  63. package/dist/enum/index.js.map +1 -0
  64. package/dist/{log → enum}/log-level.js +2 -2
  65. package/dist/enum/log-level.js.map +1 -0
  66. package/dist/error/caused.error.d.ts +15 -0
  67. package/dist/error/caused.error.js +24 -0
  68. package/dist/error/caused.error.js.map +1 -0
  69. package/dist/error/developer.error.d.ts +24 -0
  70. package/dist/error/developer.error.js +69 -0
  71. package/dist/error/developer.error.js.map +1 -0
  72. package/dist/error/{items/http.error.d.ts → http.error.d.ts} +1 -1
  73. package/dist/error/http.error.js +31 -0
  74. package/dist/error/http.error.js.map +1 -0
  75. package/dist/error/index.d.ts +6 -3
  76. package/dist/error/index.js +6 -3
  77. package/dist/error/index.js.map +1 -1
  78. package/dist/error/{items/invalid-value.error.js → invalid-value.error.js} +6 -2
  79. package/dist/error/invalid-value.error.js.map +1 -0
  80. package/dist/error/leyyo.error.d.ts +87 -0
  81. package/dist/error/leyyo.error.js +259 -0
  82. package/dist/error/leyyo.error.js.map +1 -0
  83. package/dist/error/{items/multiple.error.d.ts → multiple.error.d.ts} +1 -1
  84. package/dist/error/{items/multiple.error.js → multiple.error.js} +5 -4
  85. package/dist/error/multiple.error.js.map +1 -0
  86. package/dist/{util → function}/delay.js +1 -0
  87. package/dist/function/delay.js.map +1 -0
  88. package/dist/function/empty.fn.d.ts +8 -0
  89. package/dist/{util → function}/empty.fn.js +3 -2
  90. package/dist/function/empty.fn.js.map +1 -0
  91. package/dist/function/error-obj.d.ts +8 -0
  92. package/dist/function/error-obj.js +25 -0
  93. package/dist/function/error-obj.js.map +1 -0
  94. package/dist/function/error-text.d.ts +7 -0
  95. package/dist/function/error-text.js +18 -0
  96. package/dist/function/error-text.js.map +1 -0
  97. package/dist/{util → function}/extended-type.d.ts +1 -1
  98. package/dist/{util → function}/extended-type.js +6 -5
  99. package/dist/function/extended-type.js.map +1 -0
  100. package/dist/{util → function}/index.d.ts +3 -4
  101. package/dist/{util → function}/index.js +3 -4
  102. package/dist/function/index.js.map +1 -0
  103. package/dist/{util → function}/is.d.ts +6 -14
  104. package/dist/{util → function}/is.js +24 -22
  105. package/dist/function/is.js.map +1 -0
  106. package/dist/{util → function}/jitter-interval.js +1 -0
  107. package/dist/function/jitter-interval.js.map +1 -0
  108. package/dist/{util → function}/one-or-more.d.ts +1 -1
  109. package/dist/{util → function}/one-or-more.js +1 -0
  110. package/dist/function/one-or-more.js.map +1 -0
  111. package/dist/{util → function}/secure-clone.d.ts +1 -1
  112. package/dist/function/secure-clone.js.map +1 -0
  113. package/dist/function/secure-json.js.map +1 -0
  114. package/dist/index.d.ts +7 -20
  115. package/dist/index.js +7 -22
  116. package/dist/index.js.map +1 -1
  117. package/dist/index.types.d.ts +510 -0
  118. package/dist/{shared/index.types.js → index.types.js} +1 -1
  119. package/dist/index.types.js.map +1 -0
  120. package/dist/loader.d.ts +2 -0
  121. package/dist/loader.js +98 -0
  122. package/dist/loader.js.map +1 -0
  123. package/package.json +5 -3
  124. package/dist/$$leyyo-loader.d.ts +0 -1
  125. package/dist/$$leyyo-loader.js +0 -40
  126. package/dist/$$leyyo-loader.js.map +0 -1
  127. package/dist/deploy/deploy.common.d.ts +0 -34
  128. package/dist/deploy/deploy.common.js +0 -125
  129. package/dist/deploy/deploy.common.js.map +0 -1
  130. package/dist/deploy/index.d.ts +0 -1
  131. package/dist/deploy/index.js.map +0 -1
  132. package/dist/deploy/index.types.d.ts +0 -29
  133. package/dist/deploy/index.types.js +0 -3
  134. package/dist/deploy/index.types.js.map +0 -1
  135. package/dist/error/error.common.d.ts +0 -34
  136. package/dist/error/error.common.js +0 -220
  137. package/dist/error/error.common.js.map +0 -1
  138. package/dist/error/index.const.d.ts +0 -4
  139. package/dist/error/index.const.js +0 -8
  140. package/dist/error/index.const.js.map +0 -1
  141. package/dist/error/index.types.d.ts +0 -109
  142. package/dist/error/index.types.js +0 -3
  143. package/dist/error/index.types.js.map +0 -1
  144. package/dist/error/items/caused.error.d.ts +0 -6
  145. package/dist/error/items/caused.error.js +0 -11
  146. package/dist/error/items/caused.error.js.map +0 -1
  147. package/dist/error/items/developer.error.d.ts +0 -4
  148. package/dist/error/items/developer.error.js +0 -11
  149. package/dist/error/items/developer.error.js.map +0 -1
  150. package/dist/error/items/http.error.js +0 -37
  151. package/dist/error/items/http.error.js.map +0 -1
  152. package/dist/error/items/index.d.ts +0 -6
  153. package/dist/error/items/index.js +0 -23
  154. package/dist/error/items/index.js.map +0 -1
  155. package/dist/error/items/invalid-value.error.js.map +0 -1
  156. package/dist/error/items/leyyo.error.d.ts +0 -60
  157. package/dist/error/items/leyyo.error.js +0 -144
  158. package/dist/error/items/leyyo.error.js.map +0 -1
  159. package/dist/error/items/multiple.error.js.map +0 -1
  160. package/dist/event/event.common.d.ts +0 -80
  161. package/dist/event/event.common.js +0 -308
  162. package/dist/event/event.common.js.map +0 -1
  163. package/dist/event/event.error.d.ts +0 -3
  164. package/dist/event/event.error.js +0 -9
  165. package/dist/event/event.error.js.map +0 -1
  166. package/dist/event/index.d.ts +0 -2
  167. package/dist/event/index.js +0 -19
  168. package/dist/event/index.js.map +0 -1
  169. package/dist/event/index.types.d.ts +0 -265
  170. package/dist/event/index.types.js +0 -3
  171. package/dist/event/index.types.js.map +0 -1
  172. package/dist/hub/hub.channel.d.ts +0 -27
  173. package/dist/hub/hub.channel.js +0 -83
  174. package/dist/hub/hub.channel.js.map +0 -1
  175. package/dist/hub/hub.common.d.ts +0 -27
  176. package/dist/hub/hub.common.js +0 -92
  177. package/dist/hub/hub.common.js.map +0 -1
  178. package/dist/hub/index.d.ts +0 -1
  179. package/dist/hub/index.js.map +0 -1
  180. package/dist/hub/index.types.d.ts +0 -105
  181. package/dist/hub/index.types.js +0 -3
  182. package/dist/hub/index.types.js.map +0 -1
  183. package/dist/leyyo/index.d.ts +0 -1
  184. package/dist/leyyo/index.js +0 -18
  185. package/dist/leyyo/index.js.map +0 -1
  186. package/dist/leyyo/index.types.d.ts +0 -21
  187. package/dist/leyyo/index.types.js +0 -3
  188. package/dist/leyyo/index.types.js.map +0 -1
  189. package/dist/leyyo/leyyo.d.ts +0 -25
  190. package/dist/leyyo/leyyo.js +0 -62
  191. package/dist/leyyo/leyyo.js.map +0 -1
  192. package/dist/list/index.d.ts +0 -2
  193. package/dist/list/index.js.map +0 -1
  194. package/dist/list/index.types.d.ts +0 -26
  195. package/dist/list/index.types.js +0 -3
  196. package/dist/list/index.types.js.map +0 -1
  197. package/dist/list/list.js.map +0 -1
  198. package/dist/log/index.d.ts +0 -4
  199. package/dist/log/index.js +0 -21
  200. package/dist/log/index.js.map +0 -1
  201. package/dist/log/index.types.d.ts +0 -47
  202. package/dist/log/index.types.js +0 -3
  203. package/dist/log/index.types.js.map +0 -1
  204. package/dist/log/log-level.js.map +0 -1
  205. package/dist/log/log.common.d.ts +0 -15
  206. package/dist/log/log.common.js +0 -135
  207. package/dist/log/log.common.js.map +0 -1
  208. package/dist/log/logger.error.d.ts +0 -3
  209. package/dist/log/logger.error.js +0 -9
  210. package/dist/log/logger.error.js.map +0 -1
  211. package/dist/log/logger.instance.js +0 -139
  212. package/dist/log/logger.instance.js.map +0 -1
  213. package/dist/name/index.d.ts +0 -2
  214. package/dist/name/index.js +0 -19
  215. package/dist/name/index.js.map +0 -1
  216. package/dist/name/index.types.d.ts +0 -21
  217. package/dist/name/index.types.js +0 -3
  218. package/dist/name/index.types.js.map +0 -1
  219. package/dist/name/name.common.d.ts +0 -16
  220. package/dist/name/name.common.js +0 -109
  221. package/dist/name/name.common.js.map +0 -1
  222. package/dist/name/name.error.d.ts +0 -3
  223. package/dist/name/name.error.js +0 -9
  224. package/dist/name/name.error.js.map +0 -1
  225. package/dist/opt/index.d.ts +0 -1
  226. package/dist/opt/index.js +0 -18
  227. package/dist/opt/index.js.map +0 -1
  228. package/dist/opt/index.types.d.ts +0 -33
  229. package/dist/opt/index.types.js +0 -3
  230. package/dist/opt/index.types.js.map +0 -1
  231. package/dist/opt/opt.common.d.ts +0 -15
  232. package/dist/opt/opt.common.js +0 -93
  233. package/dist/opt/opt.common.js.map +0 -1
  234. package/dist/repo/index.d.ts +0 -1
  235. package/dist/repo/index.js +0 -18
  236. package/dist/repo/index.js.map +0 -1
  237. package/dist/repo/index.types.d.ts +0 -104
  238. package/dist/repo/index.types.js +0 -3
  239. package/dist/repo/index.types.js.map +0 -1
  240. package/dist/repo/repo.common.d.ts +0 -41
  241. package/dist/repo/repo.common.js +0 -146
  242. package/dist/repo/repo.common.js.map +0 -1
  243. package/dist/server.d.ts +0 -1
  244. package/dist/server.js +0 -5
  245. package/dist/server.js.map +0 -1
  246. package/dist/shared/index.d.ts +0 -5
  247. package/dist/shared/index.enum.d.ts +0 -12
  248. package/dist/shared/index.enum.js +0 -3
  249. package/dist/shared/index.enum.js.map +0 -1
  250. package/dist/shared/index.fqn.d.ts +0 -3
  251. package/dist/shared/index.fqn.js +0 -3
  252. package/dist/shared/index.fqn.js.map +0 -1
  253. package/dist/shared/index.js +0 -22
  254. package/dist/shared/index.js.map +0 -1
  255. package/dist/shared/index.json.d.ts +0 -33
  256. package/dist/shared/index.json.js +0 -3
  257. package/dist/shared/index.json.js.map +0 -1
  258. package/dist/shared/index.loader.d.ts +0 -5
  259. package/dist/shared/index.loader.js +0 -3
  260. package/dist/shared/index.loader.js.map +0 -1
  261. package/dist/shared/index.types.d.ts +0 -168
  262. package/dist/shared/index.types.js.map +0 -1
  263. package/dist/util/$define-enum.d.ts +0 -18
  264. package/dist/util/$define-enum.js +0 -28
  265. package/dist/util/$define-enum.js.map +0 -1
  266. package/dist/util/$define-error.d.ts +0 -9
  267. package/dist/util/$define-error.js +0 -25
  268. package/dist/util/$define-error.js.map +0 -1
  269. package/dist/util/$loader.d.ts +0 -18
  270. package/dist/util/$loader.js +0 -40
  271. package/dist/util/$loader.js.map +0 -1
  272. package/dist/util/delay.js.map +0 -1
  273. package/dist/util/empty.fn.d.ts +0 -8
  274. package/dist/util/empty.fn.js.map +0 -1
  275. package/dist/util/extended-type.js.map +0 -1
  276. package/dist/util/index.js.map +0 -1
  277. package/dist/util/is.js.map +0 -1
  278. package/dist/util/jitter-interval.js.map +0 -1
  279. package/dist/util/one-or-more.js.map +0 -1
  280. package/dist/util/secure-clone.js.map +0 -1
  281. package/dist/util/secure-json.js.map +0 -1
  282. /package/dist/{list → class}/list.js +0 -0
  283. /package/dist/{log → enum}/log-level.d.ts +0 -0
  284. /package/dist/error/{items/invalid-value.error.d.ts → invalid-value.error.d.ts} +0 -0
  285. /package/dist/{util → function}/delay.d.ts +0 -0
  286. /package/dist/{util → function}/jitter-interval.d.ts +0 -0
  287. /package/dist/{util → function}/secure-clone.js +0 -0
  288. /package/dist/{util → function}/secure-json.d.ts +0 -0
  289. /package/dist/{util → function}/secure-json.js +0 -0
@@ -1,40 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.$$leyyoLoader = void 0;
37
- const util_1 = require("./util");
38
- const internal_1 = require("./internal");
39
- exports.$$leyyoLoader = (0, util_1.$loader)(internal_1.FQN, () => Promise.resolve().then(() => __importStar(require('./error'))).then(m => m.CausedError), () => Promise.resolve().then(() => __importStar(require('./error'))).then(m => m.DeveloperError), () => Promise.resolve().then(() => __importStar(require('./error'))).then(m => m.HttpError), () => Promise.resolve().then(() => __importStar(require('./error'))).then(m => m.InvalidValueError), () => Promise.resolve().then(() => __importStar(require('./error'))).then(m => m.LeyyoError), () => Promise.resolve().then(() => __importStar(require('./error'))).then(m => m.MultipleError), () => Promise.resolve().then(() => __importStar(require('./event'))).then(m => m.EventError), () => Promise.resolve().then(() => __importStar(require('./log'))).then(m => m.LoggerError), () => Promise.resolve().then(() => __importStar(require('./log'))).then(m => m.LogLevelItems), () => Promise.resolve().then(() => __importStar(require('./name'))).then(m => m.NameError));
40
- //# sourceMappingURL=$$leyyo-loader.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"$$leyyo-loader.js","sourceRoot":"","sources":["../src/$$leyyo-loader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAA+B;AAC/B,yCAA+B;AAElB,QAAA,aAAa,GAAG,IAAA,cAAO,EAAC,cAAG,EACpC,GAAG,EAAE,CAAC,kDAAO,SAAS,IAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,EAChD,GAAG,EAAE,CAAC,kDAAO,SAAS,IAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,cAAc,CAAC,EACnD,GAAG,EAAE,CAAC,kDAAO,SAAS,IAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,EAC9C,GAAG,EAAE,CAAC,kDAAO,SAAS,IAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,iBAAiB,CAAC,EACtD,GAAG,EAAE,CAAC,kDAAO,SAAS,IAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,EAC/C,GAAG,EAAE,CAAC,kDAAO,SAAS,IAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,EAClD,GAAG,EAAE,CAAC,kDAAO,SAAS,IAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,EAC/C,GAAG,EAAE,CAAC,kDAAO,OAAO,IAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,EAC9C,GAAG,EAAE,CAAC,kDAAO,OAAO,IAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,EAChD,GAAG,EAAE,CAAC,kDAAO,QAAQ,IAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAChD,CAAC"}
@@ -1,34 +0,0 @@
1
- import { DeployCommonLike, DeployCommonSecure, DeployType } from "./index.types";
2
- import { LeyyoLike } from "../leyyo";
3
- import { Logger } from "../log";
4
- import { Opt } from "../opt";
5
- export declare class DeployCommon implements DeployCommonLike, DeployCommonSecure {
6
- private lyy;
7
- private _types;
8
- private _logger;
9
- private _lines;
10
- private _is;
11
- constructor(lyy: LeyyoLike);
12
- private _add;
13
- private _get;
14
- private _printAll;
15
- private _print;
16
- clearMessages(): void;
17
- logger(logger: Logger): DeployCommonSecure;
18
- has(pck: string, testCase: number | string): DeployType;
19
- debug(pck: string, deleteSelected?: boolean): Array<Opt>;
20
- info(pck: string, deleteSelected?: boolean): Array<Opt>;
21
- warn(pck: string, deleteSelected?: boolean): Array<Opt>;
22
- printAll(v1: Logger | string): void;
23
- title(testCase: string | number, title: string): string;
24
- code(pck: string, testCase: string | number): string;
25
- get isTest(): boolean;
26
- $ok(): void;
27
- get $secure(): DeployCommonSecure;
28
- get $back(): DeployCommonLike;
29
- $init(): void;
30
- $debug(pck: string, testCase: number | string, opt: Opt): void;
31
- $info(pck: string, testCase: number | string, opt: Opt): void;
32
- $warn(pck: string, testCase: number | string, opt: Opt): void;
33
- $printAll(): void;
34
- }
@@ -1,125 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DeployCommon = void 0;
4
- const internal_1 = require("../internal");
5
- class DeployCommon {
6
- constructor(lyy) {
7
- this.lyy = lyy;
8
- this._types = ['debug', 'info', 'warn'];
9
- this._lines = [];
10
- }
11
- // region private
12
- _add(type, pck, testCase, opt) {
13
- const item = { opt: Object.assign({ case: this.code(pck, testCase) }, opt), logger: this._logger, type };
14
- this._lines.push(item);
15
- return item;
16
- }
17
- _get(type, v2, deleteSelected) {
18
- const lines = [];
19
- if (typeof v2 === 'string') {
20
- const pck = v2;
21
- lines.push(...this._lines.filter(item => item.type === type && (typeof item.opt.case === 'string') && item.opt.case.startsWith(pck)));
22
- }
23
- else {
24
- const logger = v2;
25
- lines.push(...this._lines.filter(item => item.type === type && item.logger === logger));
26
- }
27
- if (deleteSelected) {
28
- lines.forEach(item => {
29
- const index = this._lines.findIndex(a => a === item);
30
- if (index >= 0) {
31
- this._lines.splice(index, 1);
32
- }
33
- });
34
- }
35
- return lines.map(item => item.opt);
36
- }
37
- _printAll(v1) {
38
- const logger = ((typeof v1 === 'string') ? this._logger : (v1 !== null && v1 !== void 0 ? v1 : this._logger));
39
- this._types.forEach(type => {
40
- this._get(type, v1, true)
41
- .forEach(opt => {
42
- logger[type](opt.issue, opt);
43
- });
44
- });
45
- }
46
- _print(item) {
47
- item.logger[item.type](item.opt.issue, item.opt); // todo
48
- }
49
- // endregion private
50
- clearMessages() {
51
- this._lines = [];
52
- }
53
- logger(logger) {
54
- this._logger = logger;
55
- return this;
56
- }
57
- has(pck, testCase) {
58
- const code = this.code(pck, testCase);
59
- const filtered = this._lines.filter(d => d.opt.case === code);
60
- if (filtered.length < 1) {
61
- return undefined;
62
- }
63
- return filtered[0].type;
64
- }
65
- debug(pck, deleteSelected) {
66
- return this._get('debug', pck, deleteSelected);
67
- }
68
- info(pck, deleteSelected) {
69
- return this._get('info', pck, deleteSelected);
70
- }
71
- warn(pck, deleteSelected) {
72
- return this._get('warn', pck, deleteSelected);
73
- }
74
- printAll(v1) {
75
- this._printAll(v1);
76
- }
77
- title(testCase, title) {
78
- return `${testCase} >> ${title}`;
79
- }
80
- code(pck, testCase) {
81
- pck = (['string', 'number'].includes(typeof pck)) ? pck : internal_1.FQN;
82
- testCase = (['string', 'number'].includes(typeof testCase)) ? testCase : 'XXX';
83
- return `${pck}#${testCase}`;
84
- }
85
- get isTest() {
86
- return this._is;
87
- }
88
- $ok() {
89
- this._is = true;
90
- if (global) {
91
- if (!global.leyyo_is_testing) {
92
- global.leyyo_is_testing = true;
93
- ['log', 'warn', 'info', 'debug', 'trace', 'error', 'native'].forEach(name => {
94
- global.console[name] = () => {
95
- };
96
- console[name] = () => {
97
- };
98
- });
99
- }
100
- }
101
- }
102
- // region secure
103
- get $secure() {
104
- return this;
105
- }
106
- get $back() {
107
- return this;
108
- }
109
- $init() {
110
- }
111
- $debug(pck, testCase, opt) {
112
- this._print(this._add('debug', pck, testCase, opt));
113
- }
114
- $info(pck, testCase, opt) {
115
- this._print(this._add('info', pck, testCase, opt));
116
- }
117
- $warn(pck, testCase, opt) {
118
- this._print(this._add('warn', pck, testCase, opt));
119
- }
120
- $printAll() {
121
- this._printAll(undefined);
122
- }
123
- }
124
- exports.DeployCommon = DeployCommon;
125
- //# sourceMappingURL=deploy.common.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deploy.common.js","sourceRoot":"","sources":["../../src/deploy/deploy.common.ts"],"names":[],"mappings":";;;AAIA,0CAAgC;AAEhC,MAAa,YAAY;IAMrB,YAAoB,GAAc;QAAd,QAAG,GAAH,GAAG,CAAW;QAL1B,WAAM,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAsB,CAAC;QAExD,WAAM,GAAsB,EAAE,CAAC;IAIvC,CAAC;IAED,iBAAiB;IACT,IAAI,CAAC,IAAgB,EAAE,GAAW,EAAE,QAAyB,EAAE,GAAQ;QAC3E,MAAM,IAAI,GAAG,EAAC,GAAG,kBAAG,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,IAAK,GAAG,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,EAAC,CAAC;QACzF,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvB,OAAO,IAAI,CAAC;IAChB,CAAC;IAEO,IAAI,CAAC,IAAgB,EAAE,EAAmB,EAAE,cAAuB;QACvE,MAAM,KAAK,GAAG,EAA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CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;oBACxE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,GAAS,EAAE;oBAClC,CAAC,CAAC;oBACF,OAAO,CAAC,IAAI,CAAC,GAAG,GAAS,EAAE;oBAC3B,CAAC,CAAC;gBACN,CAAC,CAAC,CAAC;YAEP,CAAC;QACL,CAAC;IACL,CAAC;IAED,gBAAgB;IAEhB,IAAI,OAAO;QACP,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,IAAI,KAAK;QACL,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,KAAK;IACL,CAAC;IAED,MAAM,CAAC,GAAW,EAAE,QAAyB,EAAE,GAAQ;QACnD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC;IACxD,CAAC;IAED,KAAK,CAAC,GAAW,EAAE,QAAyB,EAAE,GAAQ;QAClD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC;IACvD,CAAC;IAED,KAAK,CAAC,GAAW,EAAE,QAAyB,EAAE,GAAQ;QAClD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC;IACvD,CAAC;IAED,SAAS;QACL,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IAC9B,CAAC;CAEJ;AA9ID,oCA8IC"}
@@ -1 +0,0 @@
1
- export * from './index.types';
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/deploy/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B"}
@@ -1,29 +0,0 @@
1
- import type { InitLike, ShiftMain, ShiftSecure } from "../shared";
2
- import type { Logger } from "../log";
3
- import type { Opt } from "../opt";
4
- export interface DeployCommonLike extends ShiftSecure<DeployCommonSecure> {
5
- clearMessages(): void;
6
- logger(logger: Logger): DeployCommonSecure;
7
- printAll(pck: string): void;
8
- printAll(logger: Logger): void;
9
- has(pck: string, testCase: number | string): DeployType;
10
- debug(pck: string, deleteSelected?: boolean): Array<Opt>;
11
- info(pck: string, deleteSelected?: boolean): Array<Opt>;
12
- warn(pck: string, deleteSelected?: boolean): Array<Opt>;
13
- title(testCase: string | number, title: string): string;
14
- code(pck: string, testCase: string | number): string;
15
- get isTest(): boolean;
16
- }
17
- export interface DeployCommonSecure extends ShiftMain<DeployCommonLike>, InitLike {
18
- $debug(pck: string, testCase: number | string, opt: Opt): void;
19
- $info(pck: string, testCase: number | string, opt: Opt): void;
20
- $warn(pck: string, testCase: number | string, opt: Opt): void;
21
- $printAll(): void;
22
- $ok(): void;
23
- }
24
- export interface DeployItem {
25
- logger: Logger;
26
- type: DeployType;
27
- opt: Opt;
28
- }
29
- export type DeployType = 'debug' | 'info' | 'warn';
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=index.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.types.js","sourceRoot":"","sources":["../../src/deploy/index.types.ts"],"names":[],"mappings":""}
@@ -1,34 +0,0 @@
1
- import { ErrorCommonLike, ErrorCommonSecure, LeyyoErrorLike } from "./index.types";
2
- import { LeyyoLike } from "../leyyo";
3
- import { ClassLike } from "../shared";
4
- import { Opt } from "../opt";
5
- /**
6
- * Error common class
7
- * */
8
- export declare class ErrorCommon implements ErrorCommonLike, ErrorCommonSecure {
9
- private lyy;
10
- private _knownPackages;
11
- constructor(lyy: LeyyoLike);
12
- /**
13
- * Copy source properties into target parameters
14
- *
15
- * @param {LeyyoErrorLike} target - target error
16
- * @param {Error} source - source error
17
- * */
18
- protected _copyProperties(target: LeyyoErrorLike, source: Error): void;
19
- /** @inheritDoc */
20
- register(clazz: ClassLike, fqn?: string): void;
21
- /** @inheritDoc */
22
- castForClass<E extends LeyyoErrorLike>(clazz: ClassLike<E>, e: Error, opt?: Opt): E;
23
- /** @inheritDoc */
24
- cast(e: Error, params: Opt): LeyyoErrorLike;
25
- /** @inheritDoc */
26
- addKnownPackage(packageName: string, shortName: string): void;
27
- /** @inheritDoc */
28
- logText(e: Error, ...parts: Array<string | number>): string;
29
- /** @inheritDoc */
30
- stack(source: LeyyoErrorLike, force?: boolean): void;
31
- get $back(): ErrorCommonLike;
32
- $init(): void;
33
- get $secure(): ErrorCommonSecure;
34
- }
@@ -1,220 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.ErrorCommon = void 0;
37
- const items_1 = require("./items");
38
- const internal_1 = require("../internal");
39
- const stackTraceParser = __importStar(require("stacktrace-parser"));
40
- // noinspection JSUnusedLocalSymbols
41
- /**
42
- * Error common class
43
- * */
44
- class ErrorCommon {
45
- constructor(lyy) {
46
- this.lyy = lyy;
47
- }
48
- /**
49
- * Copy source properties into target parameters
50
- *
51
- * @param {LeyyoErrorLike} target - target error
52
- * @param {Error} source - source error
53
- * */
54
- _copyProperties(target, source) {
55
- if (!(source instanceof Error)) {
56
- return;
57
- }
58
- for (const [k, v] of Object.entries(source)) {
59
- if (!['name', 'message', 'stack'].includes(k) && (typeof k === 'string') && !['symbol', 'function', 'undefined'].includes(typeof v)) {
60
- target.params = this.lyy.opt.add(target.params, k, v);
61
- }
62
- }
63
- }
64
- /** @inheritDoc */
65
- register(clazz, fqn) {
66
- this.lyy.event.emit('ly:error:register', clazz, fqn);
67
- this.lyy.event.emit(':', clazz, fqn);
68
- }
69
- /** @inheritDoc */
70
- castForClass(clazz, e, opt) {
71
- const err = new clazz(e.message, opt);
72
- this._copyProperties(err, e);
73
- err.params = this.lyy.opt.append(err.params, opt);
74
- err.causedBy = e;
75
- return err;
76
- }
77
- /** @inheritDoc */
78
- cast(e, params) {
79
- let err;
80
- if (!(e instanceof items_1.LeyyoError)) {
81
- err = new items_1.CausedError(e.message, params);
82
- err.causedBy = e;
83
- this._copyProperties(err, e);
84
- }
85
- else {
86
- err = e;
87
- err.params = this.lyy.opt.append(err.params, params);
88
- }
89
- return err;
90
- }
91
- /** @inheritDoc */
92
- addKnownPackage(packageName, shortName) {
93
- if (typeof packageName !== 'string' || packageName.trim() !== packageName || packageName.trim() === '') {
94
- throw new items_1.LeyyoError('Invalid package name', {
95
- where: `${internal_1.FQN}.ErrorCommon`,
96
- method: 'addKnownPackage',
97
- value: packageName,
98
- field: 'packageName'
99
- });
100
- }
101
- if (typeof shortName !== 'string' || shortName.trim() !== shortName || shortName.trim() === '') {
102
- throw new items_1.LeyyoError('Invalid short name', {
103
- where: `${internal_1.FQN}.ErrorCommon`,
104
- method: 'addKnownPackage',
105
- value: shortName,
106
- field: 'shortName'
107
- });
108
- }
109
- this._knownPackages.set(packageName, shortName);
110
- }
111
- /** @inheritDoc */
112
- logText(e, ...parts) {
113
- var _a, _b;
114
- parts = parts.map(p => {
115
- if (typeof p === 'string') {
116
- p = p.trim();
117
- return (p !== '') ? p : undefined;
118
- }
119
- else if (typeof p === 'number') {
120
- return p.toString(10);
121
- }
122
- else {
123
- return undefined;
124
- }
125
- }).filter(p => p !== undefined);
126
- const info = parts.length > 0 ? '<' + parts.join('/') + '> ' : '';
127
- if (!(e instanceof Error)) {
128
- return info;
129
- }
130
- return `${info}[${(_a = e.name) !== null && _a !== void 0 ? _a : 'UnknownError'}] => ${(_b = e.message) !== null && _b !== void 0 ? _b : 'Unknown message'}`;
131
- }
132
- /** @inheritDoc */
133
- stack(source, force) {
134
- var _a;
135
- if (!force && Array.isArray(source.stackTrace)) {
136
- return;
137
- }
138
- source.stackTrace = [];
139
- try {
140
- let causedBy;
141
- if (source.causedBy) {
142
- if (Array.isArray(source.causedBy) && source.causedBy.length > 0) {
143
- causedBy = source.causedBy[0];
144
- }
145
- else if (source.causedBy instanceof Error) {
146
- causedBy = source.causedBy;
147
- }
148
- }
149
- const original = (_a = causedBy === null || causedBy === void 0 ? void 0 : causedBy.stack) !== null && _a !== void 0 ? _a : source.stack;
150
- if (original) {
151
- const frames = stackTraceParser.parse(original);
152
- if (Array.isArray(frames)) {
153
- frames.forEach(frame => {
154
- var _a, _b;
155
- if (['<unknown>', 'Object.<anonymous>'].includes(frame.methodName)) {
156
- frame.methodName = undefined;
157
- }
158
- if (frame.file) {
159
- if (frame.file.startsWith('node:')) {
160
- frame.file = `@ ` + frame.file.substring(5);
161
- }
162
- else {
163
- for (const [pck, short] of this._knownPackages.entries()) {
164
- const index = frame.file.indexOf(pck);
165
- if (index >= 0) {
166
- let part = frame.file.substring(index + pck.length);
167
- if (part.startsWith('/')) {
168
- part = part.substring(1);
169
- }
170
- if (part.startsWith('dist/')) {
171
- part = part.substring(5);
172
- }
173
- frame.file = `#${short} ` + part;
174
- break;
175
- }
176
- }
177
- }
178
- if (frame.file.endsWith('.js') || frame.file.endsWith('.ts')) {
179
- frame.file.substring(0, frame.file.length - 3);
180
- }
181
- }
182
- const line = {};
183
- if (frame.file) {
184
- line.file = frame.file;
185
- }
186
- if (frame.methodName) {
187
- line.method = frame.methodName;
188
- }
189
- if (frame.lineNumber !== undefined && frame.column !== undefined) {
190
- line.pos = `${(_a = frame.lineNumber) !== null && _a !== void 0 ? _a : ''}:${(_b = frame.column) !== null && _b !== void 0 ? _b : ''}`;
191
- }
192
- source.stackTrace.push(line);
193
- });
194
- }
195
- }
196
- }
197
- catch (e) {
198
- // none
199
- }
200
- }
201
- // region secure
202
- // noinspection JSUnusedGlobalSymbols
203
- get $back() {
204
- return this;
205
- }
206
- $init() {
207
- this._knownPackages = this.lyy.repo.newMap(`${internal_1.FQN}.ErrorCommon.knownPackages`);
208
- this._knownPackages.set('@leyyo', 'l');
209
- this.lyy.$secure
210
- .$earlyRun(() => {
211
- items_1.LeyyoError.$setLeyyo(this.lyy);
212
- }).$lazyRun(() => {
213
- });
214
- }
215
- get $secure() {
216
- return this;
217
- }
218
- }
219
- exports.ErrorCommon = ErrorCommon;
220
- //# sourceMappingURL=error.common.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"error.common.js","sourceRoot":"","sources":["../../src/error/error.common.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mCAAgD;AAChD,0CAAgC;AAChC,oEAAsD;AAEtD,oCAAoC;AACpC;;KAEK;AACL,MAAa,WAAW;IAGpB,YAAoB,GAAc;QAAd,QAAG,GAAH,GAAG,CAAW;IAClC,CAAC;IAED;;;;;SAKK;IACK,eAAe,CAAC,MAAsB,EAAE,MAAa;QAC3D,IAAK,CAAC,CAAC,MAAM,YAAY,KAAK,C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MAAM,KAAK,SAAS,EAAE,CAAC;4BAC/D,IAAI,CAAC,GAAG,GAAG,GAAG,MAAA,KAAK,CAAC,UAAU,mCAAI,EAAE,IAAI,MAAA,KAAK,CAAC,MAAM,mCAAI,EAAE,EAAE,CAAC;wBACjE,CAAC;wBACD,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;oBACjC,CAAC,CAAC,CAAC;gBACP,CAAC;YACL,CAAC;QACL,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACT,OAAO;QACX,CAAC;IACL,CAAC;IAED,gBAAgB;IAChB,qCAAqC;IACrC,IAAI,KAAK;QACL,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,KAAK;QACD,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAiB,GAAG,cAAG,4BAA4B,CAAC,CAAC;QAC/F,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;QAEvC,IAAI,CAAC,GAAG,CAAC,OAAO;aACX,SAAS,CAAC,GAAG,EAAE;YACZ,kBAAU,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,EAAE;QAErB,CAAC,CAAC,CAAC;IACP,CAAC;IAED,IAAI,OAAO;QACP,OAAO,IAAI,CAAC;IAChB,CAAC;CAGJ;AAzLD,kCAyLC"}
@@ -1,4 +0,0 @@
1
- export declare const LY_ERROR_DEFAULT_MESSAGE: unique symbol;
2
- export declare const LY_ERROR_DECORATE_I18N: unique symbol;
3
- export declare const LY_ERROR_EMIT: unique symbol;
4
- export declare const LY_ERROR_HTTP_STATUS: unique symbol;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LY_ERROR_HTTP_STATUS = exports.LY_ERROR_EMIT = exports.LY_ERROR_DECORATE_I18N = exports.LY_ERROR_DEFAULT_MESSAGE = void 0;
4
- exports.LY_ERROR_DEFAULT_MESSAGE = Symbol.for('leyyo.common/error.message');
5
- exports.LY_ERROR_DECORATE_I18N = Symbol.for('leyyo.common/error.i18n');
6
- exports.LY_ERROR_EMIT = Symbol.for('leyyo.common/error.emit');
7
- exports.LY_ERROR_HTTP_STATUS = Symbol.for('leyyo.common/http.status');
8
- //# sourceMappingURL=index.const.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.const.js","sourceRoot":"","sources":["../../src/error/index.const.ts"],"names":[],"mappings":";;;AAAa,QAAA,wBAAwB,GAAkB,MAAM,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;AACnF,QAAA,sBAAsB,GAAkB,MAAM,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;AAC9E,QAAA,aAAa,GAAkB,MAAM,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;AACrE,QAAA,oBAAoB,GAAkB,MAAM,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC"}
@@ -1,109 +0,0 @@
1
- import type { ClassLike, InitLike, OneOrMore, ShiftMain, ShiftSecure } from "../shared";
2
- import type { Logger } from "../log";
3
- import type { Opt } from "../opt";
4
- /**
5
- * Bare omit error without any property
6
- * */
7
- export type OmitError = Omit<Error, 'name' | 'message' | 'stack'>;
8
- /**
9
- * Error common interface
10
- * */
11
- export interface ErrorCommonLike extends ShiftSecure<ErrorCommonSecure> {
12
- /**
13
- * Register an error class
14
- *
15
- * @param {function} clazz - error class
16
- * @param {string?} fqn - fully qualified name
17
- * */
18
- register(clazz: ClassLike, fqn?: string): void;
19
- /**
20
- * Cast a native error to given error class
21
- *
22
- * @param {function} clazz - new error class
23
- * @param {Error} e - native error instance
24
- * @param {Opt?} params - params for error
25
- * @return {LeyyoErrorLike} - new error instance
26
- * */
27
- castForClass<E extends LeyyoErrorLike>(clazz: ClassLike<E>, e: Error, params?: Opt): E;
28
- /**
29
- * Cast a native error to one of default error classes
30
- *
31
- * @param {Error} e - native error instance
32
- * @param {Opt?} params - params for error
33
- * @return {LeyyoErrorLike} - new error instance
34
- * */
35
- cast(e: Error, params?: Opt): LeyyoErrorLike;
36
- /**
37
- * Add known package to shorten stack paths
38
- *
39
- * @param {string} packageName - original package name, like @package/component
40
- * @param {string} shortName - short name for given package
41
- * */
42
- addKnownPackage(packageName: string, shortName: string): void;
43
- /**
44
- * Build formatted {@link LeyyoErrorLike#stackTrace} from native {@link Error#stack}
45
- *
46
- * @param {LeyyoErrorLike} source - error instance
47
- * @param {boolean} force - format again, even if it was already formatted
48
- * */
49
- stack(source: LeyyoErrorLike, force?: boolean): void;
50
- /**
51
- * Build easy error text as `<info> [error.name] => [error.message]`
52
- *
53
- * @param {Error} err - error instance
54
- * @param {...Array<string|number>} parts - parts for info
55
- * @return {string}
56
- * */
57
- logText(err: Error, ...parts: Array<string | number>): string;
58
- }
59
- /**
60
- * Stack line
61
- * */
62
- export interface ErrorStackLine {
63
- /**
64
- * File of error
65
- * */
66
- file: string;
67
- /**
68
- * Method of error
69
- * */
70
- method?: string;
71
- /**
72
- * Position of error
73
- * */
74
- pos?: string;
75
- }
76
- export type ErrorCommonSecure = ShiftMain<ErrorCommonLike> & InitLike;
77
- export interface LeyyoErrorLike extends Error, ShiftSecure<LeyyoErrorSecure> {
78
- /**
79
- * Parameters for error
80
- * */
81
- params?: Opt;
82
- /**
83
- * Caused error
84
- * */
85
- causedBy?: OneOrMore<Error>;
86
- /**
87
- * Formatted stack trace
88
- * */
89
- stackTrace?: Array<ErrorStackLine>;
90
- }
91
- export interface LeyyoErrorSecure extends ShiftMain<LeyyoErrorLike> {
92
- $setName(name: string): this;
93
- $errorLog(logger?: Logger): void;
94
- $warnLog(logger?: Logger): void;
95
- $debugLog(logger?: Logger): void;
96
- $infoLog(logger?: Logger): void;
97
- $traceLog(logger?: Logger): void;
98
- $list<T extends LeyyoErrorTag | string = LeyyoErrorTag | string>(): Array<T>;
99
- $append<T extends LeyyoErrorTag | string = LeyyoErrorTag | string>(key: T): boolean;
100
- $remove<T extends LeyyoErrorTag | string = LeyyoErrorTag | string>(key: T): boolean;
101
- $has<T extends LeyyoErrorTag | string = LeyyoErrorTag | string>(key: T): boolean;
102
- }
103
- export type LeyyoErrorTag = 'printed' | 'sent';
104
- export type LeyyoErrorMetaTag = 'i18n-todo' | 'i18n-formatted' | 'event-todo' | 'event-bound' | 'register-todo' | 'register-bound';
105
- export interface DefineErrorLike {
106
- message?: string;
107
- emit?: unknown;
108
- i18n?: unknown;
109
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=index.types.js.map