@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.
- 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 +15 -1831
- package/dist/index.browser.d.ts +57 -484
- package/dist/index.browser.js +2 -1773
- package/dist/index.cjs +7 -1832
- package/dist/index.d.ts +52 -1
- package/dist/index.js +1 -1773
- package/dist/index.node.cjs +13 -76631
- package/dist/index.node.d.ts +77 -164
- package/dist/index.node.js +2 -76578
- 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 -10
- 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,237 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
3
|
+
try {
|
|
4
|
+
var info = gen[key](arg);
|
|
5
|
+
var value = info.value;
|
|
6
|
+
} catch (error) {
|
|
7
|
+
reject(error);
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
if (info.done) {
|
|
11
|
+
resolve(value);
|
|
12
|
+
} else {
|
|
13
|
+
Promise.resolve(value).then(_next, _throw);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function _async_to_generator(fn) {
|
|
17
|
+
return function() {
|
|
18
|
+
var self = this, args = arguments;
|
|
19
|
+
return new Promise(function(resolve, reject) {
|
|
20
|
+
var gen = fn.apply(self, args);
|
|
21
|
+
function _next(value) {
|
|
22
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
23
|
+
}
|
|
24
|
+
function _throw(err) {
|
|
25
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
26
|
+
}
|
|
27
|
+
_next(undefined);
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function _class_call_check(instance, Constructor) {
|
|
32
|
+
if (!(instance instanceof Constructor)) {
|
|
33
|
+
throw new TypeError("Cannot call a class as a function");
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function _defineProperties(target, props) {
|
|
37
|
+
for(var i = 0; i < props.length; i++){
|
|
38
|
+
var descriptor = props[i];
|
|
39
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
40
|
+
descriptor.configurable = true;
|
|
41
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
42
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
46
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
47
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
48
|
+
return Constructor;
|
|
49
|
+
}
|
|
50
|
+
function _ts_generator(thisArg, body) {
|
|
51
|
+
var f, y, t, _ = {
|
|
52
|
+
label: 0,
|
|
53
|
+
sent: function() {
|
|
54
|
+
if (t[0] & 1) throw t[1];
|
|
55
|
+
return t[1];
|
|
56
|
+
},
|
|
57
|
+
trys: [],
|
|
58
|
+
ops: []
|
|
59
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
60
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
61
|
+
return this;
|
|
62
|
+
}), g;
|
|
63
|
+
function verb(n) {
|
|
64
|
+
return function(v) {
|
|
65
|
+
return step([
|
|
66
|
+
n,
|
|
67
|
+
v
|
|
68
|
+
]);
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function step(op) {
|
|
72
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
73
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
74
|
+
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;
|
|
75
|
+
if (y = 0, t) op = [
|
|
76
|
+
op[0] & 2,
|
|
77
|
+
t.value
|
|
78
|
+
];
|
|
79
|
+
switch(op[0]){
|
|
80
|
+
case 0:
|
|
81
|
+
case 1:
|
|
82
|
+
t = op;
|
|
83
|
+
break;
|
|
84
|
+
case 4:
|
|
85
|
+
_.label++;
|
|
86
|
+
return {
|
|
87
|
+
value: op[1],
|
|
88
|
+
done: false
|
|
89
|
+
};
|
|
90
|
+
case 5:
|
|
91
|
+
_.label++;
|
|
92
|
+
y = op[1];
|
|
93
|
+
op = [
|
|
94
|
+
0
|
|
95
|
+
];
|
|
96
|
+
continue;
|
|
97
|
+
case 7:
|
|
98
|
+
op = _.ops.pop();
|
|
99
|
+
_.trys.pop();
|
|
100
|
+
continue;
|
|
101
|
+
default:
|
|
102
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
103
|
+
_ = 0;
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
107
|
+
_.label = op[1];
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
111
|
+
_.label = t[1];
|
|
112
|
+
t = op;
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
if (t && _.label < t[2]) {
|
|
116
|
+
_.label = t[2];
|
|
117
|
+
_.ops.push(op);
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
if (t[2]) _.ops.pop();
|
|
121
|
+
_.trys.pop();
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
op = body.call(thisArg, _);
|
|
125
|
+
} catch (e) {
|
|
126
|
+
op = [
|
|
127
|
+
6,
|
|
128
|
+
e
|
|
129
|
+
];
|
|
130
|
+
y = 0;
|
|
131
|
+
} finally{
|
|
132
|
+
f = t = 0;
|
|
133
|
+
}
|
|
134
|
+
if (op[0] & 5) throw op[1];
|
|
135
|
+
return {
|
|
136
|
+
value: op[0] ? op[1] : void 0,
|
|
137
|
+
done: true
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
require('../../../chunk-ETV4XYOV.cjs');
|
|
142
|
+
var TryCatch = /*#__PURE__*/ function() {
|
|
143
|
+
function TryCatch() {
|
|
144
|
+
_class_call_check(this, TryCatch);
|
|
145
|
+
}
|
|
146
|
+
_create_class(TryCatch, null, [
|
|
147
|
+
{
|
|
148
|
+
key: "function",
|
|
149
|
+
value: /**
|
|
150
|
+
* Executes a synchronous function within a try-catch block.
|
|
151
|
+
* @template T The return type of the function.
|
|
152
|
+
* @template E The type of the error that might be thrown (defaults to Error).
|
|
153
|
+
* @param fn The synchronous function to execute.
|
|
154
|
+
*@param disableLogging console.error is default way of logging on error. You can disable it by setting it true
|
|
155
|
+
* @returns A tuple containing the result of the function and an error (null if successful).
|
|
156
|
+
*/ function _function(fn, disableLogging) {
|
|
157
|
+
try {
|
|
158
|
+
return [
|
|
159
|
+
null,
|
|
160
|
+
fn()
|
|
161
|
+
];
|
|
162
|
+
} catch (e) {
|
|
163
|
+
if (!disableLogging) {
|
|
164
|
+
console.error("ERROR in TryCatch: ", e);
|
|
165
|
+
}
|
|
166
|
+
if (e == null) {
|
|
167
|
+
e = new Error("Unknown error");
|
|
168
|
+
}
|
|
169
|
+
return [
|
|
170
|
+
e,
|
|
171
|
+
void 0
|
|
172
|
+
];
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
key: "asyncFunction",
|
|
178
|
+
value: /**
|
|
179
|
+
* Executes an asynchronous function (Promise) within a try-catch block.
|
|
180
|
+
* @template T The resolved value type of the Promise.
|
|
181
|
+
* @template E The type of the error that might be rejected (defaults to Error).
|
|
182
|
+
* @param fn The Promise to await.
|
|
183
|
+
* @param disableLogging console.error is default way of logging on error. You can disable it by setting it true
|
|
184
|
+
* @returns A tuple containing the resolved value of the Promise and an error (null if successful).
|
|
185
|
+
*/ function asyncFunction(fn, disableLogging) {
|
|
186
|
+
return _async_to_generator(function() {
|
|
187
|
+
var data, e;
|
|
188
|
+
return _ts_generator(this, function(_state) {
|
|
189
|
+
switch(_state.label){
|
|
190
|
+
case 0:
|
|
191
|
+
_state.trys.push([
|
|
192
|
+
0,
|
|
193
|
+
2,
|
|
194
|
+
,
|
|
195
|
+
3
|
|
196
|
+
]);
|
|
197
|
+
return [
|
|
198
|
+
4,
|
|
199
|
+
fn
|
|
200
|
+
];
|
|
201
|
+
case 1:
|
|
202
|
+
data = _state.sent();
|
|
203
|
+
return [
|
|
204
|
+
2,
|
|
205
|
+
[
|
|
206
|
+
null,
|
|
207
|
+
data
|
|
208
|
+
]
|
|
209
|
+
];
|
|
210
|
+
case 2:
|
|
211
|
+
e = _state.sent();
|
|
212
|
+
if (!disableLogging) {
|
|
213
|
+
console.error("ERROR in TryCatch: ", e);
|
|
214
|
+
}
|
|
215
|
+
if (e == null) {
|
|
216
|
+
e = new Error("Unknown error");
|
|
217
|
+
}
|
|
218
|
+
return [
|
|
219
|
+
2,
|
|
220
|
+
[
|
|
221
|
+
e,
|
|
222
|
+
void 0
|
|
223
|
+
]
|
|
224
|
+
];
|
|
225
|
+
case 3:
|
|
226
|
+
return [
|
|
227
|
+
2
|
|
228
|
+
];
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
})();
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
]);
|
|
235
|
+
return TryCatch;
|
|
236
|
+
}();
|
|
237
|
+
exports.TryCatch = TryCatch;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provides a utility class for handling synchronous and asynchronous operations with a consistent try-catch pattern.
|
|
3
|
+
* It returns a tuple where the first element is the error (or null on success) and the second element is the result (or undefined on error).
|
|
4
|
+
*/
|
|
5
|
+
declare class TryCatch {
|
|
6
|
+
/**
|
|
7
|
+
* Executes a synchronous function within a try-catch block.
|
|
8
|
+
* @template T The return type of the function.
|
|
9
|
+
* @template E The type of the error that might be thrown (defaults to Error).
|
|
10
|
+
* @param fn The synchronous function to execute.
|
|
11
|
+
*@param disableLogging console.error is default way of logging on error. You can disable it by setting it true
|
|
12
|
+
* @returns A tuple containing the result of the function and an error (null if successful).
|
|
13
|
+
*/
|
|
14
|
+
static function<T, E = Error>(fn: () => T, disableLogging?: boolean): readonly [null, T] | readonly [E, undefined];
|
|
15
|
+
/**
|
|
16
|
+
* Executes an asynchronous function (Promise) within a try-catch block.
|
|
17
|
+
* @template T The resolved value type of the Promise.
|
|
18
|
+
* @template E The type of the error that might be rejected (defaults to Error).
|
|
19
|
+
* @param fn The Promise to await.
|
|
20
|
+
* @param disableLogging console.error is default way of logging on error. You can disable it by setting it true
|
|
21
|
+
* @returns A tuple containing the resolved value of the Promise and an error (null if successful).
|
|
22
|
+
*/
|
|
23
|
+
static asyncFunction<T, E = Error>(fn: Promise<T>, disableLogging?: boolean): Promise<readonly [null, Awaited<T>] | readonly [E, undefined]>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { TryCatch };
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2
|
+
try {
|
|
3
|
+
var info = gen[key](arg);
|
|
4
|
+
var value = info.value;
|
|
5
|
+
} catch (error) {
|
|
6
|
+
reject(error);
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
if (info.done) {
|
|
10
|
+
resolve(value);
|
|
11
|
+
} else {
|
|
12
|
+
Promise.resolve(value).then(_next, _throw);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function _async_to_generator(fn) {
|
|
16
|
+
return function() {
|
|
17
|
+
var self = this, args = arguments;
|
|
18
|
+
return new Promise(function(resolve, reject) {
|
|
19
|
+
var gen = fn.apply(self, args);
|
|
20
|
+
function _next(value) {
|
|
21
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
22
|
+
}
|
|
23
|
+
function _throw(err) {
|
|
24
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
25
|
+
}
|
|
26
|
+
_next(undefined);
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function _class_call_check(instance, Constructor) {
|
|
31
|
+
if (!(instance instanceof Constructor)) {
|
|
32
|
+
throw new TypeError("Cannot call a class as a function");
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function _defineProperties(target, props) {
|
|
36
|
+
for(var i = 0; i < props.length; i++){
|
|
37
|
+
var descriptor = props[i];
|
|
38
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
39
|
+
descriptor.configurable = true;
|
|
40
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
41
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
45
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
46
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
47
|
+
return Constructor;
|
|
48
|
+
}
|
|
49
|
+
function _ts_generator(thisArg, body) {
|
|
50
|
+
var f, y, t, _ = {
|
|
51
|
+
label: 0,
|
|
52
|
+
sent: function() {
|
|
53
|
+
if (t[0] & 1) throw t[1];
|
|
54
|
+
return t[1];
|
|
55
|
+
},
|
|
56
|
+
trys: [],
|
|
57
|
+
ops: []
|
|
58
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
59
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
60
|
+
return this;
|
|
61
|
+
}), g;
|
|
62
|
+
function verb(n) {
|
|
63
|
+
return function(v) {
|
|
64
|
+
return step([
|
|
65
|
+
n,
|
|
66
|
+
v
|
|
67
|
+
]);
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function step(op) {
|
|
71
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
72
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
73
|
+
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;
|
|
74
|
+
if (y = 0, t) op = [
|
|
75
|
+
op[0] & 2,
|
|
76
|
+
t.value
|
|
77
|
+
];
|
|
78
|
+
switch(op[0]){
|
|
79
|
+
case 0:
|
|
80
|
+
case 1:
|
|
81
|
+
t = op;
|
|
82
|
+
break;
|
|
83
|
+
case 4:
|
|
84
|
+
_.label++;
|
|
85
|
+
return {
|
|
86
|
+
value: op[1],
|
|
87
|
+
done: false
|
|
88
|
+
};
|
|
89
|
+
case 5:
|
|
90
|
+
_.label++;
|
|
91
|
+
y = op[1];
|
|
92
|
+
op = [
|
|
93
|
+
0
|
|
94
|
+
];
|
|
95
|
+
continue;
|
|
96
|
+
case 7:
|
|
97
|
+
op = _.ops.pop();
|
|
98
|
+
_.trys.pop();
|
|
99
|
+
continue;
|
|
100
|
+
default:
|
|
101
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
102
|
+
_ = 0;
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
106
|
+
_.label = op[1];
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
110
|
+
_.label = t[1];
|
|
111
|
+
t = op;
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
if (t && _.label < t[2]) {
|
|
115
|
+
_.label = t[2];
|
|
116
|
+
_.ops.push(op);
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
if (t[2]) _.ops.pop();
|
|
120
|
+
_.trys.pop();
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
op = body.call(thisArg, _);
|
|
124
|
+
} catch (e) {
|
|
125
|
+
op = [
|
|
126
|
+
6,
|
|
127
|
+
e
|
|
128
|
+
];
|
|
129
|
+
y = 0;
|
|
130
|
+
} finally{
|
|
131
|
+
f = t = 0;
|
|
132
|
+
}
|
|
133
|
+
if (op[0] & 5) throw op[1];
|
|
134
|
+
return {
|
|
135
|
+
value: op[0] ? op[1] : void 0,
|
|
136
|
+
done: true
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
import '../../../chunk-PKBMQBKP.js';
|
|
141
|
+
var TryCatch = /*#__PURE__*/ function() {
|
|
142
|
+
"use strict";
|
|
143
|
+
function TryCatch() {
|
|
144
|
+
_class_call_check(this, TryCatch);
|
|
145
|
+
}
|
|
146
|
+
_create_class(TryCatch, null, [
|
|
147
|
+
{
|
|
148
|
+
key: "function",
|
|
149
|
+
value: /**
|
|
150
|
+
* Executes a synchronous function within a try-catch block.
|
|
151
|
+
* @template T The return type of the function.
|
|
152
|
+
* @template E The type of the error that might be thrown (defaults to Error).
|
|
153
|
+
* @param fn The synchronous function to execute.
|
|
154
|
+
*@param disableLogging console.error is default way of logging on error. You can disable it by setting it true
|
|
155
|
+
* @returns A tuple containing the result of the function and an error (null if successful).
|
|
156
|
+
*/ function _function(fn, disableLogging) {
|
|
157
|
+
try {
|
|
158
|
+
return [
|
|
159
|
+
null,
|
|
160
|
+
fn()
|
|
161
|
+
];
|
|
162
|
+
} catch (e) {
|
|
163
|
+
if (!disableLogging) {
|
|
164
|
+
console.error("ERROR in TryCatch: ", e);
|
|
165
|
+
}
|
|
166
|
+
if (e == null) {
|
|
167
|
+
e = new Error("Unknown error");
|
|
168
|
+
}
|
|
169
|
+
return [
|
|
170
|
+
e,
|
|
171
|
+
void 0
|
|
172
|
+
];
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
key: "asyncFunction",
|
|
178
|
+
value: /**
|
|
179
|
+
* Executes an asynchronous function (Promise) within a try-catch block.
|
|
180
|
+
* @template T The resolved value type of the Promise.
|
|
181
|
+
* @template E The type of the error that might be rejected (defaults to Error).
|
|
182
|
+
* @param fn The Promise to await.
|
|
183
|
+
* @param disableLogging console.error is default way of logging on error. You can disable it by setting it true
|
|
184
|
+
* @returns A tuple containing the resolved value of the Promise and an error (null if successful).
|
|
185
|
+
*/ function asyncFunction(fn, disableLogging) {
|
|
186
|
+
return _async_to_generator(function() {
|
|
187
|
+
var data, e;
|
|
188
|
+
return _ts_generator(this, function(_state) {
|
|
189
|
+
switch(_state.label){
|
|
190
|
+
case 0:
|
|
191
|
+
_state.trys.push([
|
|
192
|
+
0,
|
|
193
|
+
2,
|
|
194
|
+
,
|
|
195
|
+
3
|
|
196
|
+
]);
|
|
197
|
+
return [
|
|
198
|
+
4,
|
|
199
|
+
fn
|
|
200
|
+
];
|
|
201
|
+
case 1:
|
|
202
|
+
data = _state.sent();
|
|
203
|
+
return [
|
|
204
|
+
2,
|
|
205
|
+
[
|
|
206
|
+
null,
|
|
207
|
+
data
|
|
208
|
+
]
|
|
209
|
+
];
|
|
210
|
+
case 2:
|
|
211
|
+
e = _state.sent();
|
|
212
|
+
if (!disableLogging) {
|
|
213
|
+
console.error("ERROR in TryCatch: ", e);
|
|
214
|
+
}
|
|
215
|
+
if (e == null) {
|
|
216
|
+
e = new Error("Unknown error");
|
|
217
|
+
}
|
|
218
|
+
return [
|
|
219
|
+
2,
|
|
220
|
+
[
|
|
221
|
+
e,
|
|
222
|
+
void 0
|
|
223
|
+
]
|
|
224
|
+
];
|
|
225
|
+
case 3:
|
|
226
|
+
return [
|
|
227
|
+
2
|
|
228
|
+
];
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
})();
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
]);
|
|
235
|
+
return TryCatch;
|
|
236
|
+
}();
|
|
237
|
+
export { TryCatch };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var TryCatch = require('./TryCatch');
|
|
3
|
+
Object.keys(TryCatch).forEach(function(k) {
|
|
4
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
5
|
+
enumerable: true,
|
|
6
|
+
get: function get() {
|
|
7
|
+
return TryCatch[k];
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TryCatch } from './TryCatch.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './TryCatch';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powfix/core-js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"description": "core package",
|
|
5
5
|
"author": "Kwon Kyung-Min <powfix@gmail.com>",
|
|
6
6
|
"private": false,
|
|
@@ -40,14 +40,9 @@
|
|
|
40
40
|
"clean": "rm -rf dist | wc -l",
|
|
41
41
|
"esmfix": "tsc-esm-fix --ext='.mjs'",
|
|
42
42
|
"prebuild": "yarn clean",
|
|
43
|
-
"build
|
|
44
|
-
"build:cjs": "
|
|
45
|
-
"build:
|
|
46
|
-
"build": "yarn build:esm && yarn build:cjs && yarn build:types",
|
|
47
|
-
"deploy": "yarn deploy:patch",
|
|
48
|
-
"deploy:patch": "npm version patch && npm publish",
|
|
49
|
-
"deploy:minor": "npm version minor && npm publish",
|
|
50
|
-
"deploy:major": "npm version major && npm publish"
|
|
43
|
+
"build": "yarn run build:cjs && yarn run build:esm",
|
|
44
|
+
"build:cjs": "tsup --config tsup.cjs.config.ts",
|
|
45
|
+
"build:esm": "tsup --config tsup.esm.config.ts"
|
|
51
46
|
},
|
|
52
47
|
"files": [
|
|
53
48
|
"dist"
|
|
@@ -59,7 +54,8 @@
|
|
|
59
54
|
"uuid": "9.0.1"
|
|
60
55
|
},
|
|
61
56
|
"devDependencies": {
|
|
62
|
-
"@powfix/uuid": "^0.1
|
|
57
|
+
"@powfix/uuid": "^0.2.1",
|
|
58
|
+
"@swc/core": "^1.13.5",
|
|
63
59
|
"@types/base-64": "1.0.2",
|
|
64
60
|
"@types/node": "^24.5.1",
|
|
65
61
|
"@types/uuid": "9.0.7",
|