@powfix/core-js 0.22.1 → 0.23.0

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 (303) hide show
  1. package/dist/browser/index.cjs +1 -0
  2. package/dist/browser/index.d.ts +2 -0
  3. package/dist/browser/index.js +0 -0
  4. package/dist/chunk-ETV4XYOV.cjs +18 -0
  5. package/dist/chunk-PKBMQBKP.js +17 -0
  6. package/dist/index.browser.cjs +15 -1831
  7. package/dist/index.browser.d.ts +57 -484
  8. package/dist/index.browser.js +2 -1773
  9. package/dist/index.cjs +7 -1832
  10. package/dist/index.d.ts +52 -1
  11. package/dist/index.js +1 -1773
  12. package/dist/index.node.cjs +13 -76631
  13. package/dist/index.node.d.ts +77 -164
  14. package/dist/index.node.js +2 -76578
  15. package/dist/nodejs/constants/TransactionManagerLogLevel.cjs +11 -0
  16. package/dist/nodejs/constants/TransactionManagerLogLevel.d.ts +9 -0
  17. package/dist/nodejs/constants/TransactionManagerLogLevel.js +10 -0
  18. package/dist/nodejs/constants/TransactionManagerTimeoutAction.cjs +8 -0
  19. package/dist/nodejs/constants/TransactionManagerTimeoutAction.d.ts +6 -0
  20. package/dist/nodejs/constants/TransactionManagerTimeoutAction.js +7 -0
  21. package/dist/nodejs/constants/index.cjs +19 -0
  22. package/dist/nodejs/constants/index.d.ts +2 -0
  23. package/dist/nodejs/constants/index.js +2 -0
  24. package/dist/nodejs/index.cjs +55 -0
  25. package/dist/nodejs/index.d.ts +25 -0
  26. package/dist/nodejs/index.js +6 -0
  27. package/dist/nodejs/interfaces/db/index.cjs +10 -0
  28. package/dist/nodejs/interfaces/db/index.d.ts +10 -0
  29. package/dist/nodejs/interfaces/db/index.js +1 -0
  30. package/dist/nodejs/interfaces/db/sequelize/Hook.cjs +1 -0
  31. package/dist/nodejs/interfaces/db/sequelize/Hook.d.ts +13 -0
  32. package/dist/nodejs/interfaces/db/sequelize/Hook.js +0 -0
  33. package/dist/nodejs/interfaces/db/sequelize/HookFn.cjs +1 -0
  34. package/dist/nodejs/interfaces/db/sequelize/HookFn.d.ts +7 -0
  35. package/dist/nodejs/interfaces/db/sequelize/HookFn.js +0 -0
  36. package/dist/nodejs/interfaces/db/sequelize/HookType.cjs +1 -0
  37. package/dist/nodejs/interfaces/db/sequelize/HookType.d.ts +6 -0
  38. package/dist/nodejs/interfaces/db/sequelize/HookType.js +0 -0
  39. package/dist/nodejs/interfaces/db/sequelize/ReloadOption.cjs +1 -0
  40. package/dist/nodejs/interfaces/db/sequelize/ReloadOption.d.ts +5 -0
  41. package/dist/nodejs/interfaces/db/sequelize/ReloadOption.js +0 -0
  42. package/dist/nodejs/interfaces/db/sequelize/TransactionOption.cjs +1 -0
  43. package/dist/nodejs/interfaces/db/sequelize/TransactionOption.d.ts +7 -0
  44. package/dist/nodejs/interfaces/db/sequelize/TransactionOption.js +0 -0
  45. package/dist/nodejs/interfaces/db/sequelize/UpsertOptions.cjs +1 -0
  46. package/dist/nodejs/interfaces/db/sequelize/UpsertOptions.d.ts +8 -0
  47. package/dist/nodejs/interfaces/db/sequelize/UpsertOptions.js +0 -0
  48. package/dist/nodejs/interfaces/db/sequelize/index.cjs +55 -0
  49. package/dist/nodejs/interfaces/db/sequelize/index.d.ts +10 -0
  50. package/dist/nodejs/interfaces/db/sequelize/index.js +6 -0
  51. package/dist/nodejs/interfaces/index.cjs +10 -0
  52. package/dist/nodejs/interfaces/index.d.ts +10 -0
  53. package/dist/nodejs/interfaces/index.js +1 -0
  54. package/dist/nodejs/managers/TransactionManager.cjs +463 -0
  55. package/dist/nodejs/managers/TransactionManager.d.ts +31 -0
  56. package/dist/nodejs/managers/TransactionManager.js +457 -0
  57. package/dist/nodejs/managers/TransactionManager.types.cjs +1 -0
  58. package/dist/nodejs/managers/TransactionManager.types.d.ts +12 -0
  59. package/dist/nodejs/managers/TransactionManager.types.js +0 -0
  60. package/dist/nodejs/managers/index.cjs +19 -0
  61. package/dist/nodejs/managers/index.d.ts +6 -0
  62. package/dist/nodejs/managers/index.js +2 -0
  63. package/dist/nodejs/services/index.cjs +10 -0
  64. package/dist/nodejs/services/index.d.ts +5 -0
  65. package/dist/nodejs/services/index.js +1 -0
  66. package/dist/nodejs/services/redis/RedisClient.cjs +250 -0
  67. package/dist/nodejs/services/redis/RedisClient.d.ts +24 -0
  68. package/dist/nodejs/services/redis/RedisClient.js +250 -0
  69. package/dist/nodejs/services/redis/RedisPublisher.cjs +323 -0
  70. package/dist/nodejs/services/redis/RedisPublisher.d.ts +17 -0
  71. package/dist/nodejs/services/redis/RedisPublisher.js +323 -0
  72. package/dist/nodejs/services/redis/RedisSubscriber.cjs +502 -0
  73. package/dist/nodejs/services/redis/RedisSubscriber.d.ts +15 -0
  74. package/dist/nodejs/services/redis/RedisSubscriber.js +502 -0
  75. package/dist/nodejs/services/redis/index.cjs +28 -0
  76. package/dist/nodejs/services/redis/index.d.ts +5 -0
  77. package/dist/nodejs/services/redis/index.js +3 -0
  78. package/dist/nodejs/types/UpsertResult.cjs +1 -0
  79. package/dist/nodejs/types/UpsertResult.d.ts +5 -0
  80. package/dist/nodejs/types/UpsertResult.js +0 -0
  81. package/dist/nodejs/types/index.cjs +19 -0
  82. package/dist/nodejs/types/index.d.ts +9 -0
  83. package/dist/nodejs/types/index.js +2 -0
  84. package/dist/nodejs/types/mariaDb.cjs +1 -0
  85. package/dist/nodejs/types/mariaDb.d.ts +15 -0
  86. package/dist/nodejs/types/mariaDb.js +0 -0
  87. package/dist/nodejs/utils/HookUtils.cjs +87 -0
  88. package/dist/nodejs/utils/HookUtils.d.ts +20 -0
  89. package/dist/nodejs/utils/HookUtils.js +87 -0
  90. package/dist/nodejs/utils/index.cjs +19 -0
  91. package/dist/nodejs/utils/index.d.ts +10 -0
  92. package/dist/nodejs/utils/index.js +2 -0
  93. package/dist/nodejs/utils/sequelize-utils/SequelizeUtils.cjs +165 -0
  94. package/dist/nodejs/utils/sequelize-utils/SequelizeUtils.d.ts +12 -0
  95. package/dist/nodejs/utils/sequelize-utils/SequelizeUtils.js +165 -0
  96. package/dist/nodejs/utils/sequelize-utils/index.cjs +19 -0
  97. package/dist/nodejs/utils/sequelize-utils/index.d.ts +3 -0
  98. package/dist/nodejs/utils/sequelize-utils/index.js +2 -0
  99. package/dist/nodejs/utils/sequelize-utils/types.cjs +1 -0
  100. package/dist/nodejs/utils/sequelize-utils/types.d.ts +19 -0
  101. package/dist/nodejs/utils/sequelize-utils/types.js +0 -0
  102. package/dist/shared/constants/COORDINATE.cjs +15 -0
  103. package/dist/shared/constants/COORDINATE.d.ts +9 -0
  104. package/dist/shared/constants/COORDINATE.js +15 -0
  105. package/dist/shared/constants/CRUD.cjs +26 -0
  106. package/dist/shared/constants/CRUD.d.ts +11 -0
  107. package/dist/shared/constants/CRUD.js +26 -0
  108. package/dist/shared/constants/DATE.cjs +34 -0
  109. package/dist/shared/constants/DATE.d.ts +15 -0
  110. package/dist/shared/constants/DATE.js +34 -0
  111. package/dist/shared/constants/DISTANCE.cjs +22 -0
  112. package/dist/shared/constants/DISTANCE.d.ts +15 -0
  113. package/dist/shared/constants/DISTANCE.js +22 -0
  114. package/dist/shared/constants/DURATION.cjs +25 -0
  115. package/dist/shared/constants/DURATION.d.ts +18 -0
  116. package/dist/shared/constants/DURATION.js +25 -0
  117. package/dist/shared/constants/NOT_NULL.cjs +4 -0
  118. package/dist/shared/constants/NOT_NULL.d.ts +3 -0
  119. package/dist/shared/constants/NOT_NULL.js +3 -0
  120. package/dist/shared/constants/index.cjs +55 -0
  121. package/dist/shared/constants/index.d.ts +6 -0
  122. package/dist/shared/constants/index.js +6 -0
  123. package/dist/shared/exports/Uint8Array.cjs +9 -0
  124. package/dist/shared/exports/Uint8Array.d.ts +6 -0
  125. package/dist/shared/exports/Uint8Array.js +8 -0
  126. package/dist/shared/exports/atob.cjs +3 -0
  127. package/dist/shared/exports/atob.d.ts +2 -0
  128. package/dist/shared/exports/atob.js +2 -0
  129. package/dist/shared/exports/btoa.cjs +3 -0
  130. package/dist/shared/exports/btoa.d.ts +2 -0
  131. package/dist/shared/exports/btoa.js +2 -0
  132. package/dist/shared/index.cjs +64 -0
  133. package/dist/shared/index.d.ts +57 -0
  134. package/dist/shared/index.js +7 -0
  135. package/dist/shared/interfaces/Coordinate.cjs +1 -0
  136. package/dist/shared/interfaces/Coordinate.d.ts +10 -0
  137. package/dist/shared/interfaces/Coordinate.js +0 -0
  138. package/dist/shared/interfaces/Point2.cjs +1 -0
  139. package/dist/shared/interfaces/Point2.d.ts +6 -0
  140. package/dist/shared/interfaces/Point2.js +0 -0
  141. package/dist/shared/interfaces/Point3.cjs +1 -0
  142. package/dist/shared/interfaces/Point3.d.ts +7 -0
  143. package/dist/shared/interfaces/Point3.js +0 -0
  144. package/dist/shared/interfaces/StorageProvider.cjs +1 -0
  145. package/dist/shared/interfaces/StorageProvider.d.ts +9 -0
  146. package/dist/shared/interfaces/StorageProvider.js +0 -0
  147. package/dist/shared/interfaces/index.cjs +37 -0
  148. package/dist/shared/interfaces/index.d.ts +4 -0
  149. package/dist/shared/interfaces/index.js +4 -0
  150. package/dist/shared/managers/SessionManager.cjs +498 -0
  151. package/dist/shared/managers/SessionManager.d.ts +18 -0
  152. package/dist/shared/managers/SessionManager.js +491 -0
  153. package/dist/shared/managers/SessionManager.type.cjs +1 -0
  154. package/dist/shared/managers/SessionManager.type.d.ts +12 -0
  155. package/dist/shared/managers/SessionManager.type.js +0 -0
  156. package/dist/shared/managers/index.cjs +19 -0
  157. package/dist/shared/managers/index.d.ts +5 -0
  158. package/dist/shared/managers/index.js +2 -0
  159. package/dist/shared/scripts/base64Polyfill.cjs +20 -0
  160. package/dist/shared/scripts/base64Polyfill.d.ts +3 -0
  161. package/dist/shared/scripts/base64Polyfill.js +13 -0
  162. package/dist/shared/scripts/index.cjs +10 -0
  163. package/dist/shared/scripts/index.d.ts +1 -0
  164. package/dist/shared/scripts/index.js +1 -0
  165. package/dist/shared/services/index.cjs +10 -0
  166. package/dist/shared/services/index.d.ts +3 -0
  167. package/dist/shared/services/index.js +1 -0
  168. package/dist/shared/services/time/TimeService.cjs +487 -0
  169. package/dist/shared/services/time/TimeService.d.ts +34 -0
  170. package/dist/shared/services/time/TimeService.js +481 -0
  171. package/dist/shared/services/time/TimeService.type.cjs +1 -0
  172. package/dist/shared/services/time/TimeService.type.d.ts +23 -0
  173. package/dist/shared/services/time/TimeService.type.js +0 -0
  174. package/dist/shared/services/time/index.cjs +19 -0
  175. package/dist/shared/services/time/index.d.ts +3 -0
  176. package/dist/shared/services/time/index.js +2 -0
  177. package/dist/shared/types/IntRage.cjs +1 -0
  178. package/dist/shared/types/IntRage.d.ts +4 -0
  179. package/dist/shared/types/IntRage.js +0 -0
  180. package/dist/shared/types/PartialExcept.cjs +1 -0
  181. package/dist/shared/types/PartialExcept.d.ts +3 -0
  182. package/dist/shared/types/PartialExcept.js +0 -0
  183. package/dist/shared/types/index.cjs +19 -0
  184. package/dist/shared/types/index.d.ts +2 -0
  185. package/dist/shared/types/index.js +2 -0
  186. package/dist/shared/utils/ArrayUtils.cjs +104 -0
  187. package/dist/shared/utils/ArrayUtils.d.ts +14 -0
  188. package/dist/shared/utils/ArrayUtils.js +104 -0
  189. package/dist/shared/utils/AxiosUtils.cjs +113 -0
  190. package/dist/shared/utils/AxiosUtils.d.ts +8 -0
  191. package/dist/shared/utils/AxiosUtils.js +113 -0
  192. package/dist/shared/utils/BooleanUtils.cjs +7 -0
  193. package/dist/shared/utils/BooleanUtils.d.ts +3 -0
  194. package/dist/shared/utils/BooleanUtils.js +6 -0
  195. package/dist/shared/utils/Calc.cjs +62 -0
  196. package/dist/shared/utils/Calc.d.ts +6 -0
  197. package/dist/shared/utils/Calc.js +62 -0
  198. package/dist/shared/utils/CoordinateUtils.cjs +85 -0
  199. package/dist/shared/utils/CoordinateUtils.d.ts +11 -0
  200. package/dist/shared/utils/CoordinateUtils.js +85 -0
  201. package/dist/shared/utils/DateUtils.cjs +656 -0
  202. package/dist/shared/utils/DateUtils.d.ts +27 -0
  203. package/dist/shared/utils/DateUtils.js +651 -0
  204. package/dist/shared/utils/Enum.cjs +142 -0
  205. package/dist/shared/utils/Enum.d.ts +19 -0
  206. package/dist/shared/utils/Enum.js +142 -0
  207. package/dist/shared/utils/Enum.types.cjs +1 -0
  208. package/dist/shared/utils/Enum.types.d.ts +7 -0
  209. package/dist/shared/utils/Enum.types.js +0 -0
  210. package/dist/shared/utils/I18nUtils.cjs +48 -0
  211. package/dist/shared/utils/I18nUtils.d.ts +7 -0
  212. package/dist/shared/utils/I18nUtils.js +42 -0
  213. package/dist/shared/utils/JuminNumberUtils.cjs +71 -0
  214. package/dist/shared/utils/JuminNumberUtils.d.ts +6 -0
  215. package/dist/shared/utils/JuminNumberUtils.js +71 -0
  216. package/dist/shared/utils/NumberUtils.cjs +80 -0
  217. package/dist/shared/utils/NumberUtils.d.ts +6 -0
  218. package/dist/shared/utils/NumberUtils.js +80 -0
  219. package/dist/shared/utils/ObjectIdUtils.cjs +65 -0
  220. package/dist/shared/utils/ObjectIdUtils.d.ts +6 -0
  221. package/dist/shared/utils/ObjectIdUtils.js +65 -0
  222. package/dist/shared/utils/Point3Utils.cjs +39 -0
  223. package/dist/shared/utils/Point3Utils.d.ts +8 -0
  224. package/dist/shared/utils/Point3Utils.js +39 -0
  225. package/dist/shared/utils/RandomUtils.cjs +103 -0
  226. package/dist/shared/utils/RandomUtils.d.ts +10 -0
  227. package/dist/shared/utils/RandomUtils.js +103 -0
  228. package/dist/shared/utils/Sequencer.cjs +476 -0
  229. package/dist/shared/utils/Sequencer.d.ts +41 -0
  230. package/dist/shared/utils/Sequencer.js +467 -0
  231. package/dist/shared/utils/StringUtils.cjs +71 -0
  232. package/dist/shared/utils/StringUtils.d.ts +7 -0
  233. package/dist/shared/utils/StringUtils.js +71 -0
  234. package/dist/shared/utils/Uint8ArrayUtils.cjs +48 -0
  235. package/dist/shared/utils/Uint8ArrayUtils.d.ts +6 -0
  236. package/dist/shared/utils/Uint8ArrayUtils.js +48 -0
  237. package/dist/shared/utils/UuidUtils.cjs +95 -0
  238. package/dist/shared/utils/UuidUtils.d.ts +16 -0
  239. package/dist/shared/utils/UuidUtils.js +75 -0
  240. package/dist/shared/utils/Validator.cjs +135 -0
  241. package/dist/shared/utils/Validator.d.ts +50 -0
  242. package/dist/shared/utils/Validator.js +135 -0
  243. package/dist/shared/utils/global/atob.cjs +12 -0
  244. package/dist/shared/utils/global/atob.d.ts +5 -0
  245. package/dist/shared/utils/global/atob.js +5 -0
  246. package/dist/shared/utils/global/base64.cjs +42 -0
  247. package/dist/shared/utils/global/base64.d.ts +4 -0
  248. package/dist/shared/utils/global/base64.js +40 -0
  249. package/dist/shared/utils/global/between.cjs +6 -0
  250. package/dist/shared/utils/global/between.d.ts +3 -0
  251. package/dist/shared/utils/global/between.js +5 -0
  252. package/dist/shared/utils/global/btoa.cjs +12 -0
  253. package/dist/shared/utils/global/btoa.d.ts +5 -0
  254. package/dist/shared/utils/global/btoa.js +5 -0
  255. package/dist/shared/utils/global/castArray.cjs +8 -0
  256. package/dist/shared/utils/global/castArray.d.ts +3 -0
  257. package/dist/shared/utils/global/castArray.js +7 -0
  258. package/dist/shared/utils/global/circularDistance.cjs +13 -0
  259. package/dist/shared/utils/global/circularDistance.d.ts +3 -0
  260. package/dist/shared/utils/global/circularDistance.js +12 -0
  261. package/dist/shared/utils/global/fallbackIfMatch.cjs +13 -0
  262. package/dist/shared/utils/global/fallbackIfMatch.d.ts +3 -0
  263. package/dist/shared/utils/global/fallbackIfMatch.js +12 -0
  264. package/dist/shared/utils/global/fallbackIfNull.cjs +7 -0
  265. package/dist/shared/utils/global/fallbackIfNull.d.ts +3 -0
  266. package/dist/shared/utils/global/fallbackIfNull.js +6 -0
  267. package/dist/shared/utils/global/fallbackIfNullish.cjs +9 -0
  268. package/dist/shared/utils/global/fallbackIfNullish.d.ts +3 -0
  269. package/dist/shared/utils/global/fallbackIfNullish.js +8 -0
  270. package/dist/shared/utils/global/fallbackIfUndefined.cjs +7 -0
  271. package/dist/shared/utils/global/fallbackIfUndefined.d.ts +3 -0
  272. package/dist/shared/utils/global/fallbackIfUndefined.js +6 -0
  273. package/dist/shared/utils/global/firstNonNullish.cjs +40 -0
  274. package/dist/shared/utils/global/firstNonNullish.d.ts +3 -0
  275. package/dist/shared/utils/global/firstNonNullish.js +39 -0
  276. package/dist/shared/utils/global/flat.cjs +102 -0
  277. package/dist/shared/utils/global/flat.d.ts +16 -0
  278. package/dist/shared/utils/global/flat.js +100 -0
  279. package/dist/shared/utils/global/index.cjs +136 -0
  280. package/dist/shared/utils/global/index.d.ts +16 -0
  281. package/dist/shared/utils/global/index.js +15 -0
  282. package/dist/shared/utils/global/processFirstNonNullish.cjs +40 -0
  283. package/dist/shared/utils/global/processFirstNonNullish.d.ts +3 -0
  284. package/dist/shared/utils/global/processFirstNonNullish.js +38 -0
  285. package/dist/shared/utils/global/pureEnum.cjs +69 -0
  286. package/dist/shared/utils/global/pureEnum.d.ts +18 -0
  287. package/dist/shared/utils/global/pureEnum.js +66 -0
  288. package/dist/shared/utils/global/sleep.cjs +8 -0
  289. package/dist/shared/utils/global/sleep.d.ts +3 -0
  290. package/dist/shared/utils/global/sleep.js +7 -0
  291. package/dist/shared/utils/index.cjs +190 -0
  292. package/dist/shared/utils/index.d.ts +44 -0
  293. package/dist/shared/utils/index.js +21 -0
  294. package/dist/shared/utils/try-catch/TryCatch.cjs +237 -0
  295. package/dist/shared/utils/try-catch/TryCatch.d.ts +26 -0
  296. package/dist/shared/utils/try-catch/TryCatch.js +237 -0
  297. package/dist/shared/utils/try-catch/index.cjs +10 -0
  298. package/dist/shared/utils/try-catch/index.d.ts +1 -0
  299. package/dist/shared/utils/try-catch/index.js +1 -0
  300. package/package.json +6 -10
  301. package/dist/index.browser.d.cts +0 -484
  302. package/dist/index.d.cts +0 -6
  303. package/dist/index.node.d.cts +0 -168
