@leyyo/common 1.0.12 → 1.2.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 (345) hide show
  1. package/dist/deploy/deploy.common.d.ts +12 -7
  2. package/dist/deploy/deploy.common.js +29 -10
  3. package/dist/deploy/deploy.common.js.map +1 -1
  4. package/dist/deploy/index.types.d.ts +12 -8
  5. package/dist/error/error.common.d.ts +11 -20
  6. package/dist/error/error.common.js +145 -86
  7. package/dist/error/error.common.js.map +1 -1
  8. package/dist/error/http-error.map.d.ts +6 -0
  9. package/dist/error/http-error.map.js +25 -0
  10. package/dist/error/http-error.map.js.map +1 -0
  11. package/dist/error/index.d.ts +2 -0
  12. package/dist/error/index.js +2 -0
  13. package/dist/error/index.js.map +1 -1
  14. package/dist/error/index.types.d.ts +34 -36
  15. package/dist/error/items/bad-request.error.d.ts +10 -0
  16. package/dist/error/items/bad-request.error.js +16 -0
  17. package/dist/error/items/bad-request.error.js.map +1 -0
  18. package/dist/error/items/caused.error.d.ts +8 -0
  19. package/dist/error/items/caused.error.js +16 -0
  20. package/dist/error/items/caused.error.js.map +1 -0
  21. package/dist/error/items/conflict.error.d.ts +10 -0
  22. package/dist/error/items/conflict.error.js +16 -0
  23. package/dist/error/items/conflict.error.js.map +1 -0
  24. package/dist/error/items/content-too-large.error.d.ts +10 -0
  25. package/dist/error/items/content-too-large.error.js +16 -0
  26. package/dist/error/items/content-too-large.error.js.map +1 -0
  27. package/dist/error/items/developer.error.d.ts +4 -0
  28. package/dist/error/items/developer.error.js +9 -0
  29. package/dist/error/items/developer.error.js.map +1 -0
  30. package/dist/error/items/forbidden.error.d.ts +10 -0
  31. package/dist/error/items/forbidden.error.js +16 -0
  32. package/dist/error/items/forbidden.error.js.map +1 -0
  33. package/dist/error/items/gone.error.d.ts +10 -0
  34. package/dist/error/items/gone.error.js +16 -0
  35. package/dist/error/items/gone.error.js.map +1 -0
  36. package/dist/error/items/http.error.d.ts +15 -0
  37. package/dist/error/items/http.error.js +21 -0
  38. package/dist/error/items/http.error.js.map +1 -0
  39. package/dist/error/items/index.d.ts +21 -0
  40. package/dist/error/items/index.js +38 -0
  41. package/dist/error/items/index.js.map +1 -0
  42. package/dist/error/items/invalid-value.error.d.ts +6 -0
  43. package/dist/error/items/invalid-value.error.js +11 -0
  44. package/dist/error/items/invalid-value.error.js.map +1 -0
  45. package/dist/error/items/length-required.error.d.ts +10 -0
  46. package/dist/error/items/length-required.error.js +16 -0
  47. package/dist/error/items/length-required.error.js.map +1 -0
  48. package/dist/error/items/leyyo.error.d.ts +50 -0
  49. package/dist/error/items/leyyo.error.js +98 -0
  50. package/dist/error/items/leyyo.error.js.map +1 -0
  51. package/dist/error/items/method-not-allowed.error.d.ts +10 -0
  52. package/dist/error/items/method-not-allowed.error.js +16 -0
  53. package/dist/error/items/method-not-allowed.error.js.map +1 -0
  54. package/dist/error/items/multiple.error.d.ts +11 -0
  55. package/dist/error/items/multiple.error.js +34 -0
  56. package/dist/error/items/multiple.error.js.map +1 -0
  57. package/dist/error/items/not-acceptable.error.d.ts +10 -0
  58. package/dist/error/items/not-acceptable.error.js +16 -0
  59. package/dist/error/items/not-acceptable.error.js.map +1 -0
  60. package/dist/error/items/not-found.error.d.ts +10 -0
  61. package/dist/error/items/not-found.error.js +16 -0
  62. package/dist/error/items/not-found.error.js.map +1 -0
  63. package/dist/error/items/payment-required.error.d.ts +10 -0
  64. package/dist/error/items/payment-required.error.js +16 -0
  65. package/dist/error/items/payment-required.error.js.map +1 -0
  66. package/dist/error/items/precondition-failed.error.d.ts +10 -0
  67. package/dist/error/items/precondition-failed.error.js +16 -0
  68. package/dist/error/items/precondition-failed.error.js.map +1 -0
  69. package/dist/error/items/proxy-authentication-required.error.d.ts +10 -0
  70. package/dist/error/items/proxy-authentication-required.error.js +16 -0
  71. package/dist/error/items/proxy-authentication-required.error.js.map +1 -0
  72. package/dist/error/items/request-timeout.error.d.ts +10 -0
  73. package/dist/error/items/request-timeout.error.js +16 -0
  74. package/dist/error/items/request-timeout.error.js.map +1 -0
  75. package/dist/error/items/silent.error.d.ts +11 -0
  76. package/dist/error/items/silent.error.js +19 -0
  77. package/dist/error/items/silent.error.js.map +1 -0
  78. package/dist/error/items/unauthorized.error.d.ts +10 -0
  79. package/dist/error/items/unauthorized.error.js +16 -0
  80. package/dist/error/items/unauthorized.error.js.map +1 -0
  81. package/dist/event/event.common.d.ts +77 -0
  82. package/dist/event/event.common.js +308 -0
  83. package/dist/event/event.common.js.map +1 -0
  84. package/dist/event/event.error.d.ts +3 -0
  85. package/dist/event/event.error.js +8 -0
  86. package/dist/event/event.error.js.map +1 -0
  87. package/dist/event/index.js.map +1 -0
  88. package/dist/event/index.types.d.ts +261 -0
  89. package/dist/{hook → event}/index.types.js.map +1 -1
  90. package/dist/hub/hub.channel.d.ts +27 -0
  91. package/dist/hub/hub.channel.js +83 -0
  92. package/dist/hub/hub.channel.js.map +1 -0
  93. package/dist/hub/hub.common.d.ts +27 -0
  94. package/dist/hub/hub.common.js +92 -0
  95. package/dist/hub/hub.common.js.map +1 -0
  96. package/dist/hub/index.js.map +1 -0
  97. package/dist/hub/index.types.d.ts +105 -0
  98. package/dist/{to → hub}/index.types.js.map +1 -1
  99. package/dist/index.d.ts +5 -23
  100. package/dist/index.js +7 -25
  101. package/dist/index.js.map +1 -1
  102. package/dist/leyyo/index.d.ts +0 -1
  103. package/dist/leyyo/index.js +0 -1
  104. package/dist/leyyo/index.js.map +1 -1
  105. package/dist/leyyo/index.types.d.ts +4 -22
  106. package/dist/leyyo/leyyo.d.ts +4 -22
  107. package/dist/leyyo/leyyo.js +12 -39
  108. package/dist/leyyo/leyyo.js.map +1 -1
  109. package/dist/log/index.d.ts +1 -1
  110. package/dist/log/index.js +1 -1
  111. package/dist/log/index.js.map +1 -1
  112. package/dist/log/index.types.d.ts +22 -29
  113. package/dist/log/log-level.d.ts +7 -0
  114. package/dist/log/log-level.js +9 -0
  115. package/dist/log/log-level.js.map +1 -0
  116. package/dist/log/log.common.d.ts +1 -1
  117. package/dist/log/log.common.js +28 -53
  118. package/dist/log/log.common.js.map +1 -1
  119. package/dist/log/logger.error.d.ts +3 -0
  120. package/dist/log/logger.error.js +8 -0
  121. package/dist/log/logger.error.js.map +1 -0
  122. package/dist/log/logger.instance.d.ts +9 -11
  123. package/dist/log/logger.instance.js +42 -52
  124. package/dist/log/logger.instance.js.map +1 -1
  125. package/dist/name/index.types.d.ts +1 -1
  126. package/dist/name/name.common.js +64 -37
  127. package/dist/name/name.common.js.map +1 -1
  128. package/dist/name/name.error.d.ts +3 -0
  129. package/dist/name/name.error.js +8 -0
  130. package/dist/name/name.error.js.map +1 -0
  131. package/dist/opt/index.js.map +1 -0
  132. package/dist/opt/index.types.d.ts +33 -0
  133. package/dist/{fqn → opt}/index.types.js.map +1 -1
  134. package/dist/opt/opt.common.d.ts +15 -0
  135. package/dist/opt/opt.common.js +93 -0
  136. package/dist/opt/opt.common.js.map +1 -0
  137. package/dist/repo/index.types.d.ts +1 -19
  138. package/dist/repo/repo.common.d.ts +0 -6
  139. package/dist/repo/repo.common.js +0 -20
  140. package/dist/repo/repo.common.js.map +1 -1
  141. package/dist/server.js +1 -1
  142. package/dist/server.js.map +1 -1
  143. package/dist/shared/index.d.ts +3 -0
  144. package/dist/shared/index.enum.d.ts +7 -0
  145. package/dist/{exception/index.types.js → shared/index.enum.js} +1 -1
  146. package/dist/shared/index.enum.js.map +1 -0
  147. package/dist/shared/index.fqn.d.ts +3 -0
  148. package/dist/shared/index.fqn.js +3 -0
  149. package/dist/shared/index.fqn.js.map +1 -0
  150. package/dist/shared/index.js +3 -0
  151. package/dist/shared/index.js.map +1 -1
  152. package/dist/shared/index.json.d.ts +33 -0
  153. package/dist/shared/index.json.js +3 -0
  154. package/dist/shared/index.json.js.map +1 -0
  155. package/dist/shared/index.types.d.ts +78 -100
  156. package/dist/shared/index.types.js +31 -0
  157. package/dist/shared/index.types.js.map +1 -1
  158. package/dist/util/delay.d.ts +9 -0
  159. package/dist/util/delay.js +21 -0
  160. package/dist/util/delay.js.map +1 -0
  161. package/dist/util/empty.fn.d.ts +8 -0
  162. package/dist/util/empty.fn.js +11 -0
  163. package/dist/util/empty.fn.js.map +1 -0
  164. package/dist/util/index.d.ts +5 -0
  165. package/dist/{developer → util}/index.js +5 -2
  166. package/dist/util/index.js.map +1 -0
  167. package/dist/util/one-or-more.d.ts +8 -0
  168. package/dist/util/one-or-more.js +19 -0
  169. package/dist/util/one-or-more.js.map +1 -0
  170. package/dist/util/secure-clone.d.ts +3 -0
  171. package/dist/util/secure-clone.js +38 -0
  172. package/dist/util/secure-clone.js.map +1 -0
  173. package/dist/util/secure-json.d.ts +37 -0
  174. package/dist/util/secure-json.js +126 -0
  175. package/dist/util/secure-json.js.map +1 -0
  176. package/package.json +2 -2
  177. package/dist/assertion/assertion.common.d.ts +0 -183
  178. package/dist/assertion/assertion.common.js +0 -663
  179. package/dist/assertion/assertion.common.js.map +0 -1
  180. package/dist/assertion/index.js.map +0 -1
  181. package/dist/assertion/index.types.d.ts +0 -661
  182. package/dist/assertion/index.types.js.map +0 -1
  183. package/dist/descriptor/descriptor.common.d.ts +0 -22
  184. package/dist/descriptor/descriptor.common.js +0 -117
  185. package/dist/descriptor/descriptor.common.js.map +0 -1
  186. package/dist/descriptor/index.js.map +0 -1
  187. package/dist/descriptor/index.types.d.ts +0 -23
  188. package/dist/descriptor/index.types.js.map +0 -1
  189. package/dist/developer/developer.common.d.ts +0 -32
  190. package/dist/developer/developer.common.js +0 -245
  191. package/dist/developer/developer.common.js.map +0 -1
  192. package/dist/developer/index.d.ts +0 -2
  193. package/dist/developer/index.errors.d.ts +0 -13
  194. package/dist/developer/index.errors.js +0 -24
  195. package/dist/developer/index.errors.js.map +0 -1
  196. package/dist/developer/index.js.map +0 -1
  197. package/dist/developer/index.types.d.ts +0 -85
  198. package/dist/developer/index.types.js.map +0 -1
  199. package/dist/exception/assertion.exception.d.ts +0 -5
  200. package/dist/exception/assertion.exception.js +0 -12
  201. package/dist/exception/assertion.exception.js.map +0 -1
  202. package/dist/exception/caused.exception.d.ts +0 -5
  203. package/dist/exception/caused.exception.js +0 -13
  204. package/dist/exception/caused.exception.js.map +0 -1
  205. package/dist/exception/developer.exception.d.ts +0 -5
  206. package/dist/exception/developer.exception.js +0 -12
  207. package/dist/exception/developer.exception.js.map +0 -1
  208. package/dist/exception/exception.d.ts +0 -32
  209. package/dist/exception/exception.js +0 -117
  210. package/dist/exception/exception.js.map +0 -1
  211. package/dist/exception/index.d.ts +0 -7
  212. package/dist/exception/index.js +0 -24
  213. package/dist/exception/index.js.map +0 -1
  214. package/dist/exception/index.types.d.ts +0 -30
  215. package/dist/exception/index.types.js.map +0 -1
  216. package/dist/exception/invalid-value.exception.d.ts +0 -5
  217. package/dist/exception/invalid-value.exception.js +0 -12
  218. package/dist/exception/invalid-value.exception.js.map +0 -1
  219. package/dist/exception/multiple.exception.d.ts +0 -8
  220. package/dist/exception/multiple.exception.js +0 -34
  221. package/dist/exception/multiple.exception.js.map +0 -1
  222. package/dist/fqn/fqn.common.d.ts +0 -20
  223. package/dist/fqn/fqn.common.js +0 -123
  224. package/dist/fqn/fqn.common.js.map +0 -1
  225. package/dist/fqn/index.js.map +0 -1
  226. package/dist/fqn/index.types.d.ts +0 -20
  227. package/dist/fqn/index.types.js +0 -3
  228. package/dist/hook/hook.common.d.ts +0 -25
  229. package/dist/hook/hook.common.js +0 -95
  230. package/dist/hook/hook.common.js.map +0 -1
  231. package/dist/hook/index.d.ts +0 -1
  232. package/dist/hook/index.js +0 -18
  233. package/dist/hook/index.js.map +0 -1
  234. package/dist/hook/index.types.d.ts +0 -72
  235. package/dist/hook/index.types.js +0 -3
  236. package/dist/is/index.d.ts +0 -1
  237. package/dist/is/index.js +0 -18
  238. package/dist/is/index.js.map +0 -1
  239. package/dist/is/index.types.d.ts +0 -240
  240. package/dist/is/index.types.js +0 -3
  241. package/dist/is/index.types.js.map +0 -1
  242. package/dist/is/is.common.d.ts +0 -71
  243. package/dist/is/is.common.js +0 -177
  244. package/dist/is/is.common.js.map +0 -1
  245. package/dist/leyyo/leyyo-hook.common.d.ts +0 -10
  246. package/dist/leyyo/leyyo-hook.common.js +0 -18
  247. package/dist/leyyo/leyyo-hook.common.js.map +0 -1
  248. package/dist/log/severity.d.ts +0 -8
  249. package/dist/log/severity.js +0 -8
  250. package/dist/log/severity.js.map +0 -1
  251. package/dist/mixin/index.d.ts +0 -1
  252. package/dist/mixin/index.js +0 -18
  253. package/dist/mixin/index.js.map +0 -1
  254. package/dist/mixin/index.types.d.ts +0 -19
  255. package/dist/mixin/index.types.js +0 -3
  256. package/dist/mixin/index.types.js.map +0 -1
  257. package/dist/mixin/mixin.common.d.ts +0 -22
  258. package/dist/mixin/mixin.common.js +0 -165
  259. package/dist/mixin/mixin.common.js.map +0 -1
  260. package/dist/system/country-code.d.ts +0 -8
  261. package/dist/system/country-code.js +0 -18
  262. package/dist/system/country-code.js.map +0 -1
  263. package/dist/system/environment.d.ts +0 -8
  264. package/dist/system/environment.js +0 -8
  265. package/dist/system/environment.js.map +0 -1
  266. package/dist/system/index.d.ts +0 -7
  267. package/dist/system/index.js +0 -24
  268. package/dist/system/index.js.map +0 -1
  269. package/dist/system/index.types.d.ts +0 -6
  270. package/dist/system/index.types.js +0 -3
  271. package/dist/system/index.types.js.map +0 -1
  272. package/dist/system/language-code.d.ts +0 -8
  273. package/dist/system/language-code.js +0 -13
  274. package/dist/system/language-code.js.map +0 -1
  275. package/dist/system/locale-code.d.ts +0 -10
  276. package/dist/system/locale-code.js +0 -18
  277. package/dist/system/locale-code.js.map +0 -1
  278. package/dist/system/sys-class.d.ts +0 -2
  279. package/dist/system/sys-class.js +0 -20
  280. package/dist/system/sys-class.js.map +0 -1
  281. package/dist/system/sys-function.d.ts +0 -2
  282. package/dist/system/sys-function.js +0 -7
  283. package/dist/system/sys-function.js.map +0 -1
  284. package/dist/system/system.common.d.ts +0 -11
  285. package/dist/system/system.common.js +0 -64
  286. package/dist/system/system.common.js.map +0 -1
  287. package/dist/test/index.d.ts +0 -2
  288. package/dist/test/index.js +0 -19
  289. package/dist/test/index.js.map +0 -1
  290. package/dist/test/index.types.d.ts +0 -9
  291. package/dist/test/index.types.js +0 -3
  292. package/dist/test/index.types.js.map +0 -1
  293. package/dist/test/test.common.d.ts +0 -14
  294. package/dist/test/test.common.js +0 -48
  295. package/dist/test/test.common.js.map +0 -1
  296. package/dist/test/tested.d.ts +0 -1
  297. package/dist/test/tested.js +0 -9
  298. package/dist/test/tested.js.map +0 -1
  299. package/dist/to/index.d.ts +0 -7
  300. package/dist/to/index.js +0 -24
  301. package/dist/to/index.js.map +0 -1
  302. package/dist/to/index.types.d.ts +0 -76
  303. package/dist/to/index.types.js +0 -3
  304. package/dist/to/key-value.d.ts +0 -4
  305. package/dist/to/key-value.js +0 -8
  306. package/dist/to/key-value.js.map +0 -1
  307. package/dist/to/list.d.ts +0 -20
  308. package/dist/to/list.js +0 -38
  309. package/dist/to/list.js.map +0 -1
  310. package/dist/to/primitive.d.ts +0 -8
  311. package/dist/to/primitive.js +0 -8
  312. package/dist/to/primitive.js.map +0 -1
  313. package/dist/to/real-value.d.ts +0 -8
  314. package/dist/to/real-value.js +0 -8
  315. package/dist/to/real-value.js.map +0 -1
  316. package/dist/to/to.common.d.ts +0 -77
  317. package/dist/to/to.common.js +0 -1079
  318. package/dist/to/to.common.js.map +0 -1
  319. package/dist/to/weak-false.d.ts +0 -8
  320. package/dist/to/weak-false.js +0 -8
  321. package/dist/to/weak-false.js.map +0 -1
  322. package/dist/to/weak-true.d.ts +0 -8
  323. package/dist/to/weak-true.js +0 -8
  324. package/dist/to/weak-true.js.map +0 -1
  325. package/dist/wrapper/index.d.ts +0 -2
  326. package/dist/wrapper/index.js +0 -19
  327. package/dist/wrapper/index.js.map +0 -1
  328. package/dist/wrapper/index.types.d.ts +0 -29
  329. package/dist/wrapper/index.types.js +0 -3
  330. package/dist/wrapper/index.types.js.map +0 -1
  331. package/dist/wrapper/wrap.d.ts +0 -7
  332. package/dist/wrapper/wrap.js +0 -11
  333. package/dist/wrapper/wrap.js.map +0 -1
  334. package/dist/wrapper/wrapper.common.d.ts +0 -26
  335. package/dist/wrapper/wrapper.common.js +0 -82
  336. package/dist/wrapper/wrapper.common.js.map +0 -1
  337. /package/dist/{assertion → event}/index.d.ts +0 -0
  338. /package/dist/{assertion → event}/index.js +0 -0
  339. /package/dist/{assertion → event}/index.types.js +0 -0
  340. /package/dist/{descriptor → hub}/index.d.ts +0 -0
  341. /package/dist/{descriptor → hub}/index.js +0 -0
  342. /package/dist/{descriptor → hub}/index.types.js +0 -0
  343. /package/dist/{fqn → opt}/index.d.ts +0 -0
  344. /package/dist/{fqn → opt}/index.js +0 -0
  345. /package/dist/{developer → opt}/index.types.js +0 -0
