@powfix/core-js 0.22.2 → 0.23.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 (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 +16 -1726
  7. package/dist/index.browser.d.ts +57 -484
  8. package/dist/index.browser.js +2 -1644
  9. package/dist/index.cjs +8 -1727
  10. package/dist/index.d.ts +52 -1
  11. package/dist/index.js +1 -1644
  12. package/dist/index.node.cjs +15 -2123
  13. package/dist/index.node.d.ts +77 -164
  14. package/dist/index.node.js +2 -2034
  15. package/dist/node/constants/TransactionManagerLogLevel.cjs +11 -0
  16. package/dist/node/constants/TransactionManagerLogLevel.d.ts +9 -0
  17. package/dist/node/constants/TransactionManagerLogLevel.js +10 -0
  18. package/dist/node/constants/TransactionManagerTimeoutAction.cjs +8 -0
  19. package/dist/node/constants/TransactionManagerTimeoutAction.d.ts +6 -0
  20. package/dist/node/constants/TransactionManagerTimeoutAction.js +7 -0
  21. package/dist/node/constants/index.cjs +19 -0
  22. package/dist/node/constants/index.d.ts +2 -0
  23. package/dist/node/constants/index.js +2 -0
  24. package/dist/node/index.cjs +55 -0
  25. package/dist/node/index.d.ts +25 -0
  26. package/dist/node/index.js +6 -0
  27. package/dist/node/interfaces/db/index.cjs +10 -0
  28. package/dist/node/interfaces/db/index.d.ts +10 -0
  29. package/dist/node/interfaces/db/index.js +1 -0
  30. package/dist/node/interfaces/db/sequelize/Hook.cjs +1 -0
  31. package/dist/node/interfaces/db/sequelize/Hook.d.ts +13 -0
  32. package/dist/node/interfaces/db/sequelize/Hook.js +0 -0
  33. package/dist/node/interfaces/db/sequelize/HookFn.cjs +1 -0
  34. package/dist/node/interfaces/db/sequelize/HookFn.d.ts +7 -0
  35. package/dist/node/interfaces/db/sequelize/HookFn.js +0 -0
  36. package/dist/node/interfaces/db/sequelize/HookType.cjs +1 -0
  37. package/dist/node/interfaces/db/sequelize/HookType.d.ts +6 -0
  38. package/dist/node/interfaces/db/sequelize/HookType.js +0 -0
  39. package/dist/node/interfaces/db/sequelize/ReloadOption.cjs +1 -0
  40. package/dist/node/interfaces/db/sequelize/ReloadOption.d.ts +5 -0
  41. package/dist/node/interfaces/db/sequelize/ReloadOption.js +0 -0
  42. package/dist/node/interfaces/db/sequelize/TransactionOption.cjs +1 -0
  43. package/dist/node/interfaces/db/sequelize/TransactionOption.d.ts +7 -0
  44. package/dist/node/interfaces/db/sequelize/TransactionOption.js +0 -0
  45. package/dist/node/interfaces/db/sequelize/UpsertOptions.cjs +1 -0
  46. package/dist/node/interfaces/db/sequelize/UpsertOptions.d.ts +8 -0
  47. package/dist/node/interfaces/db/sequelize/UpsertOptions.js +0 -0
  48. package/dist/node/interfaces/db/sequelize/index.cjs +55 -0
  49. package/dist/node/interfaces/db/sequelize/index.d.ts +10 -0
  50. package/dist/node/interfaces/db/sequelize/index.js +6 -0
  51. package/dist/node/interfaces/index.cjs +10 -0
  52. package/dist/node/interfaces/index.d.ts +10 -0
  53. package/dist/node/interfaces/index.js +1 -0
  54. package/dist/node/managers/TransactionManager.cjs +463 -0
  55. package/dist/node/managers/TransactionManager.d.ts +31 -0
  56. package/dist/node/managers/TransactionManager.js +457 -0
  57. package/dist/node/managers/TransactionManager.types.cjs +1 -0
  58. package/dist/node/managers/TransactionManager.types.d.ts +12 -0
  59. package/dist/node/managers/TransactionManager.types.js +0 -0
  60. package/dist/node/managers/index.cjs +19 -0
  61. package/dist/node/managers/index.d.ts +6 -0
  62. package/dist/node/managers/index.js +2 -0
  63. package/dist/node/services/index.cjs +10 -0
  64. package/dist/node/services/index.d.ts +5 -0
  65. package/dist/node/services/index.js +1 -0
  66. package/dist/node/services/redis/RedisClient.cjs +250 -0
  67. package/dist/node/services/redis/RedisClient.d.ts +24 -0
  68. package/dist/node/services/redis/RedisClient.js +250 -0
  69. package/dist/node/services/redis/RedisPublisher.cjs +323 -0
  70. package/dist/node/services/redis/RedisPublisher.d.ts +17 -0
  71. package/dist/node/services/redis/RedisPublisher.js +323 -0
  72. package/dist/node/services/redis/RedisSubscriber.cjs +502 -0
  73. package/dist/node/services/redis/RedisSubscriber.d.ts +15 -0
  74. package/dist/node/services/redis/RedisSubscriber.js +502 -0
  75. package/dist/node/services/redis/index.cjs +28 -0
  76. package/dist/node/services/redis/index.d.ts +5 -0
  77. package/dist/node/services/redis/index.js +3 -0
  78. package/dist/node/types/UpsertResult.cjs +1 -0
  79. package/dist/node/types/UpsertResult.d.ts +5 -0
  80. package/dist/node/types/UpsertResult.js +0 -0
  81. package/dist/node/types/index.cjs +19 -0
  82. package/dist/node/types/index.d.ts +9 -0
  83. package/dist/node/types/index.js +2 -0
  84. package/dist/node/types/mariaDb.cjs +1 -0
  85. package/dist/node/types/mariaDb.d.ts +15 -0
  86. package/dist/node/types/mariaDb.js +0 -0
  87. package/dist/node/utils/HookUtils.cjs +87 -0
  88. package/dist/node/utils/HookUtils.d.ts +20 -0
  89. package/dist/node/utils/HookUtils.js +87 -0
  90. package/dist/node/utils/index.cjs +19 -0
  91. package/dist/node/utils/index.d.ts +10 -0
  92. package/dist/node/utils/index.js +2 -0
  93. package/dist/node/utils/sequelize-utils/SequelizeUtils.cjs +165 -0
  94. package/dist/node/utils/sequelize-utils/SequelizeUtils.d.ts +12 -0
  95. package/dist/node/utils/sequelize-utils/SequelizeUtils.js +165 -0
  96. package/dist/node/utils/sequelize-utils/index.cjs +19 -0
  97. package/dist/node/utils/sequelize-utils/index.d.ts +3 -0
  98. package/dist/node/utils/sequelize-utils/index.js +2 -0
  99. package/dist/node/utils/sequelize-utils/types.cjs +1 -0
  100. package/dist/node/utils/sequelize-utils/types.d.ts +19 -0
  101. package/dist/node/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 -7
  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,37 @@
1
+ 'use strict';
2
+ var Coordinate = require('./Coordinate');
3
+ var Point2 = require('./Point2');
4
+ var Point3 = require('./Point3');
5
+ var StorageProvider = require('./StorageProvider');
6
+ Object.keys(Coordinate).forEach(function(k) {
7
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
8
+ enumerable: true,
9
+ get: function get() {
10
+ return Coordinate[k];
11
+ }
12
+ });
13
+ });
14
+ Object.keys(Point2).forEach(function(k) {
15
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
16
+ enumerable: true,
17
+ get: function get() {
18
+ return Point2[k];
19
+ }
20
+ });
21
+ });
22
+ Object.keys(Point3).forEach(function(k) {
23
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
24
+ enumerable: true,
25
+ get: function get() {
26
+ return Point3[k];
27
+ }
28
+ });
29
+ });
30
+ Object.keys(StorageProvider).forEach(function(k) {
31
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
32
+ enumerable: true,
33
+ get: function get() {
34
+ return StorageProvider[k];
35
+ }
36
+ });
37
+ });
@@ -0,0 +1,4 @@
1
+ export { Coordinate, CoordinateM } from './Coordinate.js';
2
+ export { Point2 } from './Point2.js';
3
+ export { Point3 } from './Point3.js';
4
+ export { StorageProvider } from './StorageProvider.js';
@@ -0,0 +1,4 @@
1
+ export * from './Coordinate';
2
+ export * from './Point2';
3
+ export * from './Point3';
4
+ export * from './StorageProvider';
@@ -0,0 +1,498 @@
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 _assert_this_initialized(self) {
11
+ if (self === void 0) {
12
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
13
+ }
14
+ return self;
15
+ }
16
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
17
+ try {
18
+ var info = gen[key](arg);
19
+ var value = info.value;
20
+ } catch (error) {
21
+ reject(error);
22
+ return;
23
+ }
24
+ if (info.done) {
25
+ resolve(value);
26
+ } else {
27
+ Promise.resolve(value).then(_next, _throw);
28
+ }
29
+ }
30
+ function _async_to_generator(fn) {
31
+ return function() {
32
+ var self = this, args = arguments;
33
+ return new Promise(function(resolve, reject) {
34
+ var gen = fn.apply(self, args);
35
+ function _next(value) {
36
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
37
+ }
38
+ function _throw(err) {
39
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
40
+ }
41
+ _next(undefined);
42
+ });
43
+ };
44
+ }
45
+ function _call_super(_this, derived, args) {
46
+ derived = _get_prototype_of(derived);
47
+ return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
48
+ }
49
+ function _class_call_check(instance, Constructor) {
50
+ if (!(instance instanceof Constructor)) {
51
+ throw new TypeError("Cannot call a class as a function");
52
+ }
53
+ }
54
+ function _defineProperties(target, props) {
55
+ for(var i = 0; i < props.length; i++){
56
+ var descriptor = props[i];
57
+ descriptor.enumerable = descriptor.enumerable || false;
58
+ descriptor.configurable = true;
59
+ if ("value" in descriptor) descriptor.writable = true;
60
+ Object.defineProperty(target, descriptor.key, descriptor);
61
+ }
62
+ }
63
+ function _create_class(Constructor, protoProps, staticProps) {
64
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
65
+ if (staticProps) _defineProperties(Constructor, staticProps);
66
+ return Constructor;
67
+ }
68
+ function _get_prototype_of(o) {
69
+ _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
70
+ return o.__proto__ || Object.getPrototypeOf(o);
71
+ };
72
+ return _get_prototype_of(o);
73
+ }
74
+ function _inherits(subClass, superClass) {
75
+ if (typeof superClass !== "function" && superClass !== null) {
76
+ throw new TypeError("Super expression must either be null or a function");
77
+ }
78
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
79
+ constructor: {
80
+ value: subClass,
81
+ writable: true,
82
+ configurable: true
83
+ }
84
+ });
85
+ if (superClass) _set_prototype_of(subClass, superClass);
86
+ }
87
+ function _iterable_to_array(iter) {
88
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
89
+ }
90
+ function _non_iterable_spread() {
91
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
92
+ }
93
+ function _possible_constructor_return(self, call) {
94
+ if (call && (_type_of(call) === "object" || typeof call === "function")) {
95
+ return call;
96
+ }
97
+ return _assert_this_initialized(self);
98
+ }
99
+ function _set_prototype_of(o, p) {
100
+ _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
101
+ o.__proto__ = p;
102
+ return o;
103
+ };
104
+ return _set_prototype_of(o, p);
105
+ }
106
+ function _to_consumable_array(arr) {
107
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
108
+ }
109
+ function _type_of(obj) {
110
+ "@swc/helpers - typeof";
111
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
112
+ }
113
+ function _unsupported_iterable_to_array(o, minLen) {
114
+ if (!o) return;
115
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
116
+ var n = Object.prototype.toString.call(o).slice(8, -1);
117
+ if (n === "Object" && o.constructor) n = o.constructor.name;
118
+ if (n === "Map" || n === "Set") return Array.from(n);
119
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
120
+ }
121
+ function _is_native_reflect_construct() {
122
+ try {
123
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
124
+ } catch (_) {}
125
+ return (_is_native_reflect_construct = function() {
126
+ return !!result;
127
+ })();
128
+ }
129
+ function _ts_generator(thisArg, body) {
130
+ var f, y, t, _ = {
131
+ label: 0,
132
+ sent: function() {
133
+ if (t[0] & 1) throw t[1];
134
+ return t[1];
135
+ },
136
+ trys: [],
137
+ ops: []
138
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
139
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
140
+ return this;
141
+ }), g;
142
+ function verb(n) {
143
+ return function(v) {
144
+ return step([
145
+ n,
146
+ v
147
+ ]);
148
+ };
149
+ }
150
+ function step(op) {
151
+ if (f) throw new TypeError("Generator is already executing.");
152
+ while(g && (g = 0, op[0] && (_ = 0)), _)try {
153
+ 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;
154
+ if (y = 0, t) op = [
155
+ op[0] & 2,
156
+ t.value
157
+ ];
158
+ switch(op[0]){
159
+ case 0:
160
+ case 1:
161
+ t = op;
162
+ break;
163
+ case 4:
164
+ _.label++;
165
+ return {
166
+ value: op[1],
167
+ done: false
168
+ };
169
+ case 5:
170
+ _.label++;
171
+ y = op[1];
172
+ op = [
173
+ 0
174
+ ];
175
+ continue;
176
+ case 7:
177
+ op = _.ops.pop();
178
+ _.trys.pop();
179
+ continue;
180
+ default:
181
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
182
+ _ = 0;
183
+ continue;
184
+ }
185
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
186
+ _.label = op[1];
187
+ break;
188
+ }
189
+ if (op[0] === 6 && _.label < t[1]) {
190
+ _.label = t[1];
191
+ t = op;
192
+ break;
193
+ }
194
+ if (t && _.label < t[2]) {
195
+ _.label = t[2];
196
+ _.ops.push(op);
197
+ break;
198
+ }
199
+ if (t[2]) _.ops.pop();
200
+ _.trys.pop();
201
+ continue;
202
+ }
203
+ op = body.call(thisArg, _);
204
+ } catch (e) {
205
+ op = [
206
+ 6,
207
+ e
208
+ ];
209
+ y = 0;
210
+ } finally{
211
+ f = t = 0;
212
+ }
213
+ if (op[0] & 5) throw op[1];
214
+ return {
215
+ value: op[0] ? op[1] : void 0,
216
+ done: true
217
+ };
218
+ }
219
+ }
220
+ var chunkETV4XYOV_cjs = require('../../chunk-ETV4XYOV.cjs');
221
+ var jwtDecode = require('jwt-decode');
222
+ var moment = require('moment');
223
+ var EventEmitter = require('eventemitter3');
224
+ function _interopDefault(e) {
225
+ return e && e.__esModule ? e : {
226
+ default: e
227
+ };
228
+ }
229
+ var moment__default = /*#__PURE__*/ _interopDefault(moment);
230
+ var EventEmitter__default = /*#__PURE__*/ _interopDefault(EventEmitter);
231
+ var _SessionManager = /*#__PURE__*/ function(_EventEmitter__default_default) {
232
+ _inherits(_SessionManager, _EventEmitter__default_default);
233
+ function _SessionManager(options) {
234
+ _class_call_check(this, _SessionManager);
235
+ var _this;
236
+ _this = _call_super(this, _SessionManager);
237
+ // Service parameters
238
+ chunkETV4XYOV_cjs.__publicField(_this, "api");
239
+ chunkETV4XYOV_cjs.__publicField(_this, "storageProvider");
240
+ _this.api = options.api;
241
+ _this.storageProvider = options.storageProvider;
242
+ console.log("SessionManager initialized", Date.now(), options.api);
243
+ return _this;
244
+ }
245
+ _create_class(_SessionManager, [
246
+ {
247
+ key: "key",
248
+ get: function get() {
249
+ try {
250
+ if (this.storageProvider.key) {
251
+ return this.storageProvider.key();
252
+ }
253
+ } catch (e) {
254
+ console.error(e);
255
+ }
256
+ return _SessionManager.DEFAULT_AUTHORIZATION_STORAGE_KEY;
257
+ }
258
+ },
259
+ {
260
+ key: "hasAuthorization",
261
+ value: function hasAuthorization() {
262
+ return _async_to_generator(function() {
263
+ return _ts_generator(this, function(_state) {
264
+ switch(_state.label){
265
+ case 0:
266
+ return [
267
+ 4,
268
+ this.getAuthorization()
269
+ ];
270
+ case 1:
271
+ return [
272
+ 2,
273
+ !!_state.sent()
274
+ ];
275
+ }
276
+ });
277
+ }).call(this);
278
+ }
279
+ },
280
+ {
281
+ key: "getAuthorization",
282
+ value: function getAuthorization() {
283
+ return _async_to_generator(function() {
284
+ return _ts_generator(this, function(_state) {
285
+ return [
286
+ 2,
287
+ this.storageProvider.get(this.key)
288
+ ];
289
+ });
290
+ }).call(this);
291
+ }
292
+ },
293
+ {
294
+ key: "setAuthorization",
295
+ value: function setAuthorization(authorization) {
296
+ return _async_to_generator(function() {
297
+ var _this, nextAuthorization, decoded, e;
298
+ return _ts_generator(this, function(_state) {
299
+ switch(_state.label){
300
+ case 0:
301
+ _this = this;
302
+ if (!(authorization === null)) return [
303
+ 3,
304
+ 2
305
+ ];
306
+ return [
307
+ 4,
308
+ this.removeAuthorization()
309
+ ];
310
+ case 1:
311
+ _state.sent();
312
+ return [
313
+ 2,
314
+ null
315
+ ];
316
+ case 2:
317
+ return [
318
+ 4,
319
+ function() {
320
+ return _async_to_generator(function() {
321
+ return _ts_generator(this, function(_state) {
322
+ switch(_state.label){
323
+ case 0:
324
+ if (!(authorization === void 0)) return [
325
+ 3,
326
+ 2
327
+ ];
328
+ return [
329
+ 4,
330
+ this.getAuthorization()
331
+ ];
332
+ case 1:
333
+ return [
334
+ 2,
335
+ _state.sent()
336
+ ];
337
+ case 2:
338
+ return [
339
+ 2,
340
+ authorization
341
+ ];
342
+ }
343
+ });
344
+ }).call(_this);
345
+ }()
346
+ ];
347
+ case 3:
348
+ nextAuthorization = _state.sent();
349
+ if (!nextAuthorization) {
350
+ console.log("nextAuthorization is null or undefined");
351
+ return [
352
+ 2,
353
+ null
354
+ ];
355
+ }
356
+ _state.label = 4;
357
+ case 4:
358
+ _state.trys.push([
359
+ 4,
360
+ 6,
361
+ ,
362
+ 7
363
+ ]);
364
+ nextAuthorization = nextAuthorization.replace(/^Bearer\s+/, "");
365
+ decoded = jwtDecode.jwtDecode(nextAuthorization);
366
+ if (!decoded) {
367
+ console.warn("JWT decode failed");
368
+ return [
369
+ 2,
370
+ null
371
+ ];
372
+ }
373
+ console.log("Session:JWT decoded");
374
+ (function() {
375
+ var _console, _console1, _console2;
376
+ console.log(" - User", decoded.uuid);
377
+ (_console = console).log.apply(_console, [
378
+ " - IAT"
379
+ ].concat(_to_consumable_array(function() {
380
+ if (!decoded.iat) {
381
+ return [
382
+ decoded.iat
383
+ ];
384
+ }
385
+ var iat = moment__default.default.unix(decoded.iat);
386
+ if (!iat.isValid()) {
387
+ return [
388
+ decoded.iat
389
+ ];
390
+ }
391
+ return [
392
+ decoded.iat,
393
+ iat.format(),
394
+ iat.diff(Date.now(), "days"),
395
+ "days left"
396
+ ];
397
+ }())));
398
+ (_console1 = console).log.apply(_console1, [
399
+ " - NBF"
400
+ ].concat(_to_consumable_array(function() {
401
+ if (!decoded.nbf) {
402
+ return [
403
+ decoded.nbf
404
+ ];
405
+ }
406
+ var nbf = moment__default.default.unix(decoded.nbf);
407
+ if (!nbf.isValid()) {
408
+ return [
409
+ decoded.nbf
410
+ ];
411
+ }
412
+ return [
413
+ decoded.nbf,
414
+ nbf.format(),
415
+ nbf.diff(Date.now(), "days"),
416
+ "days left"
417
+ ];
418
+ }())));
419
+ (_console2 = console).log.apply(_console2, [
420
+ " - EXP"
421
+ ].concat(_to_consumable_array(function() {
422
+ if (!decoded.exp) {
423
+ return [
424
+ decoded.exp
425
+ ];
426
+ }
427
+ var exp = moment__default.default.unix(decoded.exp);
428
+ if (!exp.isValid()) {
429
+ return [
430
+ decoded.exp
431
+ ];
432
+ }
433
+ return [
434
+ decoded.exp,
435
+ exp.format(),
436
+ exp.diff(Date.now(), "days"),
437
+ "days left"
438
+ ];
439
+ }())));
440
+ })();
441
+ return [
442
+ 4,
443
+ this.storageProvider.set(this.key, nextAuthorization)
444
+ ];
445
+ case 5:
446
+ _state.sent();
447
+ this.api.defaults.headers.common.Authorization = "Bearer ".concat(nextAuthorization);
448
+ this.emit("AUTHORIZATION_CHANGED", nextAuthorization);
449
+ return [
450
+ 2,
451
+ nextAuthorization
452
+ ];
453
+ case 6:
454
+ e = _state.sent();
455
+ console.error(e);
456
+ return [
457
+ 3,
458
+ 7
459
+ ];
460
+ case 7:
461
+ return [
462
+ 2,
463
+ null
464
+ ];
465
+ }
466
+ });
467
+ }).call(this);
468
+ }
469
+ },
470
+ {
471
+ key: "removeAuthorization",
472
+ value: function removeAuthorization() {
473
+ return _async_to_generator(function() {
474
+ return _ts_generator(this, function(_state) {
475
+ switch(_state.label){
476
+ case 0:
477
+ delete this.api.defaults.headers.common.Authorization;
478
+ return [
479
+ 4,
480
+ this.storageProvider.remove(this.key)
481
+ ];
482
+ case 1:
483
+ _state.sent();
484
+ this.emit("AUTHORIZATION_CHANGED", null);
485
+ return [
486
+ 2
487
+ ];
488
+ }
489
+ });
490
+ }).call(this);
491
+ }
492
+ }
493
+ ]);
494
+ return _SessionManager;
495
+ }(EventEmitter__default.default);
496
+ chunkETV4XYOV_cjs.__publicField(_SessionManager, "DEFAULT_AUTHORIZATION_STORAGE_KEY", "AUTHORIZATION");
497
+ var SessionManager = _SessionManager;
498
+ exports.SessionManager = SessionManager;
@@ -0,0 +1,18 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import { StorageProvider } from '../interfaces/StorageProvider.js';
3
+ import EventEmitter from 'eventemitter3';
4
+ import { SessionManagerEvent, SessionManagerOptions } from './SessionManager.type.js';
5
+
6
+ declare class SessionManager extends EventEmitter<SessionManagerEvent> {
7
+ private static readonly DEFAULT_AUTHORIZATION_STORAGE_KEY;
8
+ protected api: AxiosInstance;
9
+ protected storageProvider: StorageProvider;
10
+ constructor(options: SessionManagerOptions);
11
+ private get key();
12
+ hasAuthorization(): Promise<boolean>;
13
+ getAuthorization(): Promise<string | null>;
14
+ setAuthorization(authorization?: string | null): Promise<string | null>;
15
+ removeAuthorization(): Promise<void>;
16
+ }
17
+
18
+ export { SessionManager };