@@ -0,0 +1,476 @@
1
+ 'use strict';
2
+ function _array_like_to_array(arr, len) {
3
+ if (len == null || len > arr.length) len = arr.length;
4
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
5
+ return arr2;
6
+ }
7
+ function _array_without_holes(arr) {
8
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
9
+ }
10
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
11
+ try {
12
+ var info = gen[key](arg);
13
+ var value = info.value;
14
+ } catch (error) {
15
+ reject(error);
16
+ return;
17
+ }
18
+ if (info.done) {
19
+ resolve(value);
20
+ } else {
21
+ Promise.resolve(value).then(_next, _throw);
22
+ }
23
+ }
24
+ function _async_to_generator(fn) {
25
+ return function() {
26
+ var self = this, args = arguments;
27
+ return new Promise(function(resolve, reject) {
28
+ var gen = fn.apply(self, args);
29
+ function _next(value) {
30
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
31
+ }
32
+ function _throw(err) {
33
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
34
+ }
35
+ _next(undefined);
36
+ });
37
+ };
38
+ }
39
+ function _class_call_check(instance, Constructor) {
40
+ if (!(instance instanceof Constructor)) {
41
+ throw new TypeError("Cannot call a class as a function");
42
+ }
43
+ }
44
+ function _defineProperties(target, props) {
45
+ for(var i = 0; i < props.length; i++){
46
+ var descriptor = props[i];
47
+ descriptor.enumerable = descriptor.enumerable || false;
48
+ descriptor.configurable = true;
49
+ if ("value" in descriptor) descriptor.writable = true;
50
+ Object.defineProperty(target, descriptor.key, descriptor);
51
+ }
52
+ }
53
+ function _create_class(Constructor, protoProps, staticProps) {
54
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
55
+ if (staticProps) _defineProperties(Constructor, staticProps);
56
+ return Constructor;
57
+ }
58
+ function _iterable_to_array(iter) {
59
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
60
+ }
61
+ function _non_iterable_spread() {
62
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
63
+ }
64
+ function _to_consumable_array(arr) {
65
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
66
+ }
67
+ function _type_of(obj) {
68
+ "@swc/helpers - typeof";
69
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
70
+ }
71
+ function _unsupported_iterable_to_array(o, minLen) {
72
+ if (!o) return;
73
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
74
+ var n = Object.prototype.toString.call(o).slice(8, -1);
75
+ if (n === "Object" && o.constructor) n = o.constructor.name;
76
+ if (n === "Map" || n === "Set") return Array.from(n);
77
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
78
+ }
79
+ function _ts_generator(thisArg, body) {
80
+ var f, y, t, _ = {
81
+ label: 0,
82
+ sent: function() {
83
+ if (t[0] & 1) throw t[1];
84
+ return t[1];
85
+ },
86
+ trys: [],
87
+ ops: []
88
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
89
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
90
+ return this;
91
+ }), g;
92
+ function verb(n) {
93
+ return function(v) {
94
+ return step([
95
+ n,
96
+ v
97
+ ]);
98
+ };
99
+ }
100
+ function step(op) {
101
+ if (f) throw new TypeError("Generator is already executing.");
102
+ while(g && (g = 0, op[0] && (_ = 0)), _)try {
103
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
104
+ if (y = 0, t) op = [
105
+ op[0] & 2,
106
+ t.value
107
+ ];
108
+ switch(op[0]){
109
+ case 0:
110
+ case 1:
111
+ t = op;
112
+ break;
113
+ case 4:
114
+ _.label++;
115
+ return {
116
+ value: op[1],
117
+ done: false
118
+ };
119
+ case 5:
120
+ _.label++;
121
+ y = op[1];
122
+ op = [
123
+ 0
124
+ ];
125
+ continue;
126
+ case 7:
127
+ op = _.ops.pop();
128
+ _.trys.pop();
129
+ continue;
130
+ default:
131
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
132
+ _ = 0;
133
+ continue;
134
+ }
135
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
136
+ _.label = op[1];
137
+ break;
138
+ }
139
+ if (op[0] === 6 && _.label < t[1]) {
140
+ _.label = t[1];
141
+ t = op;
142
+ break;
143
+ }
144
+ if (t && _.label < t[2]) {
145
+ _.label = t[2];
146
+ _.ops.push(op);
147
+ break;
148
+ }
149
+ if (t[2]) _.ops.pop();
150
+ _.trys.pop();
151
+ continue;
152
+ }
153
+ op = body.call(thisArg, _);
154
+ } catch (e) {
155
+ op = [
156
+ 6,
157
+ e
158
+ ];
159
+ y = 0;
160
+ } finally{
161
+ f = t = 0;
162
+ }
163
+ if (op[0] & 5) throw op[1];
164
+ return {
165
+ value: op[0] ? op[1] : void 0,
166
+ done: true
167
+ };
168
+ }
169
+ }
170
+ function _ts_values(o) {
171
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
172
+ if (m) return m.call(o);
173
+ if (o && typeof o.length === "number") return {
174
+ next: function() {
175
+ if (o && i >= o.length) o = void 0;
176
+ return {
177
+ value: o && o[i++],
178
+ done: !o
179
+ };
180
+ }
181
+ };
182
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
183
+ }
184
+ var chunkETV4XYOV_cjs = require('../../chunk-ETV4XYOV.cjs');
185
+ var moment = require('moment');
186
+ var EventEmitter3 = require('eventemitter3');
187
+ function _interopDefault(e) {
188
+ return e && e.__esModule ? e : {
189
+ default: e
190
+ };
191
+ }
192
+ var moment__default = /*#__PURE__*/ _interopDefault(moment);
193
+ var EventEmitter3__default = /*#__PURE__*/ _interopDefault(EventEmitter3);
194
+ var SequencerStatus = /* @__PURE__ */ function(SequencerStatus2) {
195
+ SequencerStatus2[SequencerStatus2["IDLE"] = 0] = "IDLE";
196
+ SequencerStatus2[SequencerStatus2["RUNNING"] = 1] = "RUNNING";
197
+ SequencerStatus2[SequencerStatus2["ERROR"] = 2] = "ERROR";
198
+ SequencerStatus2[SequencerStatus2["DONE"] = 3] = "DONE";
199
+ return SequencerStatus2;
200
+ }(SequencerStatus || {});
201
+ var SequencerEvent = /* @__PURE__ */ function(SequencerEvent2) {
202
+ SequencerEvent2["START"] = "START";
203
+ SequencerEvent2["END"] = "END";
204
+ SequencerEvent2["SEQUENCE_START"] = "SEQUENCE_START";
205
+ SequencerEvent2["SEQUENCE_END"] = "SEQUENCE_END";
206
+ return SequencerEvent2;
207
+ }(SequencerEvent || {});
208
+ var Sequencer = /*#__PURE__*/ function() {
209
+ function Sequencer(option) {
210
+ var _this = this;
211
+ _class_call_check(this, Sequencer);
212
+ chunkETV4XYOV_cjs.__publicField(this, "sequences", []);
213
+ chunkETV4XYOV_cjs.__publicField(this, "status", 0 /* IDLE */ );
214
+ chunkETV4XYOV_cjs.__publicField(this, "minimumExecutionTime", 0);
215
+ // Reset variables task is done
216
+ chunkETV4XYOV_cjs.__publicField(this, "currentSequence", null);
217
+ chunkETV4XYOV_cjs.__publicField(this, "startTimestamp", null);
218
+ chunkETV4XYOV_cjs.__publicField(this, "endTimestamp", null);
219
+ // Emitter
220
+ chunkETV4XYOV_cjs.__publicField(this, "eventEmitter", new EventEmitter3__default.default());
221
+ chunkETV4XYOV_cjs.__publicField(this, "pushSequence", function(sequence) {
222
+ _this.sequences.push(sequence);
223
+ });
224
+ chunkETV4XYOV_cjs.__publicField(this, "start", function() {
225
+ return _async_to_generator(function() {
226
+ var _this, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _this1, _loop, _iterator, _step, _ret, err;
227
+ return _ts_generator(this, function(_state) {
228
+ switch(_state.label){
229
+ case 0:
230
+ _this = this;
231
+ if (this.status === 1 /* RUNNING */ ) {
232
+ console.warn("Sequencer status is", this.status);
233
+ return [
234
+ 2
235
+ ];
236
+ }
237
+ this.status = 1 /* RUNNING */ ;
238
+ this.currentSequence = null;
239
+ this.startTimestamp = this.getCurrentTimeStamp;
240
+ this.endTimestamp = null;
241
+ console.log("Sequence started, started at ".concat(this.startTimestamp, ", MINIMUM_EXECUTION_TIME is ").concat(this.minimumExecutionTime));
242
+ _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
243
+ _state.label = 1;
244
+ case 1:
245
+ _state.trys.push([
246
+ 1,
247
+ 6,
248
+ 7,
249
+ 8
250
+ ]);
251
+ _loop = function() {
252
+ var sequence, sequenceStartTimeStamp, e;
253
+ return _ts_generator(this, function(_state) {
254
+ switch(_state.label){
255
+ case 0:
256
+ sequence = _step.value;
257
+ console.log("Currently total execution time", _this1.executionTime);
258
+ sequenceStartTimeStamp = _this1.getCurrentTimeStamp;
259
+ _this1.currentSequence = sequence;
260
+ _this1.eventEmitter.emit("SEQUENCE_START" /* SEQUENCE_START */ , sequence);
261
+ _state.label = 1;
262
+ case 1:
263
+ _state.trys.push([
264
+ 1,
265
+ 3,
266
+ ,
267
+ 4
268
+ ]);
269
+ return [
270
+ 4,
271
+ new Promise(function(resolve, reject) {
272
+ return _async_to_generator(function() {
273
+ var _sequence_task, sequenceEndTimeStamp, sequenceExecutionTime, delay, dotInterpreterBlocked, dotInterpreter, e;
274
+ return _ts_generator(this, function(_state) {
275
+ switch(_state.label){
276
+ case 0:
277
+ _state.trys.push([
278
+ 0,
279
+ 2,
280
+ ,
281
+ 3
282
+ ]);
283
+ console.log("Sequence ".concat(sequence.key, " start"));
284
+ return [
285
+ 4,
286
+ (_sequence_task = sequence.task) === null || _sequence_task === void 0 ? void 0 : _sequence_task.call(sequence)
287
+ ];
288
+ case 1:
289
+ _state.sent();
290
+ sequenceEndTimeStamp = this.getCurrentTimeStamp;
291
+ sequenceExecutionTime = sequenceEndTimeStamp - sequenceStartTimeStamp;
292
+ console.log("✅ Sequence ".concat(sequence.key, " done at"), sequenceEndTimeStamp);
293
+ console.log("Sequence execution time", sequenceExecutionTime, "ms");
294
+ if (sequence.minimumExecutionTime) {
295
+ console.log("Sequence has minimumExecutionTime", sequence.minimumExecutionTime, "ms");
296
+ if (sequenceExecutionTime < sequence.minimumExecutionTime) {
297
+ delay = sequence.minimumExecutionTime - sequenceExecutionTime;
298
+ console.log("Sequence will delay", delay, "ms");
299
+ dotInterpreterBlocked = false;
300
+ dotInterpreter = setInterval(function() {
301
+ if (dotInterpreterBlocked) {
302
+ console.log("!");
303
+ return;
304
+ }
305
+ console.log(".");
306
+ }, 100);
307
+ setTimeout(function() {
308
+ dotInterpreterBlocked = true;
309
+ clearInterval(dotInterpreter);
310
+ console.log("done");
311
+ resolve();
312
+ }, delay);
313
+ return [
314
+ 2
315
+ ];
316
+ }
317
+ console.log("Sequence execution time is greater than minimum execution time");
318
+ resolve();
319
+ return [
320
+ 2
321
+ ];
322
+ }
323
+ resolve();
324
+ return [
325
+ 3,
326
+ 3
327
+ ];
328
+ case 2:
329
+ e = _state.sent();
330
+ reject(e);
331
+ return [
332
+ 3,
333
+ 3
334
+ ];
335
+ case 3:
336
+ return [
337
+ 2
338
+ ];
339
+ }
340
+ });
341
+ }).call(_this);
342
+ })
343
+ ];
344
+ case 2:
345
+ _state.sent();
346
+ console.log("Out of Promise");
347
+ _this1.eventEmitter.emit("SEQUENCE_END" /* SEQUENCE_END */ , sequence);
348
+ return [
349
+ 3,
350
+ 4
351
+ ];
352
+ case 3:
353
+ e = _state.sent();
354
+ if (sequence.required) {
355
+ console.error("\uD83D\uDEAB Sequence ".concat(sequence.key, " failed"), e);
356
+ _this1.status = 2 /* ERROR */ ;
357
+ _this1.currentSequence = null;
358
+ _this1.endTimestamp = _this1.currentSequence;
359
+ return [
360
+ 2,
361
+ {
362
+ v: Promise.reject({
363
+ sequence: sequence,
364
+ reason: e
365
+ })
366
+ }
367
+ ];
368
+ }
369
+ console.log("Sequence ".concat(sequence.key, " failed"), e);
370
+ _this1.eventEmitter.emit("SEQUENCE_END" /* SEQUENCE_END */ , sequence);
371
+ return [
372
+ 3,
373
+ 4
374
+ ];
375
+ case 4:
376
+ return [
377
+ 2
378
+ ];
379
+ }
380
+ });
381
+ };
382
+ _iterator = this.sequences[Symbol.iterator]();
383
+ _state.label = 2;
384
+ case 2:
385
+ if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done)) return [
386
+ 3,
387
+ 5
388
+ ];
389
+ _this1 = this;
390
+ return [
391
+ 5,
392
+ _ts_values(_loop())
393
+ ];
394
+ case 3:
395
+ _ret = _state.sent();
396
+ if (_type_of(_ret) === "object") return [
397
+ 2,
398
+ _ret.v
399
+ ];
400
+ _state.label = 4;
401
+ case 4:
402
+ _iteratorNormalCompletion = true;
403
+ return [
404
+ 3,
405
+ 2
406
+ ];
407
+ case 5:
408
+ return [
409
+ 3,
410
+ 8
411
+ ];
412
+ case 6:
413
+ err = _state.sent();
414
+ _didIteratorError = true;
415
+ _iteratorError = err;
416
+ return [
417
+ 3,
418
+ 8
419
+ ];
420
+ case 7:
421
+ try {
422
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
423
+ _iterator.return();
424
+ }
425
+ } finally{
426
+ if (_didIteratorError) {
427
+ throw _iteratorError;
428
+ }
429
+ }
430
+ return [
431
+ 7
432
+ ];
433
+ case 8:
434
+ this.status = 3 /* DONE */ ;
435
+ this.currentSequence = null;
436
+ this.endTimestamp = this.currentSequence;
437
+ return [
438
+ 2
439
+ ];
440
+ }
441
+ });
442
+ }).call(_this);
443
+ });
444
+ if (option === null || option === void 0 ? void 0 : option.sequences) {
445
+ var _this_sequences;
446
+ (_this_sequences = this.sequences).push.apply(_this_sequences, _to_consumable_array(option.sequences));
447
+ }
448
+ }
449
+ _create_class(Sequencer, [
450
+ {
451
+ key: "getCurrentTimeStamp",
452
+ get: function get() {
453
+ return parseInt(moment__default.default().format("x"), 10);
454
+ }
455
+ },
456
+ {
457
+ key: "executionTime",
458
+ get: function get() {
459
+ if (this.status === 0 /* IDLE */ ) {
460
+ return null;
461
+ }
462
+ if (!this.startTimestamp) {
463
+ return null;
464
+ }
465
+ if (this.startTimestamp && this.endTimestamp) {
466
+ return this.endTimestamp - this.startTimestamp;
467
+ }
468
+ return this.getCurrentTimeStamp - this.startTimestamp;
469
+ }
470
+ }
471
+ ]);
472
+ return Sequencer;
473
+ }();
474
+ exports.Sequencer = Sequencer;
475
+ exports.SequencerEvent = SequencerEvent;
476
+ exports.SequencerStatus = SequencerStatus;
@@ -0,0 +1,41 @@
1
+ import EventEmitter from 'eventemitter3';
2
+
3
+ interface Sequence {
4
+ key: string;
5
+ required?: boolean;
6
+ minimumExecutionTime?: number;
7
+ task: Function;
8
+ description?: string;
9
+ }
10
+ declare enum SequencerStatus {
11
+ IDLE = 0,
12
+ RUNNING = 1,
13
+ ERROR = 2,
14
+ DONE = 3
15
+ }
16
+ interface SequencerOption {
17
+ sequences?: Sequence[];
18
+ minimumExecutionTime?: number;
19
+ }
20
+ declare enum SequencerEvent {
21
+ START = "START",
22
+ END = "END",
23
+ SEQUENCE_START = "SEQUENCE_START",
24
+ SEQUENCE_END = "SEQUENCE_END"
25
+ }
26
+ declare class Sequencer {
27
+ protected readonly sequences: Sequence[];
28
+ protected status: SequencerStatus;
29
+ protected minimumExecutionTime: number;
30
+ currentSequence: Sequence | null;
31
+ startTimestamp: number | null;
32
+ endTimestamp: number | null;
33
+ eventEmitter: EventEmitter<string | symbol, any>;
34
+ constructor(option?: SequencerOption);
35
+ get getCurrentTimeStamp(): number;
36
+ get executionTime(): number | null;
37
+ pushSequence: (sequence: Sequence) => void;
38
+ start: () => Promise<undefined>;
39
+ }
40
+
41
+ export { type Sequence, Sequencer, SequencerEvent, type SequencerOption, SequencerStatus };