@@ -1,16 +1,16 @@
1
- import type { LanguageCode, LocaleCode } from "../system";
1
+ export type HttpStatus = number;
2
2
  export type BasicType = 'undefined' | 'string' | 'object' | 'number' | 'boolean' | 'function' | 'symbol' | 'bigint';
3
+ export type ExtendedType = BasicType | 'array' | 'class' | 'null' | 'empty' | 'nan' | 'integer' | 'date' | 'enum';
4
+ export type KeyValue = string | number;
5
+ export type AnyKey = string | number | symbol;
6
+ export type Obj = Object & {};
3
7
  export type Dict<T = unknown> = Record<KeyValue, T>;
4
8
  export type Arr<T = unknown> = Array<T>;
5
- export type KeyValue = string | number;
6
9
  export type Id = string | number;
7
- export type Unknown = unknown;
8
10
  export type Integer = number;
9
11
  export type Float = number;
10
- export type Boolean = boolean;
11
- export type Enum = string;
12
12
  export type Alpha = string;
13
- export type String = string;
13
+ export type Text = string;
14
14
  export type Digit = string;
15
15
  export type Title = string;
16
16
  export type Description = string;
@@ -24,75 +24,66 @@ export type Timestamp = number;
24
24
  export type IsoDatetime = string;
