@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,48 @@
|
|
|
1
|
+
function _class_call_check(instance, Constructor) {
|
|
2
|
+
if (!(instance instanceof Constructor)) {
|
|
3
|
+
throw new TypeError("Cannot call a class as a function");
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
function _defineProperties(target, props) {
|
|
7
|
+
for(var i = 0; i < props.length; i++){
|
|
8
|
+
var descriptor = props[i];
|
|
9
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
10
|
+
descriptor.configurable = true;
|
|
11
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
12
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
16
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
17
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
18
|
+
return Constructor;
|
|
19
|
+
}
|
|
20
|
+
import '../../chunk-PKBMQBKP.js';
|
|
21
|
+
var Uint8ArrayUtils = /*#__PURE__*/ function() {
|
|
22
|
+
"use strict";
|
|
23
|
+
function Uint8ArrayUtils() {
|
|
24
|
+
_class_call_check(this, Uint8ArrayUtils);
|
|
25
|
+
}
|
|
26
|
+
_create_class(Uint8ArrayUtils, null, [
|
|
27
|
+
{
|
|
28
|
+
key: "fromHex",
|
|
29
|
+
value: function fromHex(hex) {
|
|
30
|
+
var _hex_match;
|
|
31
|
+
var _hex_match_map;
|
|
32
|
+
return Uint8Array.from((_hex_match_map = (_hex_match = hex.match(/.{1,2}/g)) === null || _hex_match === void 0 ? void 0 : _hex_match.map(function(byte) {
|
|
33
|
+
return parseInt(byte, 16);
|
|
34
|
+
})) !== null && _hex_match_map !== void 0 ? _hex_match_map : []);
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
key: "toHex",
|
|
39
|
+
value: function toHex(bytes) {
|
|
40
|
+
return bytes.reduce(function(str, byte) {
|
|
41
|
+
return str + byte.toString(16).padStart(2, "0");
|
|
42
|
+
}, "");
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
]);
|
|
46
|
+
return Uint8ArrayUtils;
|
|
47
|
+
}();
|
|
48
|
+
export { Uint8ArrayUtils };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
function _class_call_check(instance, Constructor) {
|
|
3
|
+
if (!(instance instanceof Constructor)) {
|
|
4
|
+
throw new TypeError("Cannot call a class as a function");
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
function _defineProperties(target, props) {
|
|
8
|
+
for(var i = 0; i < props.length; i++){
|
|
9
|
+
var descriptor = props[i];
|
|
10
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
11
|
+
descriptor.configurable = true;
|
|
12
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
13
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
17
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
18
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
19
|
+
return Constructor;
|
|
20
|
+
}
|
|
21
|
+
require('../../chunk-ETV4XYOV.cjs');
|
|
22
|
+
var uuid = require('uuid');
|
|
23
|
+
var Uint8ArrayUtils = require('./Uint8ArrayUtils');
|
|
24
|
+
function _interopNamespace(e) {
|
|
25
|
+
if (e && e.__esModule) return e;
|
|
26
|
+
var n = Object.create(null);
|
|
27
|
+
if (e) {
|
|
28
|
+
Object.keys(e).forEach(function(k) {
|
|
29
|
+
if (k !== 'default') {
|
|
30
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
31
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function get() {
|
|
34
|
+
return e[k];
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
n.default = e;
|
|
41
|
+
return Object.freeze(n);
|
|
42
|
+
}
|
|
43
|
+
var uuid__namespace = /*#__PURE__*/ _interopNamespace(uuid);
|
|
44
|
+
var UuidUtils = /*#__PURE__*/ function() {
|
|
45
|
+
function UuidUtils() {
|
|
46
|
+
_class_call_check(this, UuidUtils);
|
|
47
|
+
}
|
|
48
|
+
_create_class(UuidUtils, null, [
|
|
49
|
+
{
|
|
50
|
+
key: "v4",
|
|
51
|
+
value: function v4() {
|
|
52
|
+
return uuid__namespace.v4();
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
key: "format",
|
|
57
|
+
value: function format(uuid2) {
|
|
58
|
+
if (uuid2.length === 32) {
|
|
59
|
+
return "".concat(uuid2.substring(0, 8), "-").concat(uuid2.substring(8, 12), "-").concat(uuid2.substring(12, 16), "-").concat(uuid2.substring(16, 20), "-").concat(uuid2.substring(20, 32)).toLowerCase();
|
|
60
|
+
} else if (uuid2.length === 36) {
|
|
61
|
+
return uuid2.toLowerCase();
|
|
62
|
+
} else {
|
|
63
|
+
console.warn("Unexpected uuid length", uuid2);
|
|
64
|
+
return uuid2;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
key: "toString",
|
|
70
|
+
value: function toString(binary) {
|
|
71
|
+
if (!binary) return null;
|
|
72
|
+
return UuidUtils.format(Uint8ArrayUtils.Uint8ArrayUtils.toHex(binary));
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
key: "toBuffer",
|
|
77
|
+
value: function toBuffer(uuid2) {
|
|
78
|
+
if (!uuid2) {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
return Buffer.from(uuid2.replace(/-/g, ""), "hex");
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
key: "isValidUUID",
|
|
86
|
+
value: function isValidUUID(uuid2) {
|
|
87
|
+
if (!uuid2) return false;
|
|
88
|
+
if (typeof uuid2 !== "string") return false;
|
|
89
|
+
return RegExp(/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/i).test(uuid2);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
]);
|
|
93
|
+
return UuidUtils;
|
|
94
|
+
}();
|
|
95
|
+
exports.UuidUtils = UuidUtils;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare class UuidUtils {
|
|
2
|
+
static v4(): string;
|
|
3
|
+
static format(uuid: string): string;
|
|
4
|
+
/**
|
|
5
|
+
* (UUID: Buffer) to (UUID: string)
|
|
6
|
+
* @param binary UUID
|
|
7
|
+
* @returns {string|null} When binary not exists return null
|
|
8
|
+
*/
|
|
9
|
+
static toString(binary: Uint8Array): string;
|
|
10
|
+
/** (UUID: string) to (UUID: Buffer) */
|
|
11
|
+
static toBuffer(uuid: string): Buffer;
|
|
12
|
+
static toBuffer(uuid: string | null | undefined): Buffer | null;
|
|
13
|
+
static isValidUUID(uuid: string): boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { UuidUtils };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
function _class_call_check(instance, Constructor) {
|
|
2
|
+
if (!(instance instanceof Constructor)) {
|
|
3
|
+
throw new TypeError("Cannot call a class as a function");
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
function _defineProperties(target, props) {
|
|
7
|
+
for(var i = 0; i < props.length; i++){
|
|
8
|
+
var descriptor = props[i];
|
|
9
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
10
|
+
descriptor.configurable = true;
|
|
11
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
12
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
16
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
17
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
18
|
+
return Constructor;
|
|
19
|
+
}
|
|
20
|
+
import '../../chunk-PKBMQBKP.js';
|
|
21
|
+
import * as uuid from 'uuid';
|
|
22
|
+
import { Uint8ArrayUtils } from './Uint8ArrayUtils';
|
|
23
|
+
var UuidUtils = /*#__PURE__*/ function() {
|
|
24
|
+
"use strict";
|
|
25
|
+
function UuidUtils() {
|
|
26
|
+
_class_call_check(this, UuidUtils);
|
|
27
|
+
}
|
|
28
|
+
_create_class(UuidUtils, null, [
|
|
29
|
+
{
|
|
30
|
+
key: "v4",
|
|
31
|
+
value: function v4() {
|
|
32
|
+
return uuid.v4();
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
key: "format",
|
|
37
|
+
value: function format(uuid2) {
|
|
38
|
+
if (uuid2.length === 32) {
|
|
39
|
+
return "".concat(uuid2.substring(0, 8), "-").concat(uuid2.substring(8, 12), "-").concat(uuid2.substring(12, 16), "-").concat(uuid2.substring(16, 20), "-").concat(uuid2.substring(20, 32)).toLowerCase();
|
|
40
|
+
} else if (uuid2.length === 36) {
|
|
41
|
+
return uuid2.toLowerCase();
|
|
42
|
+
} else {
|
|
43
|
+
console.warn("Unexpected uuid length", uuid2);
|
|
44
|
+
return uuid2;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
key: "toString",
|
|
50
|
+
value: function toString(binary) {
|
|
51
|
+
if (!binary) return null;
|
|
52
|
+
return UuidUtils.format(Uint8ArrayUtils.toHex(binary));
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
key: "toBuffer",
|
|
57
|
+
value: function toBuffer(uuid2) {
|
|
58
|
+
if (!uuid2) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
return Buffer.from(uuid2.replace(/-/g, ""), "hex");
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
key: "isValidUUID",
|
|
66
|
+
value: function isValidUUID(uuid2) {
|
|
67
|
+
if (!uuid2) return false;
|
|
68
|
+
if (typeof uuid2 !== "string") return false;
|
|
69
|
+
return RegExp(/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/i).test(uuid2);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
]);
|
|
73
|
+
return UuidUtils;
|
|
74
|
+
}();
|
|
75
|
+
export { UuidUtils };
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
function _class_call_check(instance, Constructor) {
|
|
3
|
+
if (!(instance instanceof Constructor)) {
|
|
4
|
+
throw new TypeError("Cannot call a class as a function");
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
function _defineProperties(target, props) {
|
|
8
|
+
for(var i = 0; i < props.length; i++){
|
|
9
|
+
var descriptor = props[i];
|
|
10
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
11
|
+
descriptor.configurable = true;
|
|
12
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
13
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
17
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
18
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
19
|
+
return Constructor;
|
|
20
|
+
}
|
|
21
|
+
require('../../chunk-ETV4XYOV.cjs');
|
|
22
|
+
var Validator = /*#__PURE__*/ function() {
|
|
23
|
+
function Validator() {
|
|
24
|
+
_class_call_check(this, Validator);
|
|
25
|
+
}
|
|
26
|
+
_create_class(Validator, null, [
|
|
27
|
+
{
|
|
28
|
+
key: "validate",
|
|
29
|
+
value: function validate(value, options) {
|
|
30
|
+
value = value || "";
|
|
31
|
+
var validations = [];
|
|
32
|
+
var errors = [];
|
|
33
|
+
var length = value.length;
|
|
34
|
+
var spaceCount = (value.match(/\s/g) || []).length;
|
|
35
|
+
var numberCount = (value.match(/\d/g) || []).length;
|
|
36
|
+
var alphabetCount = (value.match(/[A-Za-z]/g) || []).length;
|
|
37
|
+
var alphabetLowerCaseCount = (value.match(/[a-z]/g) || []).length;
|
|
38
|
+
var alphabetUpperCaseCount = (value.match(/[A-Z]/g) || []).length;
|
|
39
|
+
var specialCount = (value.match(/[~`!@#$%^&*()\-+={[}\]|\\:;"'<,>.?/]/g) || []).length;
|
|
40
|
+
var startsWithNumber = /^\d/.test(value);
|
|
41
|
+
var startsWithAlphabet = /^[A-Za-z]/.test(value);
|
|
42
|
+
var startsWithSpecialCharacter = /^[~`!@#$%^&*()\-+={[}\]|\\:;"'<,>.?/]/.test(value);
|
|
43
|
+
if (options.minLength !== void 0 && options.minLength > -1) {
|
|
44
|
+
validations.push(Validator.VALIDATION.MIN_LENGTH);
|
|
45
|
+
if (length < options.minLength) {
|
|
46
|
+
errors.push(Validator.VALIDATION.MIN_LENGTH);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (options.maxLength !== void 0 && options.maxLength > -1) {
|
|
50
|
+
validations.push(Validator.VALIDATION.MAX_LENGTH);
|
|
51
|
+
if (length > options.maxLength) {
|
|
52
|
+
errors.push(Validator.VALIDATION.MAX_LENGTH);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
var validateMin = function(option, value2, validation) {
|
|
56
|
+
if (option !== void 0 && option > -1) {
|
|
57
|
+
validations.push(validation);
|
|
58
|
+
if (value2 < option) {
|
|
59
|
+
errors.push(validation);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
var validateMax = function(option, value2, validation) {
|
|
64
|
+
if (option !== void 0 && option > -1) {
|
|
65
|
+
validations.push(validation);
|
|
66
|
+
if (value2 > option) {
|
|
67
|
+
errors.push(validation);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
validateMin(options.spaceMinCount, spaceCount, Validator.VALIDATION.SPACE_MIN_COUNT);
|
|
72
|
+
validateMax(options.spaceMaxCount, spaceCount, Validator.VALIDATION.SPACE_MAX_COUNT);
|
|
73
|
+
validateMin(options.numberMinCount, numberCount, Validator.VALIDATION.NUMBER_MIN_COUNT);
|
|
74
|
+
validateMax(options.numberMaxCount, numberCount, Validator.VALIDATION.NUMBER_MAX_COUNT);
|
|
75
|
+
validateMin(options.alphabetMinCount, alphabetCount, Validator.VALIDATION.ALPHABET_MIN_COUNT);
|
|
76
|
+
validateMax(options.alphabetMaxCount, alphabetCount, Validator.VALIDATION.ALPHABET_MAX_COUNT);
|
|
77
|
+
validateMin(options.alphabetLowerCaseMinCount, alphabetLowerCaseCount, Validator.VALIDATION.ALPHABET_LOWER_CASE_MIN_COUNT);
|
|
78
|
+
validateMax(options.alphabetLowerCaseMaxCount, alphabetLowerCaseCount, Validator.VALIDATION.ALPHABET_LOWER_CASE_MAX_COUNT);
|
|
79
|
+
validateMin(options.alphabetUpperCaseMinCount, alphabetUpperCaseCount, Validator.VALIDATION.ALPHABET_UPPER_CASE_MIN_COUNT);
|
|
80
|
+
validateMax(options.alphabetUpperCaseMaxCount, alphabetUpperCaseCount, Validator.VALIDATION.ALPHABET_UPPER_CASE_MAX_COUNT);
|
|
81
|
+
validateMin(options.specialCharacterMinCount, specialCount, Validator.VALIDATION.SPECIAL_CHARACTER_MIN_COUNT);
|
|
82
|
+
validateMax(options.specialCharacterMaxCount, specialCount, Validator.VALIDATION.SPECIAL_CHARACTER_MAX_COUNT);
|
|
83
|
+
if (options.startsWithNumber) {
|
|
84
|
+
validations.push(Validator.VALIDATION.STARTS_WITH_NUMBER);
|
|
85
|
+
if (!startsWithNumber) {
|
|
86
|
+
errors.push(Validator.VALIDATION.STARTS_WITH_NUMBER);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (options.startsWithAlphabet) {
|
|
90
|
+
validations.push(Validator.VALIDATION.STARTS_WITH_ALPHABET);
|
|
91
|
+
if (!startsWithAlphabet) {
|
|
92
|
+
errors.push(Validator.VALIDATION.STARTS_WITH_ALPHABET);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (options.startsWithSpecialCharacter) {
|
|
96
|
+
validations.push(Validator.VALIDATION.STARTS_WITH_SPECIAL_CHARACTER);
|
|
97
|
+
if (!startsWithSpecialCharacter) {
|
|
98
|
+
errors.push(Validator.VALIDATION.STARTS_WITH_SPECIAL_CHARACTER);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
result: errors.length === 0,
|
|
103
|
+
validations: validations,
|
|
104
|
+
passes: validations.filter(function(e) {
|
|
105
|
+
return !errors.includes(e);
|
|
106
|
+
}),
|
|
107
|
+
errors: errors
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
]);
|
|
112
|
+
return Validator;
|
|
113
|
+
}();
|
|
114
|
+
(function(Validator2) {
|
|
115
|
+
(function(VALIDATION2) {
|
|
116
|
+
VALIDATION2["MIN_LENGTH"] = "MIN_LENGTH";
|
|
117
|
+
VALIDATION2["MAX_LENGTH"] = "MAX_LENGTH";
|
|
118
|
+
VALIDATION2["SPACE_MIN_COUNT"] = "SPACE_MIN_COUNT";
|
|
119
|
+
VALIDATION2["SPACE_MAX_COUNT"] = "SPACE_MAX_COUNT";
|
|
120
|
+
VALIDATION2["NUMBER_MIN_COUNT"] = "NUMBER_MIN_COUNT";
|
|
121
|
+
VALIDATION2["NUMBER_MAX_COUNT"] = "NUMBER_MAX_COUNT";
|
|
122
|
+
VALIDATION2["ALPHABET_MIN_COUNT"] = "ALPHABET_MIN_COUNT";
|
|
123
|
+
VALIDATION2["ALPHABET_MAX_COUNT"] = "ALPHABET_MAX_COUNT";
|
|
124
|
+
VALIDATION2["ALPHABET_LOWER_CASE_MIN_COUNT"] = "ALPHABET_LOWER_CASE_MIN_COUNT";
|
|
125
|
+
VALIDATION2["ALPHABET_LOWER_CASE_MAX_COUNT"] = "ALPHABET_LOWER_CASE_MAX_COUNT";
|
|
126
|
+
VALIDATION2["ALPHABET_UPPER_CASE_MIN_COUNT"] = "ALPHABET_UPPER_CASE_MIN_COUNT";
|
|
127
|
+
VALIDATION2["ALPHABET_UPPER_CASE_MAX_COUNT"] = "ALPHABET_UPPER_CASE_MAX_COUNT";
|
|
128
|
+
VALIDATION2["SPECIAL_CHARACTER_MIN_COUNT"] = "SPECIAL_CHARACTER_MIN_COUNT";
|
|
129
|
+
VALIDATION2["SPECIAL_CHARACTER_MAX_COUNT"] = "SPECIAL_CHARACTER_MAX_COUNT";
|
|
130
|
+
VALIDATION2["STARTS_WITH_ALPHABET"] = "STARTS_WITH_ALPHABET";
|
|
131
|
+
VALIDATION2["STARTS_WITH_NUMBER"] = "STARTS_WITH_NUMBER";
|
|
132
|
+
VALIDATION2["STARTS_WITH_SPECIAL_CHARACTER"] = "STARTS_WITH_SPECIAL_CHARACTER";
|
|
133
|
+
})(Validator2.VALIDATION || (Validator2.VALIDATION = {}));
|
|
134
|
+
})(Validator || (Validator = {}));
|
|
135
|
+
exports.Validator = Validator;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
declare class Validator {
|
|
2
|
+
static validate(value: string | null | undefined, options: Validator.Options): {
|
|
3
|
+
result: boolean;
|
|
4
|
+
validations: Validator.VALIDATION[];
|
|
5
|
+
passes: Validator.VALIDATION[];
|
|
6
|
+
errors: Validator.VALIDATION[];
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
declare namespace Validator {
|
|
10
|
+
enum VALIDATION {
|
|
11
|
+
MIN_LENGTH = "MIN_LENGTH",
|
|
12
|
+
MAX_LENGTH = "MAX_LENGTH",
|
|
13
|
+
SPACE_MIN_COUNT = "SPACE_MIN_COUNT",
|
|
14
|
+
SPACE_MAX_COUNT = "SPACE_MAX_COUNT",
|
|
15
|
+
NUMBER_MIN_COUNT = "NUMBER_MIN_COUNT",
|
|
16
|
+
NUMBER_MAX_COUNT = "NUMBER_MAX_COUNT",
|
|
17
|
+
ALPHABET_MIN_COUNT = "ALPHABET_MIN_COUNT",
|
|
18
|
+
ALPHABET_MAX_COUNT = "ALPHABET_MAX_COUNT",
|
|
19
|
+
ALPHABET_LOWER_CASE_MIN_COUNT = "ALPHABET_LOWER_CASE_MIN_COUNT",
|
|
20
|
+
ALPHABET_LOWER_CASE_MAX_COUNT = "ALPHABET_LOWER_CASE_MAX_COUNT",
|
|
21
|
+
ALPHABET_UPPER_CASE_MIN_COUNT = "ALPHABET_UPPER_CASE_MIN_COUNT",
|
|
22
|
+
ALPHABET_UPPER_CASE_MAX_COUNT = "ALPHABET_UPPER_CASE_MAX_COUNT",
|
|
23
|
+
SPECIAL_CHARACTER_MIN_COUNT = "SPECIAL_CHARACTER_MIN_COUNT",
|
|
24
|
+
SPECIAL_CHARACTER_MAX_COUNT = "SPECIAL_CHARACTER_MAX_COUNT",
|
|
25
|
+
STARTS_WITH_ALPHABET = "STARTS_WITH_ALPHABET",
|
|
26
|
+
STARTS_WITH_NUMBER = "STARTS_WITH_NUMBER",
|
|
27
|
+
STARTS_WITH_SPECIAL_CHARACTER = "STARTS_WITH_SPECIAL_CHARACTER"
|
|
28
|
+
}
|
|
29
|
+
interface Options {
|
|
30
|
+
minLength?: number;
|
|
31
|
+
maxLength?: number;
|
|
32
|
+
spaceMinCount?: number;
|
|
33
|
+
spaceMaxCount?: number;
|
|
34
|
+
numberMinCount?: number;
|
|
35
|
+
numberMaxCount?: number;
|
|
36
|
+
alphabetMinCount?: number;
|
|
37
|
+
alphabetMaxCount?: number;
|
|
38
|
+
alphabetLowerCaseMinCount?: number;
|
|
39
|
+
alphabetLowerCaseMaxCount?: number;
|
|
40
|
+
alphabetUpperCaseMinCount?: number;
|
|
41
|
+
alphabetUpperCaseMaxCount?: number;
|
|
42
|
+
specialCharacterMinCount?: number;
|
|
43
|
+
specialCharacterMaxCount?: number;
|
|
44
|
+
startsWithNumber?: boolean;
|
|
45
|
+
startsWithAlphabet?: boolean;
|
|
46
|
+
startsWithSpecialCharacter?: boolean;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export { Validator };
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
function _class_call_check(instance, Constructor) {
|
|
2
|
+
if (!(instance instanceof Constructor)) {
|
|
3
|
+
throw new TypeError("Cannot call a class as a function");
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
function _defineProperties(target, props) {
|
|
7
|
+
for(var i = 0; i < props.length; i++){
|
|
8
|
+
var descriptor = props[i];
|
|
9
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
10
|
+
descriptor.configurable = true;
|
|
11
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
12
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
16
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
17
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
18
|
+
return Constructor;
|
|
19
|
+
}
|
|
20
|
+
import '../../chunk-PKBMQBKP.js';
|
|
21
|
+
var Validator = /*#__PURE__*/ function() {
|
|
22
|
+
"use strict";
|
|
23
|
+
function Validator() {
|
|
24
|
+
_class_call_check(this, Validator);
|
|
25
|
+
}
|
|
26
|
+
_create_class(Validator, null, [
|
|
27
|
+
{
|
|
28
|
+
key: "validate",
|
|
29
|
+
value: function validate(value, options) {
|
|
30
|
+
value = value || "";
|
|
31
|
+
var validations = [];
|
|
32
|
+
var errors = [];
|
|
33
|
+
var length = value.length;
|
|
34
|
+
var spaceCount = (value.match(/\s/g) || []).length;
|
|
35
|
+
var numberCount = (value.match(/\d/g) || []).length;
|
|
36
|
+
var alphabetCount = (value.match(/[A-Za-z]/g) || []).length;
|
|
37
|
+
var alphabetLowerCaseCount = (value.match(/[a-z]/g) || []).length;
|
|
38
|
+
var alphabetUpperCaseCount = (value.match(/[A-Z]/g) || []).length;
|
|
39
|
+
var specialCount = (value.match(/[~`!@#$%^&*()\-+={[}\]|\\:;"'<,>.?/]/g) || []).length;
|
|
40
|
+
var startsWithNumber = /^\d/.test(value);
|
|
41
|
+
var startsWithAlphabet = /^[A-Za-z]/.test(value);
|
|
42
|
+
var startsWithSpecialCharacter = /^[~`!@#$%^&*()\-+={[}\]|\\:;"'<,>.?/]/.test(value);
|
|
43
|
+
if (options.minLength !== void 0 && options.minLength > -1) {
|
|
44
|
+
validations.push(Validator.VALIDATION.MIN_LENGTH);
|
|
45
|
+
if (length < options.minLength) {
|
|
46
|
+
errors.push(Validator.VALIDATION.MIN_LENGTH);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (options.maxLength !== void 0 && options.maxLength > -1) {
|
|
50
|
+
validations.push(Validator.VALIDATION.MAX_LENGTH);
|
|
51
|
+
if (length > options.maxLength) {
|
|
52
|
+
errors.push(Validator.VALIDATION.MAX_LENGTH);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
var validateMin = function(option, value2, validation) {
|
|
56
|
+
if (option !== void 0 && option > -1) {
|
|
57
|
+
validations.push(validation);
|
|
58
|
+
if (value2 < option) {
|
|
59
|
+
errors.push(validation);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
var validateMax = function(option, value2, validation) {
|
|
64
|
+
if (option !== void 0 && option > -1) {
|
|
65
|
+
validations.push(validation);
|
|
66
|
+
if (value2 > option) {
|
|
67
|
+
errors.push(validation);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
validateMin(options.spaceMinCount, spaceCount, Validator.VALIDATION.SPACE_MIN_COUNT);
|
|
72
|
+
validateMax(options.spaceMaxCount, spaceCount, Validator.VALIDATION.SPACE_MAX_COUNT);
|
|
73
|
+
validateMin(options.numberMinCount, numberCount, Validator.VALIDATION.NUMBER_MIN_COUNT);
|
|
74
|
+
validateMax(options.numberMaxCount, numberCount, Validator.VALIDATION.NUMBER_MAX_COUNT);
|
|
75
|
+
validateMin(options.alphabetMinCount, alphabetCount, Validator.VALIDATION.ALPHABET_MIN_COUNT);
|
|
76
|
+
validateMax(options.alphabetMaxCount, alphabetCount, Validator.VALIDATION.ALPHABET_MAX_COUNT);
|
|
77
|
+
validateMin(options.alphabetLowerCaseMinCount, alphabetLowerCaseCount, Validator.VALIDATION.ALPHABET_LOWER_CASE_MIN_COUNT);
|
|
78
|
+
validateMax(options.alphabetLowerCaseMaxCount, alphabetLowerCaseCount, Validator.VALIDATION.ALPHABET_LOWER_CASE_MAX_COUNT);
|
|
79
|
+
validateMin(options.alphabetUpperCaseMinCount, alphabetUpperCaseCount, Validator.VALIDATION.ALPHABET_UPPER_CASE_MIN_COUNT);
|
|
80
|
+
validateMax(options.alphabetUpperCaseMaxCount, alphabetUpperCaseCount, Validator.VALIDATION.ALPHABET_UPPER_CASE_MAX_COUNT);
|
|
81
|
+
validateMin(options.specialCharacterMinCount, specialCount, Validator.VALIDATION.SPECIAL_CHARACTER_MIN_COUNT);
|
|
82
|
+
validateMax(options.specialCharacterMaxCount, specialCount, Validator.VALIDATION.SPECIAL_CHARACTER_MAX_COUNT);
|
|
83
|
+
if (options.startsWithNumber) {
|
|
84
|
+
validations.push(Validator.VALIDATION.STARTS_WITH_NUMBER);
|
|
85
|
+
if (!startsWithNumber) {
|
|
86
|
+
errors.push(Validator.VALIDATION.STARTS_WITH_NUMBER);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (options.startsWithAlphabet) {
|
|
90
|
+
validations.push(Validator.VALIDATION.STARTS_WITH_ALPHABET);
|
|
91
|
+
if (!startsWithAlphabet) {
|
|
92
|
+
errors.push(Validator.VALIDATION.STARTS_WITH_ALPHABET);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (options.startsWithSpecialCharacter) {
|
|
96
|
+
validations.push(Validator.VALIDATION.STARTS_WITH_SPECIAL_CHARACTER);
|
|
97
|
+
if (!startsWithSpecialCharacter) {
|
|
98
|
+
errors.push(Validator.VALIDATION.STARTS_WITH_SPECIAL_CHARACTER);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
result: errors.length === 0,
|
|
103
|
+
validations: validations,
|
|
104
|
+
passes: validations.filter(function(e) {
|
|
105
|
+
return !errors.includes(e);
|
|
106
|
+
}),
|
|
107
|
+
errors: errors
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
]);
|
|
112
|
+
return Validator;
|
|
113
|
+
}();
|
|
114
|
+
(function(Validator2) {
|
|
115
|
+
(function(VALIDATION2) {
|
|
116
|
+
VALIDATION2["MIN_LENGTH"] = "MIN_LENGTH";
|
|
117
|
+
VALIDATION2["MAX_LENGTH"] = "MAX_LENGTH";
|
|
118
|
+
VALIDATION2["SPACE_MIN_COUNT"] = "SPACE_MIN_COUNT";
|
|
119
|
+
VALIDATION2["SPACE_MAX_COUNT"] = "SPACE_MAX_COUNT";
|
|
120
|
+
VALIDATION2["NUMBER_MIN_COUNT"] = "NUMBER_MIN_COUNT";
|
|
121
|
+
VALIDATION2["NUMBER_MAX_COUNT"] = "NUMBER_MAX_COUNT";
|
|
122
|
+
VALIDATION2["ALPHABET_MIN_COUNT"] = "ALPHABET_MIN_COUNT";
|
|
123
|
+
VALIDATION2["ALPHABET_MAX_COUNT"] = "ALPHABET_MAX_COUNT";
|
|
124
|
+
VALIDATION2["ALPHABET_LOWER_CASE_MIN_COUNT"] = "ALPHABET_LOWER_CASE_MIN_COUNT";
|
|
125
|
+
VALIDATION2["ALPHABET_LOWER_CASE_MAX_COUNT"] = "ALPHABET_LOWER_CASE_MAX_COUNT";
|
|
126
|
+
VALIDATION2["ALPHABET_UPPER_CASE_MIN_COUNT"] = "ALPHABET_UPPER_CASE_MIN_COUNT";
|
|
127
|
+
VALIDATION2["ALPHABET_UPPER_CASE_MAX_COUNT"] = "ALPHABET_UPPER_CASE_MAX_COUNT";
|
|
128
|
+
VALIDATION2["SPECIAL_CHARACTER_MIN_COUNT"] = "SPECIAL_CHARACTER_MIN_COUNT";
|
|
129
|
+
VALIDATION2["SPECIAL_CHARACTER_MAX_COUNT"] = "SPECIAL_CHARACTER_MAX_COUNT";
|
|
130
|
+
VALIDATION2["STARTS_WITH_ALPHABET"] = "STARTS_WITH_ALPHABET";
|
|
131
|
+
VALIDATION2["STARTS_WITH_NUMBER"] = "STARTS_WITH_NUMBER";
|
|
132
|
+
VALIDATION2["STARTS_WITH_SPECIAL_CHARACTER"] = "STARTS_WITH_SPECIAL_CHARACTER";
|
|
133
|
+
})(Validator2.VALIDATION || (Validator2.VALIDATION = {}));
|
|
134
|
+
})(Validator || (Validator = {}));
|
|
135
|
+
export { Validator };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
require('../../../chunk-ETV4XYOV.cjs');
|
|
3
|
+
var base64 = require('base-64');
|
|
4
|
+
function _interopDefault(e) {
|
|
5
|
+
return e && e.__esModule ? e : {
|
|
6
|
+
default: e
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
var base64__default = /*#__PURE__*/ _interopDefault(base64);
|
|
10
|
+
var decode = base64__default.default.decode;
|
|
11
|
+
var atob = decode;
|
|
12
|
+
exports.atob = atob;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
require('../../../chunk-ETV4XYOV.cjs');
|
|
3
|
+
var btoa = require('./btoa');
|
|
4
|
+
var atob = require('./atob');
|
|
5
|
+
function encodeBase64(str) {
|
|
6
|
+
var encoder = new TextEncoder();
|
|
7
|
+
var bytes = encoder.encode(str);
|
|
8
|
+
var binary = "";
|
|
9
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
10
|
+
try {
|
|
11
|
+
for(var _iterator = bytes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
12
|
+
var byte = _step.value;
|
|
13
|
+
binary += String.fromCharCode(byte);
|
|
14
|
+
}
|
|
15
|
+
} catch (err) {
|
|
16
|
+
_didIteratorError = true;
|
|
17
|
+
_iteratorError = err;
|
|
18
|
+
} finally{
|
|
19
|
+
try {
|
|
20
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
21
|
+
_iterator.return();
|
|
22
|
+
}
|
|
23
|
+
} finally{
|
|
24
|
+
if (_didIteratorError) {
|
|
25
|
+
throw _iteratorError;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return btoa.btoa(binary);
|
|
30
|
+
}
|
|
31
|
+
function decodeBase64(base64) {
|
|
32
|
+
var binary = atob.atob(base64);
|
|
33
|
+
var binaryLength = binary.length;
|
|
34
|
+
var bytes = new Uint8Array(binaryLength);
|
|
35
|
+
for(var i = 0; i < binaryLength; ++i){
|
|
36
|
+
bytes[i] = binary.charCodeAt(i);
|
|
37
|
+
}
|
|
38
|
+
var decoder = new TextDecoder("utf-8");
|
|
39
|
+
return decoder.decode(bytes);
|
|
40
|
+
}
|
|
41
|
+
exports.decodeBase64 = decodeBase64;
|
|
42
|
+
exports.encodeBase64 = encodeBase64;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import '../../../chunk-PKBMQBKP.js';
|
|
2
|
+
import { btoa } from './btoa';
|
|
3
|
+
import { atob } from './atob';
|
|
4
|
+
function encodeBase64(str) {
|
|
5
|
+
var encoder = new TextEncoder();
|
|
6
|
+
var bytes = encoder.encode(str);
|
|
7
|
+
var binary = "";
|
|
8
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
9
|
+
try {
|
|
10
|
+
for(var _iterator = bytes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
11
|
+
var byte = _step.value;
|
|
12
|
+
binary += String.fromCharCode(byte);
|
|
13
|
+
}
|
|
14
|
+
} catch (err) {
|
|
15
|
+
_didIteratorError = true;
|
|
16
|
+
_iteratorError = err;
|
|
17
|
+
} finally{
|
|
18
|
+
try {
|
|
19
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
20
|
+
_iterator.return();
|
|
21
|
+
}
|
|
22
|
+
} finally{
|
|
23
|
+
if (_didIteratorError) {
|
|
24
|
+
throw _iteratorError;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return btoa(binary);
|
|
29
|
+
}
|
|
30
|
+
function decodeBase64(base64) {
|
|
31
|
+
var binary = atob(base64);
|
|
32
|
+
var binaryLength = binary.length;
|
|
33
|
+
var bytes = new Uint8Array(binaryLength);
|
|
34
|
+
for(var i = 0; i < binaryLength; ++i){
|
|
35
|
+
bytes[i] = binary.charCodeAt(i);
|
|
36
|
+
}
|
|
37
|
+
var decoder = new TextDecoder("utf-8");
|
|
38
|
+
return decoder.decode(bytes);
|
|
39
|
+
}
|
|
40
|
+
export { decodeBase64, encodeBase64 };
|