@powfix/core-js 0.22.2 → 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.
- package/dist/browser/index.cjs +1 -0
- package/dist/browser/index.d.ts +2 -0
- package/dist/browser/index.js +0 -0
- package/dist/chunk-ETV4XYOV.cjs +18 -0
- package/dist/chunk-PKBMQBKP.js +17 -0
- package/dist/index.browser.cjs +16 -1726
- package/dist/index.browser.d.ts +57 -484
- package/dist/index.browser.js +2 -1644
- package/dist/index.cjs +8 -1727
- package/dist/index.d.ts +52 -1
- package/dist/index.js +1 -1644
- package/dist/index.node.cjs +15 -2123
- package/dist/index.node.d.ts +77 -164
- package/dist/index.node.js +2 -2034
- package/dist/nodejs/constants/TransactionManagerLogLevel.cjs +11 -0
- package/dist/nodejs/constants/TransactionManagerLogLevel.d.ts +9 -0
- package/dist/nodejs/constants/TransactionManagerLogLevel.js +10 -0
- package/dist/nodejs/constants/TransactionManagerTimeoutAction.cjs +8 -0
- package/dist/nodejs/constants/TransactionManagerTimeoutAction.d.ts +6 -0
- package/dist/nodejs/constants/TransactionManagerTimeoutAction.js +7 -0
- package/dist/nodejs/constants/index.cjs +19 -0
- package/dist/nodejs/constants/index.d.ts +2 -0
- package/dist/nodejs/constants/index.js +2 -0
- package/dist/nodejs/index.cjs +55 -0
- package/dist/nodejs/index.d.ts +25 -0
- package/dist/nodejs/index.js +6 -0
- package/dist/nodejs/interfaces/db/index.cjs +10 -0
- package/dist/nodejs/interfaces/db/index.d.ts +10 -0
- package/dist/nodejs/interfaces/db/index.js +1 -0
- package/dist/nodejs/interfaces/db/sequelize/Hook.cjs +1 -0
- package/dist/nodejs/interfaces/db/sequelize/Hook.d.ts +13 -0
- package/dist/nodejs/interfaces/db/sequelize/Hook.js +0 -0
- package/dist/nodejs/interfaces/db/sequelize/HookFn.cjs +1 -0
- package/dist/nodejs/interfaces/db/sequelize/HookFn.d.ts +7 -0
- package/dist/nodejs/interfaces/db/sequelize/HookFn.js +0 -0
- package/dist/nodejs/interfaces/db/sequelize/HookType.cjs +1 -0
- package/dist/nodejs/interfaces/db/sequelize/HookType.d.ts +6 -0
- package/dist/nodejs/interfaces/db/sequelize/HookType.js +0 -0
- package/dist/nodejs/interfaces/db/sequelize/ReloadOption.cjs +1 -0
- package/dist/nodejs/interfaces/db/sequelize/ReloadOption.d.ts +5 -0
- package/dist/nodejs/interfaces/db/sequelize/ReloadOption.js +0 -0
- package/dist/nodejs/interfaces/db/sequelize/TransactionOption.cjs +1 -0
- package/dist/nodejs/interfaces/db/sequelize/TransactionOption.d.ts +7 -0
- package/dist/nodejs/interfaces/db/sequelize/TransactionOption.js +0 -0
- package/dist/nodejs/interfaces/db/sequelize/UpsertOptions.cjs +1 -0
- package/dist/nodejs/interfaces/db/sequelize/UpsertOptions.d.ts +8 -0
- package/dist/nodejs/interfaces/db/sequelize/UpsertOptions.js +0 -0
- package/dist/nodejs/interfaces/db/sequelize/index.cjs +55 -0
- package/dist/nodejs/interfaces/db/sequelize/index.d.ts +10 -0
- package/dist/nodejs/interfaces/db/sequelize/index.js +6 -0
- package/dist/nodejs/interfaces/index.cjs +10 -0
- package/dist/nodejs/interfaces/index.d.ts +10 -0
- package/dist/nodejs/interfaces/index.js +1 -0
- package/dist/nodejs/managers/TransactionManager.cjs +463 -0
- package/dist/nodejs/managers/TransactionManager.d.ts +31 -0
- package/dist/nodejs/managers/TransactionManager.js +457 -0
- package/dist/nodejs/managers/TransactionManager.types.cjs +1 -0
- package/dist/nodejs/managers/TransactionManager.types.d.ts +12 -0
- package/dist/nodejs/managers/TransactionManager.types.js +0 -0
- package/dist/nodejs/managers/index.cjs +19 -0
- package/dist/nodejs/managers/index.d.ts +6 -0
- package/dist/nodejs/managers/index.js +2 -0
- package/dist/nodejs/services/index.cjs +10 -0
- package/dist/nodejs/services/index.d.ts +5 -0
- package/dist/nodejs/services/index.js +1 -0
- package/dist/nodejs/services/redis/RedisClient.cjs +250 -0
- package/dist/nodejs/services/redis/RedisClient.d.ts +24 -0
- package/dist/nodejs/services/redis/RedisClient.js +250 -0
- package/dist/nodejs/services/redis/RedisPublisher.cjs +323 -0
- package/dist/nodejs/services/redis/RedisPublisher.d.ts +17 -0
- package/dist/nodejs/services/redis/RedisPublisher.js +323 -0
- package/dist/nodejs/services/redis/RedisSubscriber.cjs +502 -0
- package/dist/nodejs/services/redis/RedisSubscriber.d.ts +15 -0
- package/dist/nodejs/services/redis/RedisSubscriber.js +502 -0
- package/dist/nodejs/services/redis/index.cjs +28 -0
- package/dist/nodejs/services/redis/index.d.ts +5 -0
- package/dist/nodejs/services/redis/index.js +3 -0
- package/dist/nodejs/types/UpsertResult.cjs +1 -0
- package/dist/nodejs/types/UpsertResult.d.ts +5 -0
- package/dist/nodejs/types/UpsertResult.js +0 -0
- package/dist/nodejs/types/index.cjs +19 -0
- package/dist/nodejs/types/index.d.ts +9 -0
- package/dist/nodejs/types/index.js +2 -0
- package/dist/nodejs/types/mariaDb.cjs +1 -0
- package/dist/nodejs/types/mariaDb.d.ts +15 -0
- package/dist/nodejs/types/mariaDb.js +0 -0
- package/dist/nodejs/utils/HookUtils.cjs +87 -0
- package/dist/nodejs/utils/HookUtils.d.ts +20 -0
- package/dist/nodejs/utils/HookUtils.js +87 -0
- package/dist/nodejs/utils/index.cjs +19 -0
- package/dist/nodejs/utils/index.d.ts +10 -0
- package/dist/nodejs/utils/index.js +2 -0
- package/dist/nodejs/utils/sequelize-utils/SequelizeUtils.cjs +165 -0
- package/dist/nodejs/utils/sequelize-utils/SequelizeUtils.d.ts +12 -0
- package/dist/nodejs/utils/sequelize-utils/SequelizeUtils.js +165 -0
- package/dist/nodejs/utils/sequelize-utils/index.cjs +19 -0
- package/dist/nodejs/utils/sequelize-utils/index.d.ts +3 -0
- package/dist/nodejs/utils/sequelize-utils/index.js +2 -0
- package/dist/nodejs/utils/sequelize-utils/types.cjs +1 -0
- package/dist/nodejs/utils/sequelize-utils/types.d.ts +19 -0
- package/dist/nodejs/utils/sequelize-utils/types.js +0 -0
- package/dist/shared/constants/COORDINATE.cjs +15 -0
- package/dist/shared/constants/COORDINATE.d.ts +9 -0
- package/dist/shared/constants/COORDINATE.js +15 -0
- package/dist/shared/constants/CRUD.cjs +26 -0
- package/dist/shared/constants/CRUD.d.ts +11 -0
- package/dist/shared/constants/CRUD.js +26 -0
- package/dist/shared/constants/DATE.cjs +34 -0
- package/dist/shared/constants/DATE.d.ts +15 -0
- package/dist/shared/constants/DATE.js +34 -0
- package/dist/shared/constants/DISTANCE.cjs +22 -0
- package/dist/shared/constants/DISTANCE.d.ts +15 -0
- package/dist/shared/constants/DISTANCE.js +22 -0
- package/dist/shared/constants/DURATION.cjs +25 -0
- package/dist/shared/constants/DURATION.d.ts +18 -0
- package/dist/shared/constants/DURATION.js +25 -0
- package/dist/shared/constants/NOT_NULL.cjs +4 -0
- package/dist/shared/constants/NOT_NULL.d.ts +3 -0
- package/dist/shared/constants/NOT_NULL.js +3 -0
- package/dist/shared/constants/index.cjs +55 -0
- package/dist/shared/constants/index.d.ts +6 -0
- package/dist/shared/constants/index.js +6 -0
- package/dist/shared/exports/Uint8Array.cjs +9 -0
- package/dist/shared/exports/Uint8Array.d.ts +6 -0
- package/dist/shared/exports/Uint8Array.js +8 -0
- package/dist/shared/exports/atob.cjs +3 -0
- package/dist/shared/exports/atob.d.ts +2 -0
- package/dist/shared/exports/atob.js +2 -0
- package/dist/shared/exports/btoa.cjs +3 -0
- package/dist/shared/exports/btoa.d.ts +2 -0
- package/dist/shared/exports/btoa.js +2 -0
- package/dist/shared/index.cjs +64 -0
- package/dist/shared/index.d.ts +57 -0
- package/dist/shared/index.js +7 -0
- package/dist/shared/interfaces/Coordinate.cjs +1 -0
- package/dist/shared/interfaces/Coordinate.d.ts +10 -0
- package/dist/shared/interfaces/Coordinate.js +0 -0
- package/dist/shared/interfaces/Point2.cjs +1 -0
- package/dist/shared/interfaces/Point2.d.ts +6 -0
- package/dist/shared/interfaces/Point2.js +0 -0
- package/dist/shared/interfaces/Point3.cjs +1 -0
- package/dist/shared/interfaces/Point3.d.ts +7 -0
- package/dist/shared/interfaces/Point3.js +0 -0
- package/dist/shared/interfaces/StorageProvider.cjs +1 -0
- package/dist/shared/interfaces/StorageProvider.d.ts +9 -0
- package/dist/shared/interfaces/StorageProvider.js +0 -0
- package/dist/shared/interfaces/index.cjs +37 -0
- package/dist/shared/interfaces/index.d.ts +4 -0
- package/dist/shared/interfaces/index.js +4 -0
- package/dist/shared/managers/SessionManager.cjs +498 -0
- package/dist/shared/managers/SessionManager.d.ts +18 -0
- package/dist/shared/managers/SessionManager.js +491 -0
- package/dist/shared/managers/SessionManager.type.cjs +1 -0
- package/dist/shared/managers/SessionManager.type.d.ts +12 -0
- package/dist/shared/managers/SessionManager.type.js +0 -0
- package/dist/shared/managers/index.cjs +19 -0
- package/dist/shared/managers/index.d.ts +5 -0
- package/dist/shared/managers/index.js +2 -0
- package/dist/shared/scripts/base64Polyfill.cjs +20 -0
- package/dist/shared/scripts/base64Polyfill.d.ts +3 -0
- package/dist/shared/scripts/base64Polyfill.js +13 -0
- package/dist/shared/scripts/index.cjs +10 -0
- package/dist/shared/scripts/index.d.ts +1 -0
- package/dist/shared/scripts/index.js +1 -0
- package/dist/shared/services/index.cjs +10 -0
- package/dist/shared/services/index.d.ts +3 -0
- package/dist/shared/services/index.js +1 -0
- package/dist/shared/services/time/TimeService.cjs +487 -0
- package/dist/shared/services/time/TimeService.d.ts +34 -0
- package/dist/shared/services/time/TimeService.js +481 -0
- package/dist/shared/services/time/TimeService.type.cjs +1 -0
- package/dist/shared/services/time/TimeService.type.d.ts +23 -0
- package/dist/shared/services/time/TimeService.type.js +0 -0
- package/dist/shared/services/time/index.cjs +19 -0
- package/dist/shared/services/time/index.d.ts +3 -0
- package/dist/shared/services/time/index.js +2 -0
- package/dist/shared/types/IntRage.cjs +1 -0
- package/dist/shared/types/IntRage.d.ts +4 -0
- package/dist/shared/types/IntRage.js +0 -0
- package/dist/shared/types/PartialExcept.cjs +1 -0
- package/dist/shared/types/PartialExcept.d.ts +3 -0
- package/dist/shared/types/PartialExcept.js +0 -0
- package/dist/shared/types/index.cjs +19 -0
- package/dist/shared/types/index.d.ts +2 -0
- package/dist/shared/types/index.js +2 -0
- package/dist/shared/utils/ArrayUtils.cjs +104 -0
- package/dist/shared/utils/ArrayUtils.d.ts +14 -0
- package/dist/shared/utils/ArrayUtils.js +104 -0
- package/dist/shared/utils/AxiosUtils.cjs +113 -0
- package/dist/shared/utils/AxiosUtils.d.ts +8 -0
- package/dist/shared/utils/AxiosUtils.js +113 -0
- package/dist/shared/utils/BooleanUtils.cjs +7 -0
- package/dist/shared/utils/BooleanUtils.d.ts +3 -0
- package/dist/shared/utils/BooleanUtils.js +6 -0
- package/dist/shared/utils/Calc.cjs +62 -0
- package/dist/shared/utils/Calc.d.ts +6 -0
- package/dist/shared/utils/Calc.js +62 -0
- package/dist/shared/utils/CoordinateUtils.cjs +85 -0
- package/dist/shared/utils/CoordinateUtils.d.ts +11 -0
- package/dist/shared/utils/CoordinateUtils.js +85 -0
- package/dist/shared/utils/DateUtils.cjs +656 -0
- package/dist/shared/utils/DateUtils.d.ts +27 -0
- package/dist/shared/utils/DateUtils.js +651 -0
- package/dist/shared/utils/Enum.cjs +142 -0
- package/dist/shared/utils/Enum.d.ts +19 -0
- package/dist/shared/utils/Enum.js +142 -0
- package/dist/shared/utils/Enum.types.cjs +1 -0
- package/dist/shared/utils/Enum.types.d.ts +7 -0
- package/dist/shared/utils/Enum.types.js +0 -0
- package/dist/shared/utils/I18nUtils.cjs +48 -0
- package/dist/shared/utils/I18nUtils.d.ts +7 -0
- package/dist/shared/utils/I18nUtils.js +42 -0
- package/dist/shared/utils/JuminNumberUtils.cjs +71 -0
- package/dist/shared/utils/JuminNumberUtils.d.ts +6 -0
- package/dist/shared/utils/JuminNumberUtils.js +71 -0
- package/dist/shared/utils/NumberUtils.cjs +80 -0
- package/dist/shared/utils/NumberUtils.d.ts +6 -0
- package/dist/shared/utils/NumberUtils.js +80 -0
- package/dist/shared/utils/ObjectIdUtils.cjs +65 -0
- package/dist/shared/utils/ObjectIdUtils.d.ts +6 -0
- package/dist/shared/utils/ObjectIdUtils.js +65 -0
- package/dist/shared/utils/Point3Utils.cjs +39 -0
- package/dist/shared/utils/Point3Utils.d.ts +8 -0
- package/dist/shared/utils/Point3Utils.js +39 -0
- package/dist/shared/utils/RandomUtils.cjs +103 -0
- package/dist/shared/utils/RandomUtils.d.ts +10 -0
- package/dist/shared/utils/RandomUtils.js +103 -0
- package/dist/shared/utils/Sequencer.cjs +476 -0
- package/dist/shared/utils/Sequencer.d.ts +41 -0
- package/dist/shared/utils/Sequencer.js +467 -0
- package/dist/shared/utils/StringUtils.cjs +71 -0
- package/dist/shared/utils/StringUtils.d.ts +7 -0
- package/dist/shared/utils/StringUtils.js +71 -0
- package/dist/shared/utils/Uint8ArrayUtils.cjs +48 -0
- package/dist/shared/utils/Uint8ArrayUtils.d.ts +6 -0
- package/dist/shared/utils/Uint8ArrayUtils.js +48 -0
- package/dist/shared/utils/UuidUtils.cjs +95 -0
- package/dist/shared/utils/UuidUtils.d.ts +16 -0
- package/dist/shared/utils/UuidUtils.js +75 -0
- package/dist/shared/utils/Validator.cjs +135 -0
- package/dist/shared/utils/Validator.d.ts +50 -0
- package/dist/shared/utils/Validator.js +135 -0
- package/dist/shared/utils/global/atob.cjs +12 -0
- package/dist/shared/utils/global/atob.d.ts +5 -0
- package/dist/shared/utils/global/atob.js +5 -0
- package/dist/shared/utils/global/base64.cjs +42 -0
- package/dist/shared/utils/global/base64.d.ts +4 -0
- package/dist/shared/utils/global/base64.js +40 -0
- package/dist/shared/utils/global/between.cjs +6 -0
- package/dist/shared/utils/global/between.d.ts +3 -0
- package/dist/shared/utils/global/between.js +5 -0
- package/dist/shared/utils/global/btoa.cjs +12 -0
- package/dist/shared/utils/global/btoa.d.ts +5 -0
- package/dist/shared/utils/global/btoa.js +5 -0
- package/dist/shared/utils/global/castArray.cjs +8 -0
- package/dist/shared/utils/global/castArray.d.ts +3 -0
- package/dist/shared/utils/global/castArray.js +7 -0
- package/dist/shared/utils/global/circularDistance.cjs +13 -0
- package/dist/shared/utils/global/circularDistance.d.ts +3 -0
- package/dist/shared/utils/global/circularDistance.js +12 -0
- package/dist/shared/utils/global/fallbackIfMatch.cjs +13 -0
- package/dist/shared/utils/global/fallbackIfMatch.d.ts +3 -0
- package/dist/shared/utils/global/fallbackIfMatch.js +12 -0
- package/dist/shared/utils/global/fallbackIfNull.cjs +7 -0
- package/dist/shared/utils/global/fallbackIfNull.d.ts +3 -0
- package/dist/shared/utils/global/fallbackIfNull.js +6 -0
- package/dist/shared/utils/global/fallbackIfNullish.cjs +9 -0
- package/dist/shared/utils/global/fallbackIfNullish.d.ts +3 -0
- package/dist/shared/utils/global/fallbackIfNullish.js +8 -0
- package/dist/shared/utils/global/fallbackIfUndefined.cjs +7 -0
- package/dist/shared/utils/global/fallbackIfUndefined.d.ts +3 -0
- package/dist/shared/utils/global/fallbackIfUndefined.js +6 -0
- package/dist/shared/utils/global/firstNonNullish.cjs +40 -0
- package/dist/shared/utils/global/firstNonNullish.d.ts +3 -0
- package/dist/shared/utils/global/firstNonNullish.js +39 -0
- package/dist/shared/utils/global/flat.cjs +102 -0
- package/dist/shared/utils/global/flat.d.ts +16 -0
- package/dist/shared/utils/global/flat.js +100 -0
- package/dist/shared/utils/global/index.cjs +136 -0
- package/dist/shared/utils/global/index.d.ts +16 -0
- package/dist/shared/utils/global/index.js +15 -0
- package/dist/shared/utils/global/processFirstNonNullish.cjs +40 -0
- package/dist/shared/utils/global/processFirstNonNullish.d.ts +3 -0
- package/dist/shared/utils/global/processFirstNonNullish.js +38 -0
- package/dist/shared/utils/global/pureEnum.cjs +69 -0
- package/dist/shared/utils/global/pureEnum.d.ts +18 -0
- package/dist/shared/utils/global/pureEnum.js +66 -0
- package/dist/shared/utils/global/sleep.cjs +8 -0
- package/dist/shared/utils/global/sleep.d.ts +3 -0
- package/dist/shared/utils/global/sleep.js +7 -0
- package/dist/shared/utils/index.cjs +190 -0
- package/dist/shared/utils/index.d.ts +44 -0
- package/dist/shared/utils/index.js +21 -0
- package/dist/shared/utils/try-catch/TryCatch.cjs +237 -0
- package/dist/shared/utils/try-catch/TryCatch.d.ts +26 -0
- package/dist/shared/utils/try-catch/TryCatch.js +237 -0
- package/dist/shared/utils/try-catch/index.cjs +10 -0
- package/dist/shared/utils/try-catch/index.d.ts +1 -0
- package/dist/shared/utils/try-catch/index.js +1 -0
- package/package.json +6 -7
- package/dist/index.browser.d.cts +0 -484
- package/dist/index.d.cts +0 -6
- package/dist/index.node.d.cts +0 -168
|
@@ -0,0 +1,463 @@
|
|
|
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_with_holes(arr) {
|
|
8
|
+
if (Array.isArray(arr)) return 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_limit(arr, i) {
|
|
59
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
60
|
+
if (_i == null) return;
|
|
61
|
+
var _arr = [];
|
|
62
|
+
var _n = true;
|
|
63
|
+
var _d = false;
|
|
64
|
+
var _s, _e;
|
|
65
|
+
try {
|
|
66
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
67
|
+
_arr.push(_s.value);
|
|
68
|
+
if (i && _arr.length === i) break;
|
|
69
|
+
}
|
|
70
|
+
} catch (err) {
|
|
71
|
+
_d = true;
|
|
72
|
+
_e = err;
|
|
73
|
+
} finally{
|
|
74
|
+
try {
|
|
75
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
76
|
+
} finally{
|
|
77
|
+
if (_d) throw _e;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return _arr;
|
|
81
|
+
}
|
|
82
|
+
function _non_iterable_rest() {
|
|
83
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
84
|
+
}
|
|
85
|
+
function _sliced_to_array(arr, i) {
|
|
86
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
87
|
+
}
|
|
88
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
89
|
+
if (!o) return;
|
|
90
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
91
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
92
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
93
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
94
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
95
|
+
}
|
|
96
|
+
function _ts_generator(thisArg, body) {
|
|
97
|
+
var f, y, t, _ = {
|
|
98
|
+
label: 0,
|
|
99
|
+
sent: function() {
|
|
100
|
+
if (t[0] & 1) throw t[1];
|
|
101
|
+
return t[1];
|
|
102
|
+
},
|
|
103
|
+
trys: [],
|
|
104
|
+
ops: []
|
|
105
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
106
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
107
|
+
return this;
|
|
108
|
+
}), g;
|
|
109
|
+
function verb(n) {
|
|
110
|
+
return function(v) {
|
|
111
|
+
return step([
|
|
112
|
+
n,
|
|
113
|
+
v
|
|
114
|
+
]);
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function step(op) {
|
|
118
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
119
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
120
|
+
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;
|
|
121
|
+
if (y = 0, t) op = [
|
|
122
|
+
op[0] & 2,
|
|
123
|
+
t.value
|
|
124
|
+
];
|
|
125
|
+
switch(op[0]){
|
|
126
|
+
case 0:
|
|
127
|
+
case 1:
|
|
128
|
+
t = op;
|
|
129
|
+
break;
|
|
130
|
+
case 4:
|
|
131
|
+
_.label++;
|
|
132
|
+
return {
|
|
133
|
+
value: op[1],
|
|
134
|
+
done: false
|
|
135
|
+
};
|
|
136
|
+
case 5:
|
|
137
|
+
_.label++;
|
|
138
|
+
y = op[1];
|
|
139
|
+
op = [
|
|
140
|
+
0
|
|
141
|
+
];
|
|
142
|
+
continue;
|
|
143
|
+
case 7:
|
|
144
|
+
op = _.ops.pop();
|
|
145
|
+
_.trys.pop();
|
|
146
|
+
continue;
|
|
147
|
+
default:
|
|
148
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
149
|
+
_ = 0;
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
153
|
+
_.label = op[1];
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
157
|
+
_.label = t[1];
|
|
158
|
+
t = op;
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
if (t && _.label < t[2]) {
|
|
162
|
+
_.label = t[2];
|
|
163
|
+
_.ops.push(op);
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
if (t[2]) _.ops.pop();
|
|
167
|
+
_.trys.pop();
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
op = body.call(thisArg, _);
|
|
171
|
+
} catch (e) {
|
|
172
|
+
op = [
|
|
173
|
+
6,
|
|
174
|
+
e
|
|
175
|
+
];
|
|
176
|
+
y = 0;
|
|
177
|
+
} finally{
|
|
178
|
+
f = t = 0;
|
|
179
|
+
}
|
|
180
|
+
if (op[0] & 5) throw op[1];
|
|
181
|
+
return {
|
|
182
|
+
value: op[0] ? op[1] : void 0,
|
|
183
|
+
done: true
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
var chunkETV4XYOV_cjs = require('../../chunk-ETV4XYOV.cjs');
|
|
188
|
+
var EventEmitter = require('eventemitter3');
|
|
189
|
+
var constants = require('../constants');
|
|
190
|
+
function _interopDefault(e) {
|
|
191
|
+
return e && e.__esModule ? e : {
|
|
192
|
+
default: e
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
var EventEmitter__default = /*#__PURE__*/ _interopDefault(EventEmitter);
|
|
196
|
+
var LOG_TAG = "[TransactionManager]";
|
|
197
|
+
var _TransactionManager = /*#__PURE__*/ function() {
|
|
198
|
+
function _TransactionManager() {
|
|
199
|
+
_class_call_check(this, _TransactionManager);
|
|
200
|
+
// Members
|
|
201
|
+
chunkETV4XYOV_cjs.__publicField(this, "logLevel", constants.TransactionManagerLogLevel.VERBOSE);
|
|
202
|
+
chunkETV4XYOV_cjs.__publicField(this, "transactionTimeoutMap", /* @__PURE__ */ new Map());
|
|
203
|
+
// Emitter
|
|
204
|
+
chunkETV4XYOV_cjs.__publicField(this, "emitter", new EventEmitter__default.default());
|
|
205
|
+
if (this.logLevel <= constants.TransactionManagerLogLevel.VERBOSE) {
|
|
206
|
+
console.log(LOG_TAG, "TransactionManager instance initialized");
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
_create_class(_TransactionManager, [
|
|
210
|
+
{
|
|
211
|
+
key: "getTransactionLogArg",
|
|
212
|
+
value: function getTransactionLogArg(transaction) {
|
|
213
|
+
var id = transaction === null || transaction === void 0 ? void 0 : transaction.id;
|
|
214
|
+
return id ? "transaction(".concat(id, ")") : "";
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
key: "setLogLevel",
|
|
219
|
+
value: function setLogLevel(logLevel) {
|
|
220
|
+
this.logLevel = logLevel;
|
|
221
|
+
if (this.logLevel <= constants.TransactionManagerLogLevel.VERBOSE) {
|
|
222
|
+
console.log(LOG_TAG, "log level changed to", logLevel);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
key: "addListener",
|
|
228
|
+
value: function addListener(event, fn) {
|
|
229
|
+
this.emitter.addListener(event, fn);
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
key: "removeListener",
|
|
234
|
+
value: function removeListener(event, fn) {
|
|
235
|
+
this.emitter.removeListener(event, fn);
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
key: "add",
|
|
240
|
+
value: function add(transaction, option) {
|
|
241
|
+
if (this.transactionTimeoutMap.has(transaction)) {
|
|
242
|
+
if (this.logLevel <= constants.TransactionManagerLogLevel.ERROR) {
|
|
243
|
+
console.error(LOG_TAG, "transaction already exists");
|
|
244
|
+
}
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
var _option_timeoutAction;
|
|
248
|
+
var action = (_option_timeoutAction = option === null || option === void 0 ? void 0 : option.timeoutAction) !== null && _option_timeoutAction !== void 0 ? _option_timeoutAction : _TransactionManager.DEFAULT_ACTION;
|
|
249
|
+
var _option_timeout;
|
|
250
|
+
var timeout = (_option_timeout = option === null || option === void 0 ? void 0 : option.timeout) !== null && _option_timeout !== void 0 ? _option_timeout : _TransactionManager.DEFAULT_TIMEOUT;
|
|
251
|
+
var handler = setTimeout(this.timeout.bind(this), timeout, transaction, action);
|
|
252
|
+
this.transactionTimeoutMap.set(transaction, {
|
|
253
|
+
handler: handler,
|
|
254
|
+
action: action
|
|
255
|
+
});
|
|
256
|
+
transaction.afterCommit(this.afterCommit.bind(this));
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
key: "remove",
|
|
261
|
+
value: function remove(transaction) {
|
|
262
|
+
var transactionTimeout = this.transactionTimeoutMap.get(transaction);
|
|
263
|
+
if (transactionTimeout != null) {
|
|
264
|
+
clearTimeout(transactionTimeout.handler);
|
|
265
|
+
this.transactionTimeoutMap.delete(transaction);
|
|
266
|
+
if (this.logLevel <= constants.TransactionManagerLogLevel.VERBOSE) {
|
|
267
|
+
console.log(LOG_TAG, this.getTransactionLogArg(transaction), "removed");
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
key: "flush",
|
|
274
|
+
value: function flush(action) {
|
|
275
|
+
var _this = this;
|
|
276
|
+
return Promise.allSettled(Array.from(this.transactionTimeoutMap.entries()).map(function(param) {
|
|
277
|
+
var _param = _sliced_to_array(param, 2), transaction = _param[0], transactionTimeout = _param[1];
|
|
278
|
+
return _async_to_generator(function() {
|
|
279
|
+
var handled;
|
|
280
|
+
return _ts_generator(this, function(_state) {
|
|
281
|
+
switch(_state.label){
|
|
282
|
+
case 0:
|
|
283
|
+
return [
|
|
284
|
+
4,
|
|
285
|
+
this.execute(transaction, action !== null && action !== void 0 ? action : transactionTimeout.action, "flush")
|
|
286
|
+
];
|
|
287
|
+
case 1:
|
|
288
|
+
handled = _state.sent();
|
|
289
|
+
this.remove(transaction);
|
|
290
|
+
return [
|
|
291
|
+
2,
|
|
292
|
+
{
|
|
293
|
+
handled: handled,
|
|
294
|
+
transaction: transaction
|
|
295
|
+
}
|
|
296
|
+
];
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
}).call(_this);
|
|
300
|
+
}));
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
key: "execute",
|
|
305
|
+
value: function execute(transaction, action, reason) {
|
|
306
|
+
return _async_to_generator(function() {
|
|
307
|
+
var handled, finished, finished2, e;
|
|
308
|
+
return _ts_generator(this, function(_state) {
|
|
309
|
+
switch(_state.label){
|
|
310
|
+
case 0:
|
|
311
|
+
handled = false;
|
|
312
|
+
finished = transaction === null || transaction === void 0 ? void 0 : transaction.finished;
|
|
313
|
+
if (finished != null) {
|
|
314
|
+
if (this.logLevel <= constants.TransactionManagerLogLevel.VERBOSE) {
|
|
315
|
+
console.log(LOG_TAG, this.getTransactionLogArg(transaction), "is already handled(".concat(finished, ") after"), reason);
|
|
316
|
+
}
|
|
317
|
+
this.remove(transaction);
|
|
318
|
+
return [
|
|
319
|
+
2,
|
|
320
|
+
handled
|
|
321
|
+
];
|
|
322
|
+
}
|
|
323
|
+
_state.label = 1;
|
|
324
|
+
case 1:
|
|
325
|
+
_state.trys.push([
|
|
326
|
+
1,
|
|
327
|
+
8,
|
|
328
|
+
9,
|
|
329
|
+
10
|
|
330
|
+
]);
|
|
331
|
+
switch(action){
|
|
332
|
+
case constants.TransactionManagerTimeoutAction.ROLLBACK:
|
|
333
|
+
return [
|
|
334
|
+
3,
|
|
335
|
+
2
|
|
336
|
+
];
|
|
337
|
+
case constants.TransactionManagerTimeoutAction.COMMIT:
|
|
338
|
+
return [
|
|
339
|
+
3,
|
|
340
|
+
4
|
|
341
|
+
];
|
|
342
|
+
}
|
|
343
|
+
return [
|
|
344
|
+
3,
|
|
345
|
+
6
|
|
346
|
+
];
|
|
347
|
+
case 2:
|
|
348
|
+
return [
|
|
349
|
+
4,
|
|
350
|
+
transaction.rollback()
|
|
351
|
+
];
|
|
352
|
+
case 3:
|
|
353
|
+
_state.sent();
|
|
354
|
+
finished2 = "rollback";
|
|
355
|
+
return [
|
|
356
|
+
3,
|
|
357
|
+
7
|
|
358
|
+
];
|
|
359
|
+
case 4:
|
|
360
|
+
return [
|
|
361
|
+
4,
|
|
362
|
+
transaction.commit()
|
|
363
|
+
];
|
|
364
|
+
case 5:
|
|
365
|
+
_state.sent();
|
|
366
|
+
finished2 = "commit";
|
|
367
|
+
return [
|
|
368
|
+
3,
|
|
369
|
+
7
|
|
370
|
+
];
|
|
371
|
+
case 6:
|
|
372
|
+
{
|
|
373
|
+
if (this.logLevel <= constants.TransactionManagerLogLevel.ERROR) {
|
|
374
|
+
console.error(LOG_TAG, "unknown action", action);
|
|
375
|
+
}
|
|
376
|
+
return [
|
|
377
|
+
3,
|
|
378
|
+
7
|
|
379
|
+
];
|
|
380
|
+
}
|
|
381
|
+
_state.label = 7;
|
|
382
|
+
case 7:
|
|
383
|
+
handled = finished2 != null;
|
|
384
|
+
if (finished2 != null) {
|
|
385
|
+
if (this.logLevel <= constants.TransactionManagerLogLevel.ERROR) {
|
|
386
|
+
console.error(LOG_TAG, this.getTransactionLogArg(transaction), "handled(".concat(finished2, ") after"), reason);
|
|
387
|
+
}
|
|
388
|
+
} else {
|
|
389
|
+
if (this.logLevel <= constants.TransactionManagerLogLevel.ERROR) {
|
|
390
|
+
console.error(LOG_TAG, this.getTransactionLogArg(transaction), "not handled \uD83D\uDEAB");
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
return [
|
|
394
|
+
3,
|
|
395
|
+
10
|
|
396
|
+
];
|
|
397
|
+
case 8:
|
|
398
|
+
e = _state.sent();
|
|
399
|
+
console.error(e);
|
|
400
|
+
return [
|
|
401
|
+
3,
|
|
402
|
+
10
|
|
403
|
+
];
|
|
404
|
+
case 9:
|
|
405
|
+
this.remove(transaction);
|
|
406
|
+
return [
|
|
407
|
+
7
|
|
408
|
+
];
|
|
409
|
+
case 10:
|
|
410
|
+
return [
|
|
411
|
+
2,
|
|
412
|
+
handled
|
|
413
|
+
];
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
}).call(this);
|
|
417
|
+
}
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
key: "timeout",
|
|
421
|
+
value: function timeout(transaction, action) {
|
|
422
|
+
return _async_to_generator(function() {
|
|
423
|
+
var handled;
|
|
424
|
+
return _ts_generator(this, function(_state) {
|
|
425
|
+
switch(_state.label){
|
|
426
|
+
case 0:
|
|
427
|
+
return [
|
|
428
|
+
4,
|
|
429
|
+
this.execute(transaction, action, "timeout")
|
|
430
|
+
];
|
|
431
|
+
case 1:
|
|
432
|
+
handled = _state.sent();
|
|
433
|
+
this.emitter.emit("onUnhandledTransaction", transaction, handled);
|
|
434
|
+
return [
|
|
435
|
+
2
|
|
436
|
+
];
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
}).call(this);
|
|
440
|
+
}
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
key: "afterCommit",
|
|
444
|
+
value: function afterCommit(transaction) {
|
|
445
|
+
this.remove(transaction);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
], [
|
|
449
|
+
{
|
|
450
|
+
key: "getInstance",
|
|
451
|
+
value: function getInstance() {
|
|
452
|
+
return this.instance || (this.instance = new _TransactionManager());
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
]);
|
|
456
|
+
return _TransactionManager;
|
|
457
|
+
}();
|
|
458
|
+
chunkETV4XYOV_cjs.__publicField(_TransactionManager, "DEFAULT_TIMEOUT", 60 * 1e3);
|
|
459
|
+
chunkETV4XYOV_cjs.__publicField(_TransactionManager, "DEFAULT_ACTION", constants.TransactionManagerTimeoutAction.ROLLBACK);
|
|
460
|
+
// Static instance
|
|
461
|
+
chunkETV4XYOV_cjs.__publicField(_TransactionManager, "instance");
|
|
462
|
+
var TransactionManager = _TransactionManager;
|
|
463
|
+
exports.TransactionManager = TransactionManager;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Transaction } from 'sequelize';
|
|
2
|
+
import EventEmitter from 'eventemitter3';
|
|
3
|
+
import { TransactionManagerLogLevel } from '../constants/TransactionManagerLogLevel.js';
|
|
4
|
+
import { TransactionManagerTimeoutAction } from '../constants/TransactionManagerTimeoutAction.js';
|
|
5
|
+
import { TransactionManagerEventTypes, TransactionManagerAddOption } from './TransactionManager.types.js';
|
|
6
|
+
|
|
7
|
+
declare class TransactionManager {
|
|
8
|
+
static DEFAULT_TIMEOUT: number;
|
|
9
|
+
static DEFAULT_ACTION: TransactionManagerTimeoutAction;
|
|
10
|
+
private static instance;
|
|
11
|
+
private logLevel;
|
|
12
|
+
private transactionTimeoutMap;
|
|
13
|
+
private readonly emitter;
|
|
14
|
+
constructor();
|
|
15
|
+
static getInstance(): TransactionManager;
|
|
16
|
+
private getTransactionLogArg;
|
|
17
|
+
setLogLevel(logLevel: TransactionManagerLogLevel): void;
|
|
18
|
+
addListener<T extends EventEmitter.EventNames<TransactionManagerEventTypes>>(event: T, fn: EventEmitter.EventListener<TransactionManagerEventTypes, T>): void;
|
|
19
|
+
removeListener<T extends EventEmitter.EventNames<TransactionManagerEventTypes>>(event: T, fn: EventEmitter.EventListener<TransactionManagerEventTypes, T>): void;
|
|
20
|
+
add(transaction: Transaction, option?: TransactionManagerAddOption): void;
|
|
21
|
+
remove(transaction: Transaction): void;
|
|
22
|
+
flush(action?: TransactionManagerTimeoutAction): Promise<PromiseSettledResult<{
|
|
23
|
+
handled: boolean;
|
|
24
|
+
transaction: Transaction;
|
|
25
|
+
}>[]>;
|
|
26
|
+
private execute;
|
|
27
|
+
private timeout;
|
|
28
|
+
private afterCommit;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { TransactionManager };
|