25
25
  export type IsoDate = string;
26
26
  export type IsoTime = string;
27
- interface _BaseFunc {
28
- readonly name?: string;
29
- readonly length?: number;
30
- bind(thisArg: unknown, ...args: Array<unknown>): unknown;
31
- apply(thisArg: unknown, args: Array<unknown>): unknown;
32
- call(thisArg: unknown, ...args: Array<unknown>): unknown;
33
- }
34
- interface _SyncFnc<R> extends _BaseFunc {
35
- (...args: Array<unknown>): R;
27
+ export type Fnc<R = unknown> = ((...args: Arr) => R) & Function;
28
+ export type Async<R = unknown> = ((...args: Arr) => Promise<R>) & AsyncGeneratorFunction;
29
+ export interface Abstract<T = {}> extends Function {
30
+ prototype: T;
31
+ readonly name: string;
32
+ readonly length: number;
33
+ bind(thisArg: unknown, ...args: Arr): unknown;
34
+ apply(thisArg: unknown, args: Arr): unknown;
35
+ call(thisArg: unknown, ...args: Arr): unknown;
36
36
  }
37
- interface _AsyncFnc<R> extends _BaseFunc {
38
- (...args: Array<unknown>): Promise<R>;
37
+ export interface ClassLike<T = {}> extends Abstract<T> {
38
+ new (...args: Arr): T;
39
39
  }
40
- export type Fnc<R = unknown> = _SyncFnc<R> & Function;
41
- export type Async<R = unknown> = _AsyncFnc<R> & AsyncGeneratorFunction;
42
- export type AnyFnc<R = unknown> = Fnc<R> | Async<R>;
43
- export type _Type<T> = {
44
- new (...args: Array<unknown>): T;
45
- prototype?: unknown;
46
- };
47
- export type ClassLike<T = {}> = (_BaseFunc & _Type<T>) | _SyncFnc<T>;
48
40
  export type TypeOf<C = ClassLike> = C extends ClassLike<infer T> ? T : C;
41
+ export declare namespace Express {
42
+ interface Request {
43
+ custom?: Dict;
44
+ }
45
+ interface Response {
46
+ custom?: Dict;
47
+ }
48
+ }
49
49
  export interface Describable {
50
50
  description: string;
51
51
  }
52
52
  export interface Nameable {
53
53
  name: string;
54
54
  }
55
- export type ClassOrName = ClassLike | string;
56
- export type FuncOrName = Function | string;
57
- export type ClassOrFuncOrName = ClassLike | Function | string;
58
- /**
59
- * Referenced from Object
60
- * */
61
- export type Obj = Object & {};
62
- export interface Abstract<T> extends Function {
63
- prototype: T;
64
- }
65
- export interface Entity<I extends Id = Uuid> {
66
- id?: I;
67
- }
68
- export interface Pair<I extends Id = Uuid> extends Entity<I> {
69
- name?: string;
55
+ export interface HasId {
56
+ id?: string | number;
70
57
  }
71
58
  export type TypeOfMethod<T, M extends keyof T> = T[M] extends Function ? T[M] : never;
59
+ export type TypeOfFnc<F extends Fnc> = F extends (...args: Arr) => infer R ? R : never;
60
+ export type TypeOfAsync<F extends Async> = TypeOfPromise<TypeOfFnc<F>>;
61
+ export type TypeOfPromise<P> = P extends Promise<infer R> ? R : P;
62
+ /**
63
+ * String keys of a interface
64
+ * - Note: keyof keywords returns string|number|symbol, but it's ignore nuöber and symbol keys
65
+ * */
66
+ export type StrKey<T> = Extract<keyof T, string>;
67
+ /**
68
+ * Serialized version of another type
69
+ */
70
+ export type Serialized<T> = {
71
+ [P in keyof T]: T[P];
72
+ };
73
+ /**
74
+ * Makes mutable an interface
75
+ *
76
+ * @see Readonly
77
+ * */
78
+ export type Mutable<A> = {
79
+ -readonly [K in keyof A]: A[K];
80
+ };
72
81
  export type KeyOf<T> = keyof T;
73
82
  export type Keys<T> = Array<keyof T>;
74
83
  export type ValueOf<T> = T[KeyOf<T>];
75
84
  export type Values<T> = Array<T[KeyOf<T>]>;
76
- export type MaximumOneOf<T, K extends keyof T = keyof T> = K extends keyof T ? {
77
- [P in K]: T[K];
78
- } & Partial<Record<Exclude<keyof T, K>, never>> : never;
79
- export type OneOf<Obj> = ValueOf<OneOfByKey<Obj>>;
80
- export type Xor<A, B> = XorIn<A & {
81
- [K in keyof B]?: undefined;
82
- }> | XorIn<B & {
83
- [K in keyof A]?: undefined;
84
- }>;
85
85
  export type OneOrMore<T> = T | Array<T>;
86
- export type ValueOrCallback<T> = T | ValueCallback<T> | ValueCallbackAsync<T>;
87
- export type ValueCallback<T> = () => T;
88
- export type ValueCallbackAsync<T> = () => Promise<T>;
89
- type OneOnly<T, K extends keyof T> = Omit<T, Exclude<keyof T, K>> | Pick<T, K>;
90
- type OneOfByKey<T> = {
91
- [key in keyof T]: OneOnly<T, key>;
92
- };
93
- type XorIn<T> = {
94
- [K in keyof T]: T[K];
95
- } & unknown;
86
+ export type SetOrMore<T> = T | Set<T>;
96
87
  /**
97
88
  * An interface which contains secure mode members and provides to shift to main mode
98
89
  * */
@@ -133,42 +124,11 @@ export interface InitLike {
133
124
  * */
134
125
  $init(...args: Arr): void;
135
126
  }
136
- /**
137
- * JSON Object
138
- */
139
- export type JsonObject = {
140
- [K in string]?: JsonValue;
127
+ export type EnumMap<E extends KeyValue = KeyValue> = {
128
+ [K in E]: KeyValue;
141
129
  };
142
- /**
143
- * JSON Array
144
- */
145
- export type JsonArray = Array<JsonValue>;
146
- /**
147
- * JSON Primitives
148
- */
149
- export type JsonPrimitive = string | number | boolean | null;
150
- /**
151
- * JSON Values
152
- */
153
- export type JsonValue = JsonPrimitive | JsonObject | JsonArray;
154
- /**
155
- * Primitive language key
156
- *
157
- * It can be language (xx), local (xx-xx) or string (not preferred)
158
- * */
159
- export type I18nKey = LanguageCode | LocaleCode | string;
160
- /**
161
- * Language map
162
- *
163
- * @example
164
- * const name = {en: "Apple", tr: "Elma"};
165
- *
166
- * */
167
- export type I18nRaw<V = unknown> = Dict<V>;
168
- export type I18nAny<V = unknown> = I18nRaw<V> | V;
169
- export type EnumMap<E extends KeyValue = KeyValue> = Dict<E>;
170
130
  export type EnumAlt<E extends KeyValue = KeyValue> = Dict<E>;
171
- export type EnumLiteral<E extends KeyValue = KeyValue> = Array<E> | unknown;
131
+ export type EnumLiteral<E extends KeyValue = KeyValue> = Array<E> | ReadonlyArray<E>;
172
132
  export type IgnoreFieldsByType<T, I> = {
173
133
  [K in keyof T]: T[K] extends I ? K : never;
174
134
  }[keyof T];
@@ -178,13 +138,31 @@ export type ReplaceType<T, O, N> = {
178
138
  export type SameType<A, T> = {
179
139
  [K in keyof A]: T;
180
140
  };
181
- /**
182
- * Serialized version of another type
183
- */
184
- export type Serialized<T> = {
185
- [P in keyof T]: T[P];
141
+ export type PickByType<T, I> = {
142
+ [K in keyof T]: T[K] extends I ? K : never;
186
143
  };
187
- export type Mutable<A> = {
188
- -readonly [K in keyof A]: A[K];
144
+ export type PickKeyByType<T, I> = PickByType<T, I>[keyof T];
145
+ export type OmitByType<T, I> = {
146
+ [K in keyof T]: T[K] extends I ? never : K;
147
+ };
148
+ export type OmitKeysByType<T, I> = OmitByType<T, I>[keyof T];
149
+ export type ValueOrCallback<T> = T | ValueCallback<T> | ValueCallbackAsync<T>;
150
+ export type ValueCallback<T> = () => T;
151
+ export type ValueCallbackAsync<T> = () => Promise<T>;
152
+ export type MaximumOneOf<T, K extends keyof T = keyof T> = K extends keyof T ? {
153
+ [P in K]: T[K];
154
+ } & Partial<Record<Exclude<keyof T, K>, never>> : never;
155
+ export type OneOf<Obj> = ValueOf<OneOfByKey<Obj>>;
156
+ export type Xor<A, B> = XorIn<A & {
157
+ [K in keyof B]?: undefined;
158
+ }> | XorIn<B & {
159
+ [K in keyof A]?: undefined;
160
+ }>;
161
+ type OneOnly<T, K extends keyof T> = Omit<T, Exclude<keyof T, K>> | Pick<T, K>;
162
+ type OneOfByKey<T> = {
163
+ [key in keyof T]: OneOnly<T, key>;
189
164
  };
165
+ type XorIn<T> = {
166
+ [K in keyof T]: T[K];
167
+ } & unknown;
190
168
  export {};
@@ -2,4 +2,35 @@
2
2
  // noinspection JSUnusedGlobalSymbols
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  // endregion
5
+ /*
6
+
7
+ // export type StrObject<T> = {
8
+ // [K in keyof T ]: K extends string ? K : never;
9
+ // };
10
+ // export type StrKey<T> = keyof StrObject<T>;
11
+
12
+ interface _BaseFunc {
13
+ readonly name?: string;
14
+ readonly length?: number;
15
+ bind(thisArg: unknown, ...args: Array<unknown>): unknown;
16
+
17
+ apply(thisArg: unknown, args: Array<unknown>): unknown;
18
+
19
+ call(thisArg: unknown, ...args: Array<unknown>): unknown;
20
+ }
21
+
22
+ interface _SyncFnc<R> extends _BaseFunc {
23
+ (...args: Array<unknown>): R;
24
+ }
25
+ interface _AsyncFnc<R> extends _BaseFunc {
26
+ (...args: Array<unknown>): Promise<R>;
27
+ }
28
+
29
+ // export type ClassOrName = ClassLike | string;
30
+ // export type FuncOrName = Function | string;
31
+ // export type ClassOrFuncOrName = ClassLike | Function | string;
32
+ // export type ClassLike<T = {}> = (_BaseFunc & _Type<T>) | _SyncFnc<T>;
33
+ // export type AnyFnc<R = unknown> = Fnc<R> | Async<R>;
34
+
35
+ */
5
36
  //# sourceMappingURL=index.types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.types.js","sourceRoot":"","sources":["../../src/shared/index.types.ts"],"names":[],"mappings":";AAAA,qCAAqC;;AAsPrC,YAAY"}
1
+ {"version":3,"file":"index.types.js","sourceRoot":"","sources":["../../src/shared/index.types.ts"],"names":[],"mappings":";AAAA,qCAAqC;;AAsNrC,YAAY;AAGZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8BE"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Delay or sleep n msec
3
+ *
4
+ * @param {number} waiting - waiting as milliseconds
5
+ * @param {any} response - response value
6
+ * @return {any}
7
+ * @async
8
+ * */
9
+ export declare function delay<R = undefined>(waiting?: number, response?: R): Promise<R>;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.delay = delay;
4
+ /**
5
+ * Delay or sleep n msec
6
+ *
7
+ * @param {number} waiting - waiting as milliseconds
8
+ * @param {any} response - response value
9
+ * @return {any}
10
+ * @async
11
+ * */
12
+ function delay(waiting, response) {
13
+ if (typeof waiting !== "number" || waiting < 10) {
14
+ waiting = Math.round(Math.random() * 1000);
15
+ }
16
+ else if (!Number.isSafeInteger(waiting)) {
17
+ waiting = Math.round(waiting);
18
+ }
19
+ return new Promise(() => setTimeout(() => response, waiting));
20
+ }
21
+ //# sourceMappingURL=delay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delay.js","sourceRoot":"","sources":["../../src/util/delay.ts"],"names":[],"mappings":";;AAQA,sBAQC;AAhBD;;;;;;;KAOK;AACL,SAAgB,KAAK,CAAgB,OAAgB,EAAE,QAAY;IAC/D,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,GAAG,EAAE,EAAE,CAAC;QAC9C,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,IAAK,CAAC,CAAC;IAChD,CAAC;SACI,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC;QACtC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,IAAI,OAAO,CAAI,GAAG,EAAE,CAAC,UAAU,CAAC,GAAM,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;AACxE,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { Arr } from "../shared";
2
+ /**
3
+ * Empty function, it can be more useful sometimes
4
+ *
5
+ * @param {Arr} args - insignificant parameters
6
+ * @return {any}
7
+ * */
8
+ export declare function emptyFn<R = unknown>(...args: Arr): R | void;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.emptyFn = emptyFn;
4
+ /**
5
+ * Empty function, it can be more useful sometimes
6
+ *
7
+ * @param {Arr} args - insignificant parameters
8
+ * @return {any}
9
+ * */
10
+ function emptyFn(...args) { }
11
+ //# sourceMappingURL=empty.fn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"empty.fn.js","sourceRoot":"","sources":["../../src/util/empty.fn.ts"],"names":[],"mappings":";;AAQA,0BAA6D;AAN7D;;;;;KAKK;AACL,SAAgB,OAAO,CAAc,GAAG,IAAS,IAAW,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from './delay';
2
+ export * from './empty.fn';
3
+ export * from './one-or-more';
4
+ export * from './secure-json';
5
+ export * from './secure-clone';
@@ -14,6 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./index.types"), exports);
18
- __exportStar(require("./index.errors"), exports);
17
+ __exportStar(require("./delay"), exports);
18
+ __exportStar(require("./empty.fn"), exports);
19
+ __exportStar(require("./one-or-more"), exports);
20
+ __exportStar(require("./secure-json"), exports);
21
+ __exportStar(require("./secure-clone"), exports);
19
22
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,6CAA2B;AAC3B,gDAA8B;AAC9B,gDAA8B;AAC9B,iDAA+B"}
@@ -0,0 +1,8 @@
1
+ import type { OneOrMore } from "../shared";
2
+ /**
3
+ * Return array value from one or more type
4
+ *
5
+ * @param {OneOrMore} value - it can be one value or array value
6
+ * @return {Array}
7
+ * */
8
+ export declare function oneOrMore<T = unknown>(value: OneOrMore<T>): Array<T> | undefined;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.oneOrMore = oneOrMore;
4
+ /**
5
+ * Return array value from one or more type
6
+ *
7
+ * @param {OneOrMore} value - it can be one value or array value
8
+ * @return {Array}
9
+ * */
10
+ function oneOrMore(value) {
11
+ if (Array.isArray(value)) {
12
+ return value;
13
+ }
14
+ if (value === undefined || value === null) {
15
+ return undefined;
16
+ }
17
+ return [value];
18
+ }
19
+ //# sourceMappingURL=one-or-more.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"one-or-more.js","sourceRoot":"","sources":["../../src/util/one-or-more.ts"],"names":[],"mappings":";;AAQA,8BAQC;AAdD;;;;;KAKK;AACL,SAAgB,SAAS,CAAc,KAAmB;IACtD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,KAAiB,CAAC;IAC7B,CAAC;IACD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACxC,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,OAAO,CAAC,KAAK,CAAa,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Obj } from "../shared";
2
+ export declare function _secureClone<T>(value: T, weakSet: WeakSet<Obj>): T;
3
+ export declare function secureClone<T>(value: T): T;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports._secureClone = _secureClone;
4
+ exports.secureClone = secureClone;
5
+ function _secureClone(value, weakSet) {
6
+ if (value === undefined || value === null) {
7
+ return value;
8
+ }
9
+ if (typeof value !== 'object') {
10
+ return value;
11
+ }
12
+ if (weakSet.has(weakSet)) {
13
+ return value;
14
+ }
15
+ weakSet.add(value);
16
+ if (Array.isArray(value)) {
17
+ return value.map(item => secureClone(item));
18
+ }
19
+ if (value instanceof Set) {
20
+ return new Set(Array.from(value.values()).map(item => secureClone(item)));
21
+ }
22
+ if (value instanceof Map) {
23
+ const newMap = new Map();
24
+ for (const [k, v] of value.entries()) {
25
+ newMap.set(k, secureClone(v));
26
+ }
27
+ return newMap;
28
+ }
29
+ const newObj = {};
30
+ for (const [k, v] of Object.entries(value)) {
31
+ newObj[k] = secureClone(v);
32
+ }
33
+ return newObj;
34
+ }
35
+ function secureClone(value) {
36
+ return _secureClone(value, new WeakSet());
37
+ }
38
+ //# sourceMappingURL=secure-clone.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secure-clone.js","sourceRoot":"","sources":["../../src/util/secure-clone.ts"],"names":[],"mappings":";;AAEA,oCA6BC;AAED,kCAEC;AAjCD,SAAgB,YAAY,CAAI,KAAQ,EAAE,OAAqB;IAC3D,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACxC,OAAO,K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,OAAO,YAAY,CAAC,KAAK,EAAE,IAAI,OAAO,EAAE,CAAC,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Converts an object to secure object
3
+ *
4
+ * - `secure` means:
5
+ * - removes `circular` relations
6
+ * - cuts after max depths, default: `10`
7
+ * - converts `Set` to `array`
8
+ * - converts `Map` to `object`
9
+ * - cuts `methods` of an object
10
+ * - cuts `symbol` properties of an object
11
+ * - cuts `non-string keys` of an object
12
+ * - cuts `undefined` properties of an object
13
+ *
14
+ * @param {any} value
15
+ * @return {any}
16
+ * */
17
+ export declare function secureObject<E>(value: E): E;
18
+ /**
19
+ * Converts an object to secure string
20
+ *
21
+ * - `secure` means:
22
+ * - removes `circular` relations
23
+ * - cuts after max depths, default: `10`
24
+ * - converts `Set` to `array`
25
+ * - converts `Map` to `object`
26
+ * - cuts `methods` of an object
27
+ * - cuts `symbol` properties of an object
28
+ * - cuts `non-string keys` of an object
29
+ * - cuts `undefined` properties of an object
30
+ *
31
+ * Note:
32
+ * `JSON.stringify` can fail if there is a `dependency
33
+ *
34
+ * @param {any} value
35
+ * @return {string}
36
+ * */
37
+ export declare function secureJson(value: unknown): string;
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.secureObject = secureObject;
4
+ exports.secureJson = secureJson;
5
+ /**
6
+ * Inner secure json function, it will be used after creating weak set
7
+ *
8
+ * @param {any} value
9
+ * @param {number} depth
10
+ * @param {WeakSet} set
11
+ * */
12
+ function _secureObject(value, depth, set) {
13
+ var _a, _b, _c;
14
+ if ([null, undefined].includes(value)) {
15
+ return value;
16
+ }
17
+ switch (typeof value) {
18
+ case 'object':
19
+ if (set.has(value)) {
20
+ return `#circular <${(_a = value === null || value === void 0 ? void 0 : value.constructor) === null || _a === void 0 ? void 0 : _a.name}>`;
21
+ }
22
+ if (depth >= 10) {
23
+ return `#depth <${(_b = value === null || value === void 0 ? void 0 : value.constructor) === null || _b === void 0 ? void 0 : _b.name}>`;
24
+ }
25
+ set.add(value);
26
+ if (Array.isArray(value)) {
27
+ return value.map(item => _secureObject(item, depth + 1, set));
28
+ }
29
+ if (value instanceof Set) {
30
+ return Array.from(value).map(item => _secureObject(item, depth + 1, set));
31
+ }
32
+ const obj = {};
33
+ if (value instanceof Map) {
34
+ for (const [k, v] of value.entries()) {
35
+ if (typeof k === 'string') {
36
+ obj[k] = _secureObject(v, depth + 1, set);
37
+ }
38
+ }
39
+ }
40
+ else if ((value === null || value === void 0 ? void 0 : value.constructor) === Object) {
41
+ for (const [k, v] of Object.entries(value)) {
42
+ if (typeof k === 'string') {
43
+ obj[k] = _secureObject(v, depth + 1, set);
44
+ }
45
+ }
46
+ }
47
+ else {
48
+ let exists;
49
+ for (const [k, v] of Object.entries(value)) {
50
+ if (typeof k === 'string' && !['function', 'symbol', 'undefined'].includes(typeof value)) {
51
+ exists = true;
52
+ obj[k] = _secureObject(v, depth + 1, set);
53
+ }
54
+ }
55
+ if (!exists) {
56
+ try {
57
+ return JSON.parse(JSON.stringify(value));
58
+ }
59
+ catch (e) {
60
+ return `#parse <${(_c = value === null || value === void 0 ? void 0 : value.constructor) === null || _c === void 0 ? void 0 : _c.name}>`;
61
+ }
62
+ }
63
+ }
64
+ return obj;
65
+ case 'function':
66
+ return `#function <${value.name}> (length: ${value.length})`;
67
+ case 'symbol':
68
+ return `#symbol <${value.description}>`;
69
+ }
70
+ return value;
71
+ }
72
+ // noinspection JSUnusedGlobalSymbols
73
+ /**
74
+ * Converts an object to secure object
75
+ *
76
+ * - `secure` means:
77
+ * - removes `circular` relations
78
+ * - cuts after max depths, default: `10`
79
+ * - converts `Set` to `array`
80
+ * - converts `Map` to `object`
81
+ * - cuts `methods` of an object
82
+ * - cuts `symbol` properties of an object
83
+ * - cuts `non-string keys` of an object
84
+ * - cuts `undefined` properties of an object
85
+ *
86
+ * @param {any} value
87
+ * @return {any}
88
+ * */
89
+ function secureObject(value) {
90
+ try {
91
+ return _secureObject(value, 0, new WeakSet());
92
+ }
93
+ catch (e) {
94
+ return `#error <${e.name}> (message: ${e.message})`;
95
+ }
96
+ }
97
+ // noinspection JSUnusedGlobalSymbols
98
+ /**
99
+ * Converts an object to secure string
100
+ *
101
+ * - `secure` means:
102
+ * - removes `circular` relations
103
+ * - cuts after max depths, default: `10`
104
+ * - converts `Set` to `array`
105
+ * - converts `Map` to `object`
106
+ * - cuts `methods` of an object
107
+ * - cuts `symbol` properties of an object
108
+ * - cuts `non-string keys` of an object
109
+ * - cuts `undefined` properties of an object
110
+ *
111
+ * Note:
112
+ * `JSON.stringify` can fail if there is a `dependency
113
+ *
114
+ * @param {any} value
115
+ * @return {string}
116
+ * */
117
+ function secureJson(value) {
118
+ try {
119
+ const json = _secureObject(value, 0, new WeakSet());
120
+ return (typeof json === 'string') ? json : JSON.stringify(json);
121
+ }
122
+ catch (e) {
123
+ return `#error <${e.name}> (message: ${e.message})`;
124
+ }
125
+ }
126
+ //# sourceMappingURL=secure-json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secure-json.js","sourceRoot":"","sources":["../../src/util/secure-json.ts"],"names":[],"mappings":";;AAoFA,oCAMC;AAsBD,gCAOC;AArHD;;;;;;KAMK;AACL,SAAS,aAAa,CAAC,KAAc,EAAE,KAAa,EAAE,GAAiB;;IACnE,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACpC,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,QAAQ,OAAO,KAAK,EAAE,CAAC;QACnB,KAAK,QAAQ;YACT,IAAI,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;gBACjB,OAAO,cAAc,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,WAAW,0CAAE,IAAI,GAAG,CAAC;YACrD,CAAC;YACD,IAAI,KAAK,IAAI,EAAE,EAAE,CAAC;gBACd,OAAO,WAAW,MAAA,KAAK,aA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AE,CAAC;QACT,OAAO,WAAW,CAAC,CAAC,IAAI,eAAe,CAAC,CAAC,OAAO,GAAQ,CAAC;IAC7D,CAAC;AACL,CAAC;AAED,qCAAqC;AACrC;;;;;;;;;;;;;;;;;;KAkBK;AACL,SAAgB,UAAU,CAAC,KAAc;IACrC,IAAI,CAAC;QACD,MAAM,IAAI,GAAG,aAAa,CAAC,KAAK,EAAE,CAAC,EAAE,IAAI,OAAO,EAAO,CAAC,CAAC;QACzD,OAAO,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACpE,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACT,OAAO,WAAW,CAAC,CAAC,IAAI,eAAe,CAAC,CAAC,OAAO,GAAG,CAAC;IACxD,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leyyo/common",
3
- "version": "1.0.12",
3
+ "version": "1.2.1",
4
4
  "description": "Common library",
5
5
  "keywords": [
6
6
  "common"
@@ -49,6 +49,6 @@
49
49
  "typescript": "^5.7.3"
50
50
  },
51
51
  "dependencies": {
52
- "yaml": "^2.8.0"
52
+ "stacktrace-parser": "^0.1.11"
53
53
  }
54
54
  }