@powfix/core-js 0.14.4 → 0.15.0-beta-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.
- package/dist/client/constants/index.browser.d.ts +6 -0
- package/dist/{src → client}/constants/index.browser.js +6 -6
- package/dist/client/index.browser.d.ts +7 -0
- package/dist/{src → client}/index.browser.js +7 -7
- package/dist/{src → client}/interfaces/Point3.d.ts +1 -1
- package/dist/client/interfaces/index.browser.d.ts +4 -0
- package/dist/{src → client}/interfaces/index.browser.js +4 -4
- package/dist/{src/services/SessionService.d.ts → client/managers/SessionManager.d.ts} +4 -12
- package/dist/{src/services/SessionService.js → client/managers/SessionManager.js} +7 -6
- package/dist/client/managers/SessionManager.type.d.ts +9 -0
- package/dist/client/managers/index.browser.d.ts +2 -0
- package/dist/client/managers/index.browser.js +18 -0
- package/dist/client/scripts/index.browser.d.ts +1 -0
- package/dist/{src → client}/scripts/index.browser.js +1 -1
- package/dist/client/services/index.browser.d.ts +1 -0
- package/dist/{src/scripts/index.js → client/services/index.browser.js} +1 -1
- package/dist/{src → client}/services/time/TimeService.d.ts +1 -1
- package/dist/client/services/time/index.d.ts +2 -0
- package/dist/client/services/time/index.js +18 -0
- package/dist/client/types/index.browser.d.ts +2 -0
- package/dist/{src/services → client/types}/index.browser.js +2 -2
- package/dist/{src → client}/utils/ArrayUtils.js +2 -2
- package/dist/{src → client}/utils/CoordinateUtils.d.ts +1 -1
- package/dist/{src → client}/utils/DateUtils.d.ts +1 -1
- package/dist/{src → client}/utils/DateUtils.js +17 -17
- package/dist/{src → client}/utils/JuminNumberUtils.js +2 -2
- package/dist/{src → client}/utils/ObjectIdUtils.js +3 -3
- package/dist/{src → client}/utils/Point3Utils.d.ts +1 -1
- package/dist/{src → client}/utils/Sequencer.js +2 -2
- package/dist/{src → client}/utils/UuidUtils.js +5 -2
- package/dist/{src → client}/utils/global/fallbackIfNull.js +2 -2
- package/dist/{src → client}/utils/global/fallbackIfUndefined.js +2 -2
- package/dist/client/utils/global/index.d.ts +11 -0
- package/dist/client/utils/global/index.js +27 -0
- package/dist/{src → client}/utils/global/processFirstNonNullish.js +2 -2
- package/dist/client/utils/index.browser.d.ts +17 -0
- package/dist/client/utils/index.browser.js +33 -0
- package/dist/client/utils/try-catch/index.d.ts +1 -0
- package/dist/{src/interfaces/nodejs/db → client/utils/try-catch}/index.js +1 -1
- package/dist/server/constants/COORDINATE.d.ts +7 -0
- package/dist/server/constants/COORDINATE.js +10 -0
- package/dist/server/constants/CRUD.d.ts +9 -0
- package/dist/server/constants/CRUD.js +22 -0
- package/dist/server/constants/DATE.d.ts +13 -0
- package/dist/server/constants/DATE.js +26 -0
- package/dist/server/constants/DISTANCE.d.ts +13 -0
- package/dist/server/constants/DISTANCE.js +18 -0
- package/dist/server/constants/DURATION.d.ts +16 -0
- package/dist/server/constants/DURATION.js +21 -0
- package/dist/server/constants/NOT_NULL.d.ts +1 -0
- package/dist/server/constants/NOT_NULL.js +4 -0
- package/dist/server/constants/index.browser.d.ts +6 -0
- package/dist/server/constants/index.browser.js +22 -0
- package/dist/server/constants/index.d.ts +2 -0
- package/dist/{src/interfaces → server/constants}/index.js +2 -2
- package/dist/server/constants/nodejs/index.d.ts +2 -0
- package/dist/{src → server}/constants/nodejs/index.js +2 -2
- package/dist/server/index.browser.d.ts +7 -0
- package/dist/server/index.browser.js +23 -0
- package/dist/server/index.d.ts +8 -0
- package/dist/{src → server}/index.js +8 -8
- package/dist/server/interfaces/Coordinate.d.ts +8 -0
- package/dist/server/interfaces/Point2.d.ts +4 -0
- package/dist/server/interfaces/Point3.d.ts +4 -0
- package/dist/server/interfaces/StorageProvider.d.ts +7 -0
- package/dist/server/interfaces/index.browser.d.ts +4 -0
- package/dist/server/interfaces/index.browser.js +20 -0
- package/dist/server/interfaces/index.d.ts +2 -0
- package/dist/server/interfaces/index.js +18 -0
- package/dist/server/interfaces/nodejs/db/index.d.ts +1 -0
- package/dist/server/interfaces/nodejs/db/index.js +17 -0
- package/dist/{src → server}/interfaces/nodejs/db/sequelize/Hook.d.ts +2 -2
- package/dist/{src → server}/interfaces/nodejs/db/sequelize/HookFn.d.ts +1 -1
- package/dist/server/interfaces/nodejs/db/sequelize/UpsertOptions.d.ts +4 -0
- package/dist/server/interfaces/nodejs/db/sequelize/UpsertOptions.js +2 -0
- package/dist/server/interfaces/nodejs/db/sequelize/index.d.ts +6 -0
- package/dist/server/interfaces/nodejs/db/sequelize/index.js +22 -0
- package/dist/server/interfaces/nodejs/index.d.ts +1 -0
- package/dist/{src/utils/try-catch → server/interfaces/nodejs}/index.js +1 -1
- package/dist/server/managers/SessionManager.d.ts +15 -0
- package/dist/server/managers/SessionManager.js +134 -0
- package/dist/server/managers/SessionManager.type.d.ts +9 -0
- package/dist/server/managers/SessionManager.type.js +2 -0
- package/dist/{src → server}/managers/TransactionManager.d.ts +2 -2
- package/dist/{src → server}/managers/TransactionManager.js +13 -13
- package/dist/{src → server}/managers/TransactionManager.types.d.ts +1 -1
- package/dist/server/managers/TransactionManager.types.js +2 -0
- package/dist/server/managers/index.browser.d.ts +2 -0
- package/dist/server/managers/index.browser.js +18 -0
- package/dist/server/managers/index.d.ts +2 -0
- package/dist/server/managers/index.js +18 -0
- package/dist/server/scripts/base64Polyfill.d.ts +1 -0
- package/dist/server/scripts/base64Polyfill.js +14 -0
- package/dist/server/scripts/index.browser.d.ts +1 -0
- package/dist/{index.browser.js → server/scripts/index.browser.js} +1 -1
- package/dist/server/scripts/index.d.ts +1 -0
- package/dist/server/scripts/index.js +17 -0
- package/dist/server/services/index.browser.d.ts +1 -0
- package/dist/{index.js → server/services/index.browser.js} +1 -1
- package/dist/server/services/index.d.ts +2 -0
- package/dist/{src/constants → server/services}/index.js +2 -2
- package/dist/{src → server}/services/redis/RedisPublisher.d.ts +1 -1
- package/dist/{src → server}/services/redis/RedisPublisher.js +2 -2
- package/dist/{src → server}/services/redis/RedisSubscriber.d.ts +2 -2
- package/dist/{src → server}/services/redis/RedisSubscriber.js +5 -5
- package/dist/server/services/redis/index.d.ts +3 -0
- package/dist/{src → server}/services/redis/index.js +3 -3
- package/dist/server/services/time/TimeService.d.ts +31 -0
- package/dist/server/services/time/TimeService.js +180 -0
- package/dist/server/services/time/TimeService.type.d.ts +21 -0
- package/dist/server/services/time/TimeService.type.js +2 -0
- package/dist/server/services/time/index.d.ts +2 -0
- package/dist/server/services/time/index.js +18 -0
- package/dist/server/types/IntRage.d.ts +3 -0
- package/dist/server/types/IntRage.js +2 -0
- package/dist/server/types/PartialExcept.d.ts +1 -0
- package/dist/server/types/PartialExcept.js +2 -0
- package/dist/server/types/UpsertResult.js +2 -0
- package/dist/server/types/index.browser.d.ts +2 -0
- package/dist/{src → server}/types/index.browser.js +2 -2
- package/dist/server/types/index.d.ts +2 -0
- package/dist/server/types/index.js +18 -0
- package/dist/server/utils/ArrayUtils.d.ts +12 -0
- package/dist/server/utils/ArrayUtils.js +30 -0
- package/dist/server/utils/AxiosUtils.d.ts +5 -0
- package/dist/server/utils/AxiosUtils.js +53 -0
- package/dist/server/utils/BooleanUtils.d.ts +1 -0
- package/dist/server/utils/BooleanUtils.js +8 -0
- package/dist/server/utils/Calc.d.ts +4 -0
- package/dist/server/utils/Calc.js +27 -0
- package/dist/server/utils/CoordinateUtils.d.ts +8 -0
- package/dist/server/utils/CoordinateUtils.js +42 -0
- package/dist/server/utils/DateUtils.d.ts +24 -0
- package/dist/server/utils/DateUtils.js +310 -0
- package/dist/server/utils/JuminNumberUtils.d.ts +4 -0
- package/dist/server/utils/JuminNumberUtils.js +50 -0
- package/dist/server/utils/NumberUtils.d.ts +4 -0
- package/dist/server/utils/NumberUtils.js +25 -0
- package/dist/server/utils/ObjectIdUtils.d.ts +4 -0
- package/dist/server/utils/ObjectIdUtils.js +24 -0
- package/dist/server/utils/Point3Utils.d.ts +4 -0
- package/dist/server/utils/Point3Utils.js +12 -0
- package/dist/server/utils/RandomUtils.d.ts +8 -0
- package/dist/server/utils/RandomUtils.js +64 -0
- package/dist/server/utils/Sequencer.d.ts +38 -0
- package/dist/server/utils/Sequencer.js +148 -0
- package/dist/server/utils/StringUtils.d.ts +5 -0
- package/dist/server/utils/StringUtils.js +37 -0
- package/dist/server/utils/UuidUtils.d.ts +14 -0
- package/dist/server/utils/UuidUtils.js +49 -0
- package/dist/server/utils/Validator.d.ts +48 -0
- package/dist/server/utils/Validator.js +118 -0
- package/dist/server/utils/global/between.d.ts +1 -0
- package/dist/server/utils/global/between.js +7 -0
- package/dist/server/utils/global/castArray.d.ts +1 -0
- package/dist/server/utils/global/castArray.js +6 -0
- package/dist/server/utils/global/circularDistance.d.ts +1 -0
- package/dist/server/utils/global/circularDistance.js +14 -0
- package/dist/server/utils/global/fallbackIfEqual.d.ts +1 -0
- package/dist/server/utils/global/fallbackIfEqual.js +9 -0
- package/dist/server/utils/global/fallbackIfNull.d.ts +1 -0
- package/dist/server/utils/global/fallbackIfNull.js +7 -0
- package/dist/server/utils/global/fallbackIfUndefined.d.ts +1 -0
- package/dist/server/utils/global/fallbackIfUndefined.js +7 -0
- package/dist/server/utils/global/firstNonNullish.d.ts +1 -0
- package/dist/server/utils/global/firstNonNullish.js +13 -0
- package/dist/server/utils/global/flat.d.ts +14 -0
- package/dist/server/utils/global/flat.js +117 -0
- package/dist/server/utils/global/index.d.ts +11 -0
- package/dist/server/utils/global/index.js +27 -0
- package/dist/server/utils/global/processFirstNonNullish.d.ts +1 -0
- package/dist/server/utils/global/processFirstNonNullish.js +11 -0
- package/dist/server/utils/global/pureEnum.d.ts +8 -0
- package/dist/server/utils/global/pureEnum.js +14 -0
- package/dist/server/utils/global/sleep.d.ts +1 -0
- package/dist/server/utils/global/sleep.js +5 -0
- package/dist/server/utils/index.browser.d.ts +17 -0
- package/dist/server/utils/index.browser.js +33 -0
- package/dist/server/utils/index.d.ts +2 -0
- package/dist/server/utils/index.js +18 -0
- package/dist/{src → server}/utils/nodejs/HookUtils.d.ts +1 -1
- package/dist/server/utils/nodejs/index.d.ts +2 -0
- package/dist/{src → server}/utils/nodejs/index.js +3 -3
- package/dist/{src → server}/utils/nodejs/sequelize-utils/SequelizeUtils.d.ts +1 -1
- package/dist/{src → server}/utils/nodejs/sequelize-utils/SequelizeUtils.js +8 -8
- package/dist/server/utils/nodejs/sequelize-utils/index.d.ts +1 -0
- package/dist/{src → server}/utils/nodejs/sequelize-utils/index.js +2 -2
- package/dist/server/utils/nodejs/sequelize-utils/types.js +2 -0
- package/dist/server/utils/try-catch/TryCatch.d.ts +24 -0
- package/dist/server/utils/try-catch/TryCatch.js +78 -0
- package/dist/server/utils/try-catch/index.d.ts +1 -0
- package/dist/{src/interfaces/nodejs → server/utils/try-catch}/index.js +1 -1
- package/package.json +56 -47
- package/dist/index.browser.d.ts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/src/constants/index.browser.d.ts +0 -6
- package/dist/src/constants/index.d.ts +0 -2
- package/dist/src/constants/nodejs/index.d.ts +0 -2
- package/dist/src/index.browser.d.ts +0 -7
- package/dist/src/index.d.ts +0 -8
- package/dist/src/interfaces/index.browser.d.ts +0 -4
- package/dist/src/interfaces/index.d.ts +0 -2
- package/dist/src/interfaces/nodejs/db/index.d.ts +0 -1
- package/dist/src/interfaces/nodejs/db/sequelize/UpsertOptions.d.ts +0 -4
- package/dist/src/interfaces/nodejs/db/sequelize/index.d.ts +0 -6
- package/dist/src/interfaces/nodejs/db/sequelize/index.js +0 -22
- package/dist/src/interfaces/nodejs/index.d.ts +0 -1
- package/dist/src/managers/index.browser.d.ts +0 -1
- package/dist/src/managers/index.d.ts +0 -2
- package/dist/src/managers/index.js +0 -18
- package/dist/src/scripts/index.browser.d.ts +0 -1
- package/dist/src/scripts/index.d.ts +0 -1
- package/dist/src/services/index.browser.d.ts +0 -2
- package/dist/src/services/index.d.ts +0 -2
- package/dist/src/services/index.js +0 -18
- package/dist/src/services/redis/index.d.ts +0 -3
- package/dist/src/services/time/index.d.ts +0 -2
- package/dist/src/services/time/index.js +0 -18
- package/dist/src/types/index.browser.d.ts +0 -2
- package/dist/src/types/index.d.ts +0 -2
- package/dist/src/types/index.js +0 -18
- package/dist/src/utils/global/index.d.ts +0 -11
- package/dist/src/utils/global/index.js +0 -27
- package/dist/src/utils/index.browser.d.ts +0 -17
- package/dist/src/utils/index.browser.js +0 -33
- package/dist/src/utils/index.d.ts +0 -2
- package/dist/src/utils/index.js +0 -18
- package/dist/src/utils/nodejs/index.d.ts +0 -2
- package/dist/src/utils/nodejs/sequelize-utils/index.d.ts +0 -1
- package/dist/src/utils/try-catch/index.d.ts +0 -1
- /package/dist/{src → client}/constants/COORDINATE.d.ts +0 -0
- /package/dist/{src → client}/constants/COORDINATE.js +0 -0
- /package/dist/{src → client}/constants/CRUD.d.ts +0 -0
- /package/dist/{src → client}/constants/CRUD.js +0 -0
- /package/dist/{src → client}/constants/DATE.d.ts +0 -0
- /package/dist/{src → client}/constants/DATE.js +0 -0
- /package/dist/{src → client}/constants/DISTANCE.d.ts +0 -0
- /package/dist/{src → client}/constants/DISTANCE.js +0 -0
- /package/dist/{src → client}/constants/DURATION.d.ts +0 -0
- /package/dist/{src → client}/constants/DURATION.js +0 -0
- /package/dist/{src → client}/constants/NOT_NULL.d.ts +0 -0
- /package/dist/{src → client}/constants/NOT_NULL.js +0 -0
- /package/dist/{src → client}/interfaces/Coordinate.d.ts +0 -0
- /package/dist/{src → client}/interfaces/Coordinate.js +0 -0
- /package/dist/{src → client}/interfaces/Point2.d.ts +0 -0
- /package/dist/{src → client}/interfaces/Point2.js +0 -0
- /package/dist/{src → client}/interfaces/Point3.js +0 -0
- /package/dist/{src → client}/interfaces/StorageProvider.d.ts +0 -0
- /package/dist/{src → client}/interfaces/StorageProvider.js +0 -0
- /package/dist/{src/interfaces/nodejs/db/sequelize/Hook.js → client/managers/SessionManager.type.js} +0 -0
- /package/dist/{src → client}/scripts/base64Polyfill.d.ts +0 -0
- /package/dist/{src → client}/scripts/base64Polyfill.js +0 -0
- /package/dist/{src → client}/services/time/TimeService.js +0 -0
- /package/dist/{src → client}/services/time/TimeService.type.d.ts +0 -0
- /package/dist/{src → client}/services/time/TimeService.type.js +0 -0
- /package/dist/{src → client}/types/IntRage.d.ts +0 -0
- /package/dist/{src → client}/types/IntRage.js +0 -0
- /package/dist/{src → client}/types/PartialExcept.d.ts +0 -0
- /package/dist/{src → client}/types/PartialExcept.js +0 -0
- /package/dist/{src → client}/utils/ArrayUtils.d.ts +0 -0
- /package/dist/{src → client}/utils/AxiosUtils.d.ts +0 -0
- /package/dist/{src → client}/utils/AxiosUtils.js +0 -0
- /package/dist/{src → client}/utils/BooleanUtils.d.ts +0 -0
- /package/dist/{src → client}/utils/BooleanUtils.js +0 -0
- /package/dist/{src → client}/utils/Calc.d.ts +0 -0
- /package/dist/{src → client}/utils/Calc.js +0 -0
- /package/dist/{src → client}/utils/CoordinateUtils.js +0 -0
- /package/dist/{src → client}/utils/JuminNumberUtils.d.ts +0 -0
- /package/dist/{src → client}/utils/NumberUtils.d.ts +0 -0
- /package/dist/{src → client}/utils/NumberUtils.js +0 -0
- /package/dist/{src → client}/utils/ObjectIdUtils.d.ts +0 -0
- /package/dist/{src → client}/utils/Point3Utils.js +0 -0
- /package/dist/{src → client}/utils/RandomUtils.d.ts +0 -0
- /package/dist/{src → client}/utils/RandomUtils.js +0 -0
- /package/dist/{src → client}/utils/Sequencer.d.ts +0 -0
- /package/dist/{src → client}/utils/StringUtils.d.ts +0 -0
- /package/dist/{src → client}/utils/StringUtils.js +0 -0
- /package/dist/{src → client}/utils/UuidUtils.d.ts +0 -0
- /package/dist/{src → client}/utils/Validator.d.ts +0 -0
- /package/dist/{src → client}/utils/Validator.js +0 -0
- /package/dist/{src → client}/utils/global/between.d.ts +0 -0
- /package/dist/{src → client}/utils/global/between.js +0 -0
- /package/dist/{src → client}/utils/global/castArray.d.ts +0 -0
- /package/dist/{src → client}/utils/global/castArray.js +0 -0
- /package/dist/{src → client}/utils/global/circularDistance.d.ts +0 -0
- /package/dist/{src → client}/utils/global/circularDistance.js +0 -0
- /package/dist/{src → client}/utils/global/fallbackIfEqual.d.ts +0 -0
- /package/dist/{src → client}/utils/global/fallbackIfEqual.js +0 -0
- /package/dist/{src → client}/utils/global/fallbackIfNull.d.ts +0 -0
- /package/dist/{src → client}/utils/global/fallbackIfUndefined.d.ts +0 -0
- /package/dist/{src → client}/utils/global/firstNonNullish.d.ts +0 -0
- /package/dist/{src → client}/utils/global/firstNonNullish.js +0 -0
- /package/dist/{src → client}/utils/global/flat.d.ts +0 -0
- /package/dist/{src → client}/utils/global/flat.js +0 -0
- /package/dist/{src → client}/utils/global/processFirstNonNullish.d.ts +0 -0
- /package/dist/{src → client}/utils/global/pureEnum.d.ts +0 -0
- /package/dist/{src → client}/utils/global/pureEnum.js +0 -0
- /package/dist/{src → client}/utils/global/sleep.d.ts +0 -0
- /package/dist/{src → client}/utils/global/sleep.js +0 -0
- /package/dist/{src → client}/utils/try-catch/TryCatch.d.ts +0 -0
- /package/dist/{src → client}/utils/try-catch/TryCatch.js +0 -0
- /package/dist/{src → server}/constants/nodejs/TransactionManagerLogLevel.d.ts +0 -0
- /package/dist/{src → server}/constants/nodejs/TransactionManagerLogLevel.js +0 -0
- /package/dist/{src → server}/constants/nodejs/TransactionManagerTimeoutAction.d.ts +0 -0
- /package/dist/{src → server}/constants/nodejs/TransactionManagerTimeoutAction.js +0 -0
- /package/dist/{src/interfaces/nodejs/db/sequelize/HookFn.js → server/interfaces/Coordinate.js} +0 -0
- /package/dist/{src/interfaces/nodejs/db/sequelize/HookType.js → server/interfaces/Point2.js} +0 -0
- /package/dist/{src/interfaces/nodejs/db/sequelize/ReloadOption.js → server/interfaces/Point3.js} +0 -0
- /package/dist/{src/interfaces/nodejs/db/sequelize/TransactionOption.js → server/interfaces/StorageProvider.js} +0 -0
- /package/dist/{src/interfaces/nodejs/db/sequelize/UpsertOptions.js → server/interfaces/nodejs/db/sequelize/Hook.js} +0 -0
- /package/dist/{src/managers/TransactionManager.types.js → server/interfaces/nodejs/db/sequelize/HookFn.js} +0 -0
- /package/dist/{src → server}/interfaces/nodejs/db/sequelize/HookType.d.ts +0 -0
- /package/dist/{src/managers/index.browser.js → server/interfaces/nodejs/db/sequelize/HookType.js} +0 -0
- /package/dist/{src → server}/interfaces/nodejs/db/sequelize/ReloadOption.d.ts +0 -0
- /package/dist/{src/types/UpsertResult.js → server/interfaces/nodejs/db/sequelize/ReloadOption.js} +0 -0
- /package/dist/{src → server}/interfaces/nodejs/db/sequelize/TransactionOption.d.ts +0 -0
- /package/dist/{src/utils/nodejs/sequelize-utils/types.js → server/interfaces/nodejs/db/sequelize/TransactionOption.js} +0 -0
- /package/dist/{src → server}/services/redis/RedisClient.d.ts +0 -0
- /package/dist/{src → server}/services/redis/RedisClient.js +0 -0
- /package/dist/{src → server}/types/UpsertResult.d.ts +0 -0
- /package/dist/{src → server}/utils/nodejs/HookUtils.js +0 -0
- /package/dist/{src → server}/utils/nodejs/sequelize-utils/types.d.ts +0 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// flat.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.flatten = flatten;
|
|
5
|
+
exports.unflatten = unflatten;
|
|
6
|
+
function isBuffer(obj) {
|
|
7
|
+
return !!(obj &&
|
|
8
|
+
obj.constructor &&
|
|
9
|
+
typeof obj.constructor.isBuffer === 'function' &&
|
|
10
|
+
obj.constructor.isBuffer(obj));
|
|
11
|
+
}
|
|
12
|
+
function keyIdentity(key) {
|
|
13
|
+
return key;
|
|
14
|
+
}
|
|
15
|
+
function flatten(target, opts = {}) {
|
|
16
|
+
const delimiter = opts.delimiter || '.';
|
|
17
|
+
const maxDepth = opts.maxDepth;
|
|
18
|
+
const transformKey = opts.transformKey || keyIdentity;
|
|
19
|
+
const output = {};
|
|
20
|
+
function step(object, prev, currentDepth = 1) {
|
|
21
|
+
Object.keys(object).forEach((key) => {
|
|
22
|
+
const value = object[key];
|
|
23
|
+
const isarray = opts.safe && Array.isArray(value);
|
|
24
|
+
const type = Object.prototype.toString.call(value);
|
|
25
|
+
const isbuffer = isBuffer(value);
|
|
26
|
+
const isobject = type === '[object Object]' || type === '[object Array]';
|
|
27
|
+
const newKey = prev
|
|
28
|
+
? `${prev}${delimiter}${transformKey(key)}`
|
|
29
|
+
: transformKey(key);
|
|
30
|
+
if (!isarray &&
|
|
31
|
+
!isbuffer &&
|
|
32
|
+
isobject &&
|
|
33
|
+
Object.keys(value).length &&
|
|
34
|
+
(!maxDepth || currentDepth < maxDepth)) {
|
|
35
|
+
return step(value, newKey, currentDepth + 1);
|
|
36
|
+
}
|
|
37
|
+
output[newKey] = value;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
step(target);
|
|
41
|
+
return output;
|
|
42
|
+
}
|
|
43
|
+
function unflatten(target, opts = {}) {
|
|
44
|
+
const delimiter = opts.delimiter || '.';
|
|
45
|
+
const overwrite = opts.overwrite || false;
|
|
46
|
+
const transformKey = opts.transformKey || keyIdentity;
|
|
47
|
+
const result = {};
|
|
48
|
+
if (isBuffer(target) ||
|
|
49
|
+
Object.prototype.toString.call(target) !== '[object Object]') {
|
|
50
|
+
return target;
|
|
51
|
+
}
|
|
52
|
+
function getkey(key) {
|
|
53
|
+
const parsedKey = Number(key);
|
|
54
|
+
return isNaN(parsedKey) || key.indexOf('.') !== -1 || opts.object
|
|
55
|
+
? key
|
|
56
|
+
: parsedKey;
|
|
57
|
+
}
|
|
58
|
+
function addKeys(keyPrefix, recipient, target) {
|
|
59
|
+
return Object.keys(target).reduce((res, key) => {
|
|
60
|
+
res[`${keyPrefix}${delimiter}${key}`] = target[key];
|
|
61
|
+
return res;
|
|
62
|
+
}, recipient);
|
|
63
|
+
}
|
|
64
|
+
function isEmpty(val) {
|
|
65
|
+
const type = Object.prototype.toString.call(val);
|
|
66
|
+
const isArray = type === '[object Array]';
|
|
67
|
+
const isObject = type === '[object Object]';
|
|
68
|
+
if (!val) {
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
else if (isArray) {
|
|
72
|
+
return !val.length;
|
|
73
|
+
}
|
|
74
|
+
else if (isObject) {
|
|
75
|
+
return !Object.keys(val).length;
|
|
76
|
+
}
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
const target2 = Object.keys(target).reduce((res, key) => {
|
|
80
|
+
const value = target[key];
|
|
81
|
+
const type = Object.prototype.toString.call(value);
|
|
82
|
+
const isObject = type === '[object Object]' || type === '[object Array]';
|
|
83
|
+
if (!isObject || isEmpty(value)) {
|
|
84
|
+
res[key] = value;
|
|
85
|
+
return res;
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
return addKeys(key, res, flatten(value, opts));
|
|
89
|
+
}
|
|
90
|
+
}, {});
|
|
91
|
+
Object.keys(target2).forEach((key) => {
|
|
92
|
+
const split = key.split(delimiter).map(transformKey);
|
|
93
|
+
let key1 = getkey(split.shift());
|
|
94
|
+
let key2 = getkey(split[0]);
|
|
95
|
+
let recipient = result;
|
|
96
|
+
while (key2 !== undefined) {
|
|
97
|
+
if (key1 === '__proto__')
|
|
98
|
+
return;
|
|
99
|
+
const type = Object.prototype.toString.call(recipient[key1]);
|
|
100
|
+
const isobject = type === '[object Object]' || type === '[object Array]';
|
|
101
|
+
if (!overwrite && !isobject && typeof recipient[key1] !== 'undefined') {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
if ((overwrite && !isobject) || (!overwrite && recipient[key1] == null)) {
|
|
105
|
+
recipient[key1] =
|
|
106
|
+
typeof key2 === 'number' && !opts.object ? [] : {};
|
|
107
|
+
}
|
|
108
|
+
recipient = recipient[key1];
|
|
109
|
+
if (split.length > 0) {
|
|
110
|
+
key1 = getkey(split.shift());
|
|
111
|
+
key2 = getkey(split[0]);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
recipient[key1] = unflatten(target2[key], opts);
|
|
115
|
+
});
|
|
116
|
+
return result;
|
|
117
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './between.js';
|
|
2
|
+
export * from './castArray.js';
|
|
3
|
+
export * from './circularDistance.js';
|
|
4
|
+
export * from './sleep.js';
|
|
5
|
+
export * from './fallbackIfEqual.js';
|
|
6
|
+
export * from './fallbackIfNull.js';
|
|
7
|
+
export * from './fallbackIfUndefined.js';
|
|
8
|
+
export * from './firstNonNullish.js';
|
|
9
|
+
export * from './flat.js';
|
|
10
|
+
export * from './processFirstNonNullish.js';
|
|
11
|
+
export * from './pureEnum.js';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./between.js"), exports);
|
|
18
|
+
__exportStar(require("./castArray.js"), exports);
|
|
19
|
+
__exportStar(require("./circularDistance.js"), exports);
|
|
20
|
+
__exportStar(require("./sleep.js"), exports);
|
|
21
|
+
__exportStar(require("./fallbackIfEqual.js"), exports);
|
|
22
|
+
__exportStar(require("./fallbackIfNull.js"), exports);
|
|
23
|
+
__exportStar(require("./fallbackIfUndefined.js"), exports);
|
|
24
|
+
__exportStar(require("./firstNonNullish.js"), exports);
|
|
25
|
+
__exportStar(require("./flat.js"), exports);
|
|
26
|
+
__exportStar(require("./processFirstNonNullish.js"), exports);
|
|
27
|
+
__exportStar(require("./pureEnum.js"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function processFirstNonNullish<T, R>(processor: (nonNullish: NonNullable<T>) => R, ...args: T[]): R | undefined;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.processFirstNonNullish = processFirstNonNullish;
|
|
4
|
+
const firstNonNullish_js_1 = require("./firstNonNullish.js");
|
|
5
|
+
function processFirstNonNullish(processor, ...args) {
|
|
6
|
+
const fallback = (0, firstNonNullish_js_1.firstNonNullish)(...args);
|
|
7
|
+
if (fallback == null) {
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|
|
10
|
+
return processor(fallback);
|
|
11
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type NonFunction<T, Type extends "keys" | "values"> = {
|
|
2
|
+
[K in keyof T]: T[K] extends Function ? never : Type extends "keys" ? K : T[K];
|
|
3
|
+
}[keyof T] extends infer R ? (R extends never ? never : R) : never;
|
|
4
|
+
type PureEnumReturnType<E extends object> = [NonFunction<E, "keys">, NonFunction<E, "values">][];
|
|
5
|
+
export declare function pureEnum<E extends object>(e: E): PureEnumReturnType<E>;
|
|
6
|
+
export declare function pureEnumKeys<E extends object>(e: E): NonFunction<E, "keys">[];
|
|
7
|
+
export declare function pureEnumValues<E extends object>(e: E): NonFunction<E, "values">[];
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pureEnum = pureEnum;
|
|
4
|
+
exports.pureEnumKeys = pureEnumKeys;
|
|
5
|
+
exports.pureEnumValues = pureEnumValues;
|
|
6
|
+
function pureEnum(e) {
|
|
7
|
+
return Object.entries(e).filter(([key, value]) => !/^-?\d+$/g.test(key) && typeof value !== 'function');
|
|
8
|
+
}
|
|
9
|
+
function pureEnumKeys(e) {
|
|
10
|
+
return pureEnum(e).map(([key]) => key);
|
|
11
|
+
}
|
|
12
|
+
function pureEnumValues(e) {
|
|
13
|
+
return pureEnum(e).map(([, value]) => value);
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const sleep: (ms: number) => Promise<unknown>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from './global/index.js';
|
|
2
|
+
export * from './ArrayUtils.js';
|
|
3
|
+
export * from './AxiosUtils.js';
|
|
4
|
+
export * from './StringUtils.js';
|
|
5
|
+
export * from './UuidUtils.js';
|
|
6
|
+
export * from './BooleanUtils.js';
|
|
7
|
+
export * from './Calc.js';
|
|
8
|
+
export * from './CoordinateUtils.js';
|
|
9
|
+
export * from './DateUtils.js';
|
|
10
|
+
export * from './NumberUtils.js';
|
|
11
|
+
export * from './ObjectIdUtils.js';
|
|
12
|
+
export * from './Point3Utils.js';
|
|
13
|
+
export * from './RandomUtils.js';
|
|
14
|
+
export * from './Validator.js';
|
|
15
|
+
export * from './JuminNumberUtils.js';
|
|
16
|
+
export * from './Sequencer.js';
|
|
17
|
+
export * from './try-catch/index.js';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./global/index.js"), exports);
|
|
18
|
+
__exportStar(require("./ArrayUtils.js"), exports);
|
|
19
|
+
__exportStar(require("./AxiosUtils.js"), exports);
|
|
20
|
+
__exportStar(require("./StringUtils.js"), exports);
|
|
21
|
+
__exportStar(require("./UuidUtils.js"), exports);
|
|
22
|
+
__exportStar(require("./BooleanUtils.js"), exports);
|
|
23
|
+
__exportStar(require("./Calc.js"), exports);
|
|
24
|
+
__exportStar(require("./CoordinateUtils.js"), exports);
|
|
25
|
+
__exportStar(require("./DateUtils.js"), exports);
|
|
26
|
+
__exportStar(require("./NumberUtils.js"), exports);
|
|
27
|
+
__exportStar(require("./ObjectIdUtils.js"), exports);
|
|
28
|
+
__exportStar(require("./Point3Utils.js"), exports);
|
|
29
|
+
__exportStar(require("./RandomUtils.js"), exports);
|
|
30
|
+
__exportStar(require("./Validator.js"), exports);
|
|
31
|
+
__exportStar(require("./JuminNumberUtils.js"), exports);
|
|
32
|
+
__exportStar(require("./Sequencer.js"), exports);
|
|
33
|
+
__exportStar(require("./try-catch/index.js"), exports);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./index.browser.js"), exports);
|
|
18
|
+
__exportStar(require("./nodejs/index.js"), exports);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Hook, HookFn } from "../../interfaces";
|
|
1
|
+
import { Hook, HookFn } from "../../interfaces/index.js";
|
|
2
2
|
import { ModelCtor } from "sequelize-typescript";
|
|
3
3
|
export declare class HookUtils {
|
|
4
4
|
static getFkChanges<T>(pFkValue: T | null | undefined, cFkValue: T | null | undefined): {
|
|
@@ -15,6 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.SequelizeUtils = void 0;
|
|
18
|
-
__exportStar(require("./HookUtils"), exports);
|
|
19
|
-
var
|
|
20
|
-
Object.defineProperty(exports, "SequelizeUtils", { enumerable: true, get: function () { return
|
|
18
|
+
__exportStar(require("./HookUtils.js"), exports);
|
|
19
|
+
var index_js_1 = require("./sequelize-utils/index.js");
|
|
20
|
+
Object.defineProperty(exports, "SequelizeUtils", { enumerable: true, get: function () { return index_js_1.SequelizeUtils; } });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ModelAttributeColumnOptions, WhereOptions } from "sequelize";
|
|
2
|
-
import { Model, NonKnownUuidStringKeys, UuidColumnOptionsBase, UuidColumnOptionsForModel } from "./types";
|
|
2
|
+
import { Model, NonKnownUuidStringKeys, UuidColumnOptionsBase, UuidColumnOptionsForModel } from "./types.js";
|
|
3
3
|
export declare class SequelizeUtils {
|
|
4
4
|
static decimal2Number(value: any): number | null | undefined;
|
|
5
5
|
static buildPrimaryUuidColumn: () => Partial<ModelAttributeColumnOptions>;
|
|
@@ -13,8 +13,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.SequelizeUtils = void 0;
|
|
15
15
|
const sequelize_1 = require("sequelize");
|
|
16
|
-
const
|
|
17
|
-
const
|
|
16
|
+
const UuidUtils_js_1 = require("../../UuidUtils.js");
|
|
17
|
+
const index_js_1 = require("../../../constants/index.js");
|
|
18
18
|
class SequelizeUtils {
|
|
19
19
|
static decimal2Number(value) {
|
|
20
20
|
if (value === null || value === undefined) {
|
|
@@ -34,18 +34,18 @@ class SequelizeUtils {
|
|
|
34
34
|
if (value === null) {
|
|
35
35
|
return value;
|
|
36
36
|
}
|
|
37
|
-
return
|
|
37
|
+
return UuidUtils_js_1.UuidUtils.toString(this.getDataValue(columnName));
|
|
38
38
|
},
|
|
39
39
|
set(uuid) {
|
|
40
|
-
this.setDataValue(columnName, uuid === null ? null :
|
|
40
|
+
this.setDataValue(columnName, uuid === null ? null : UuidUtils_js_1.UuidUtils.toBuffer(uuid));
|
|
41
41
|
} }, overrideOptions);
|
|
42
42
|
}
|
|
43
43
|
else {
|
|
44
44
|
return Object.assign({ type: "binary(16)", get() {
|
|
45
|
-
return
|
|
45
|
+
return UuidUtils_js_1.UuidUtils.toString(this.getDataValue(columnName));
|
|
46
46
|
},
|
|
47
47
|
set(uuid) {
|
|
48
|
-
this.setDataValue(columnName,
|
|
48
|
+
this.setDataValue(columnName, UuidUtils_js_1.UuidUtils.toBuffer(uuid));
|
|
49
49
|
} }, overrideOptions);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -55,7 +55,7 @@ class SequelizeUtils {
|
|
|
55
55
|
if (value === null) {
|
|
56
56
|
return { [sequelize_1.Op.is]: value };
|
|
57
57
|
}
|
|
58
|
-
else if (value ===
|
|
58
|
+
else if (value === index_js_1.NOT_NULL) {
|
|
59
59
|
return { [sequelize_1.Op.not]: null };
|
|
60
60
|
}
|
|
61
61
|
else {
|
|
@@ -71,5 +71,5 @@ SequelizeUtils.buildPrimaryUuidColumn = () => (Object.assign({}, SequelizeUtils.
|
|
|
71
71
|
allowNull: false,
|
|
72
72
|
primaryKey: true,
|
|
73
73
|
unique: true,
|
|
74
|
-
defaultValue: () =>
|
|
74
|
+
defaultValue: () => UuidUtils_js_1.UuidUtils.toBuffer(UuidUtils_js_1.UuidUtils.v4()),
|
|
75
75
|
})));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SequelizeUtils } from './SequelizeUtils.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SequelizeUtils = void 0;
|
|
4
|
-
var
|
|
5
|
-
Object.defineProperty(exports, "SequelizeUtils", { enumerable: true, get: function () { return
|
|
4
|
+
var SequelizeUtils_js_1 = require("./SequelizeUtils.js");
|
|
5
|
+
Object.defineProperty(exports, "SequelizeUtils", { enumerable: true, get: function () { return SequelizeUtils_js_1.SequelizeUtils; } });
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
export 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
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.TryCatch = void 0;
|
|
13
|
+
/**
|
|
14
|
+
* Provides a utility class for handling synchronous and asynchronous operations with a consistent try-catch pattern.
|
|
15
|
+
* 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).
|
|
16
|
+
*/
|
|
17
|
+
class TryCatch {
|
|
18
|
+
/**
|
|
19
|
+
* Executes a synchronous function within a try-catch block.
|
|
20
|
+
* @template T The return type of the function.
|
|
21
|
+
* @template E The type of the error that might be thrown (defaults to Error).
|
|
22
|
+
* @param fn The synchronous function to execute.
|
|
23
|
+
*@param disableLogging console.error is default way of logging on error. You can disable it by setting it true
|
|
24
|
+
* @returns A tuple containing the result of the function and an error (null if successful).
|
|
25
|
+
*/
|
|
26
|
+
static function(fn, disableLogging) {
|
|
27
|
+
try {
|
|
28
|
+
return [
|
|
29
|
+
null,
|
|
30
|
+
fn(),
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
catch (e) {
|
|
34
|
+
if (!disableLogging) {
|
|
35
|
+
console.error("ERROR in TryCatch: ", e);
|
|
36
|
+
}
|
|
37
|
+
if (e == null) {
|
|
38
|
+
e = new Error("Unknown error");
|
|
39
|
+
}
|
|
40
|
+
return [
|
|
41
|
+
e,
|
|
42
|
+
undefined,
|
|
43
|
+
];
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Executes an asynchronous function (Promise) within a try-catch block.
|
|
48
|
+
* @template T The resolved value type of the Promise.
|
|
49
|
+
* @template E The type of the error that might be rejected (defaults to Error).
|
|
50
|
+
* @param fn The Promise to await.
|
|
51
|
+
* @param disableLogging console.error is default way of logging on error. You can disable it by setting it true
|
|
52
|
+
* @returns A tuple containing the resolved value of the Promise and an error (null if successful).
|
|
53
|
+
*/
|
|
54
|
+
static asyncFunction(fn, disableLogging) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
try {
|
|
57
|
+
const data = yield fn;
|
|
58
|
+
return [
|
|
59
|
+
null,
|
|
60
|
+
data,
|
|
61
|
+
];
|
|
62
|
+
}
|
|
63
|
+
catch (e) {
|
|
64
|
+
if (!disableLogging) {
|
|
65
|
+
console.error("ERROR in TryCatch: ", e);
|
|
66
|
+
}
|
|
67
|
+
if (e == null) {
|
|
68
|
+
e = new Error("Unknown error");
|
|
69
|
+
}
|
|
70
|
+
return [
|
|
71
|
+
e,
|
|
72
|
+
undefined,
|
|
73
|
+
];
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.TryCatch = TryCatch;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./TryCatch.js";
|
|
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./TryCatch.js"), exports);
|
package/package.json
CHANGED
|
@@ -1,49 +1,58 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
2
|
+
"name": "@powfix/core-js",
|
|
3
|
+
"version": "0.15.0-beta-1",
|
|
4
|
+
"description": "core package",
|
|
5
|
+
"author": "Kwon Kyung-Min <powfix@gmail.com>",
|
|
6
|
+
"private": false,
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/powfix/core-js"
|
|
10
|
+
},
|
|
11
|
+
"keywords": ["javascript", "core", "util"],
|
|
12
|
+
"homepage": "https://github.com/powfix/core-js",
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"exports": {
|
|
15
|
+
"./client": {
|
|
16
|
+
"default": "./dist/client/index.browser.js",
|
|
17
|
+
"types": "./dist/client/index.browser.d.ts"
|
|
18
|
+
},
|
|
19
|
+
"./server": {
|
|
20
|
+
"default": "./dist/server/index.js",
|
|
21
|
+
"types": "./dist/server/index.d.ts"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"clean": "rm -rf dist | wc -l",
|
|
26
|
+
"prebuild": "yarn clean",
|
|
27
|
+
"build:client": "tsc -p tsconfig.client.json",
|
|
28
|
+
"build:server": "tsc -p tsconfig.server.json",
|
|
29
|
+
"build": "yarn build:client && yarn build:server",
|
|
30
|
+
"deploy": "yarn deploy:patch",
|
|
31
|
+
"deploy:patch": "yarn build && npm version patch && npm publish",
|
|
32
|
+
"deploy:minor": "yarn build && npm version minor && npm publish",
|
|
33
|
+
"deploy:major": "yarn build && npm version major && npm publish"
|
|
34
|
+
},
|
|
35
|
+
"files": ["dist"],
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"base-64": "^1.0.0",
|
|
38
|
+
"eventemitter3": "^5.0.1",
|
|
39
|
+
"jwt-decode": "^4.0.0",
|
|
40
|
+
"redis": "4.7.0",
|
|
41
|
+
"uuid": "9.0.1"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@types/base-64": "1.0.2",
|
|
45
|
+
"@types/node": "20.9.5",
|
|
46
|
+
"@types/uuid": "9.0.7",
|
|
47
|
+
"axios": "^1.9.0",
|
|
48
|
+
"moment": "^2.30.1",
|
|
49
|
+
"sequelize": "6.37.7",
|
|
50
|
+
"sequelize-typescript": "^2.1.6",
|
|
51
|
+
"ts-node": "^10.9.2",
|
|
52
|
+
"typescript": "5.8.3"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"moment": ">=2.0.0",
|
|
56
|
+
"eventemitter3": ">=5"
|
|
57
|
+
}
|
|
49
58
|
}
|
package/dist/index.browser.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './src/index.browser';
|
package/dist/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './src/index';
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * from './constants/index.browser';
|
|
2
|
-
export * from './interfaces/index.browser';
|
|
3
|
-
export * from './managers/index.browser';
|
|
4
|
-
export * from './scripts/index.browser';
|
|
5
|
-
export * from './services/index.browser';
|
|
6
|
-
export * from './types/index.browser';
|
|
7
|
-
export * from './utils/index.browser';
|