@powfix/core-js 0.18.2 → 0.19.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/cjs/browser/utils/UUID.js +95 -30
- package/dist/browser/cjs/shared/managers/SessionManager.js +0 -10
- package/dist/browser/cjs/shared/services/time/TimeService.js +0 -16
- package/dist/browser/cjs/shared/utils/ArrayUtils.js +0 -5
- package/dist/browser/cjs/shared/utils/AxiosUtils.js +0 -2
- package/dist/browser/cjs/shared/utils/Calc.js +1 -1
- package/dist/browser/cjs/shared/utils/DateUtils.js +0 -1
- package/dist/browser/cjs/shared/utils/Enum.js +36 -0
- package/dist/browser/cjs/shared/utils/Enum.types.js +2 -0
- package/dist/browser/cjs/shared/utils/JuminNumberUtils.js +1 -4
- package/dist/browser/cjs/shared/utils/Sequencer.js +0 -6
- package/dist/browser/cjs/shared/utils/StringUtils.js +1 -3
- package/dist/browser/cjs/shared/utils/UuidUtils.js +0 -3
- package/dist/browser/cjs/shared/utils/Validator.js +0 -11
- package/dist/browser/cjs/shared/utils/global/firstNonNullish.js +0 -1
- package/dist/browser/cjs/shared/utils/global/flat.js +0 -1
- package/dist/browser/cjs/shared/utils/index.js +2 -0
- package/dist/browser/cjs/shared/utils/try-catch/TryCatch.js +0 -20
- package/dist/browser/esm/browser/utils/UUID.mjs +94 -29
- package/dist/browser/esm/shared/managers/SessionManager.mjs +0 -10
- package/dist/browser/esm/shared/services/time/TimeService.mjs +0 -16
- package/dist/browser/esm/shared/utils/ArrayUtils.mjs +0 -5
- package/dist/browser/esm/shared/utils/AxiosUtils.mjs +0 -2
- package/dist/browser/esm/shared/utils/Calc.mjs +1 -1
- package/dist/browser/esm/shared/utils/DateUtils.mjs +0 -1
- package/dist/browser/esm/shared/utils/Enum.mjs +32 -0
- package/dist/browser/esm/shared/utils/Enum.types.mjs +1 -0
- package/dist/browser/esm/shared/utils/JuminNumberUtils.mjs +1 -4
- package/dist/browser/esm/shared/utils/Sequencer.mjs +0 -6
- package/dist/browser/esm/shared/utils/StringUtils.mjs +1 -3
- package/dist/browser/esm/shared/utils/UuidUtils.mjs +0 -3
- package/dist/browser/esm/shared/utils/Validator.mjs +0 -11
- package/dist/browser/esm/shared/utils/global/firstNonNullish.mjs +0 -1
- package/dist/browser/esm/shared/utils/global/flat.mjs +0 -1
- package/dist/browser/esm/shared/utils/index.mjs +2 -0
- package/dist/browser/esm/shared/utils/try-catch/TryCatch.mjs +0 -20
- package/dist/browser/types/browser/utils/UUID.d.ts +14 -2
- package/dist/browser/types/shared/utils/ArrayUtils.d.ts +0 -5
- package/dist/browser/types/shared/utils/Enum.d.ts +16 -0
- package/dist/browser/types/shared/utils/Enum.types.d.ts +6 -0
- package/dist/browser/types/shared/utils/UuidUtils.d.ts +0 -6
- package/dist/browser/types/shared/utils/index.d.ts +2 -0
- package/dist/browser/types/shared/utils/try-catch/TryCatch.d.ts +0 -20
- package/dist/node/cjs/browser/utils/UUID.js +95 -30
- package/dist/node/cjs/nodejs/managers/TransactionManager.js +0 -3
- package/dist/node/cjs/nodejs/services/redis/RedisClient.js +0 -2
- package/dist/node/cjs/nodejs/services/redis/RedisPublisher.js +0 -1
- package/dist/node/cjs/nodejs/services/redis/index.js +0 -1
- package/dist/node/cjs/nodejs/utils/UUID.js +3 -0
- package/dist/node/cjs/shared/managers/SessionManager.js +0 -10
- package/dist/node/cjs/shared/services/time/TimeService.js +0 -16
- package/dist/node/cjs/shared/utils/ArrayUtils.js +0 -5
- package/dist/node/cjs/shared/utils/AxiosUtils.js +0 -2
- package/dist/node/cjs/shared/utils/Calc.js +1 -1
- package/dist/node/cjs/shared/utils/DateUtils.js +0 -1
- package/dist/node/cjs/shared/utils/Enum.js +36 -0
- package/dist/node/cjs/shared/utils/Enum.types.js +2 -0
- package/dist/node/cjs/shared/utils/JuminNumberUtils.js +1 -4
- package/dist/node/cjs/shared/utils/Sequencer.js +0 -6
- package/dist/node/cjs/shared/utils/StringUtils.js +1 -3
- package/dist/node/cjs/shared/utils/UuidUtils.js +0 -3
- package/dist/node/cjs/shared/utils/Validator.js +0 -11
- package/dist/node/cjs/shared/utils/global/firstNonNullish.js +0 -1
- package/dist/node/cjs/shared/utils/global/flat.js +0 -1
- package/dist/node/cjs/shared/utils/index.js +2 -0
- package/dist/node/cjs/shared/utils/try-catch/TryCatch.js +0 -20
- package/dist/node/esm/browser/utils/UUID.mjs +94 -29
- package/dist/node/esm/nodejs/managers/TransactionManager.mjs +0 -3
- package/dist/node/esm/nodejs/services/redis/RedisClient.mjs +0 -2
- package/dist/node/esm/nodejs/services/redis/RedisPublisher.mjs +0 -1
- package/dist/node/esm/nodejs/services/redis/index.mjs +0 -1
- package/dist/node/esm/nodejs/utils/UUID.mjs +3 -0
- package/dist/node/esm/shared/managers/SessionManager.mjs +0 -10
- package/dist/node/esm/shared/services/time/TimeService.mjs +0 -16
- package/dist/node/esm/shared/utils/ArrayUtils.mjs +0 -5
- package/dist/node/esm/shared/utils/AxiosUtils.mjs +0 -2
- package/dist/node/esm/shared/utils/Calc.mjs +1 -1
- package/dist/node/esm/shared/utils/DateUtils.mjs +0 -1
- package/dist/node/esm/shared/utils/Enum.mjs +32 -0
- package/dist/node/esm/shared/utils/Enum.types.mjs +1 -0
- package/dist/node/esm/shared/utils/JuminNumberUtils.mjs +1 -4
- package/dist/node/esm/shared/utils/Sequencer.mjs +0 -6
- package/dist/node/esm/shared/utils/StringUtils.mjs +1 -3
- package/dist/node/esm/shared/utils/UuidUtils.mjs +0 -3
- package/dist/node/esm/shared/utils/Validator.mjs +0 -11
- package/dist/node/esm/shared/utils/global/firstNonNullish.mjs +0 -1
- package/dist/node/esm/shared/utils/global/flat.mjs +0 -1
- package/dist/node/esm/shared/utils/index.mjs +2 -0
- package/dist/node/esm/shared/utils/try-catch/TryCatch.mjs +0 -20
- package/dist/node/types/browser/utils/UUID.d.ts +14 -2
- package/dist/node/types/nodejs/services/redis/RedisClient.d.ts +2 -2
- package/dist/node/types/nodejs/utils/UUID.d.ts +1 -0
- package/dist/node/types/shared/utils/ArrayUtils.d.ts +0 -5
- package/dist/node/types/shared/utils/Enum.d.ts +16 -0
- package/dist/node/types/shared/utils/Enum.types.d.ts +6 -0
- package/dist/node/types/shared/utils/UuidUtils.d.ts +0 -6
- package/dist/node/types/shared/utils/index.d.ts +2 -0
- package/dist/node/types/shared/utils/try-catch/TryCatch.d.ts +0 -20
- package/package.json +2 -2
|
@@ -7,19 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
/**
|
|
11
|
-
* Provides a utility class for handling synchronous and asynchronous operations with a consistent try-catch pattern.
|
|
12
|
-
* 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).
|
|
13
|
-
*/
|
|
14
10
|
export class TryCatch {
|
|
15
|
-
/**
|
|
16
|
-
* Executes a synchronous function within a try-catch block.
|
|
17
|
-
* @template T The return type of the function.
|
|
18
|
-
* @template E The type of the error that might be thrown (defaults to Error).
|
|
19
|
-
* @param fn The synchronous function to execute.
|
|
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 result of the function and an error (null if successful).
|
|
22
|
-
*/
|
|
23
11
|
static function(fn, disableLogging) {
|
|
24
12
|
try {
|
|
25
13
|
return [
|
|
@@ -40,14 +28,6 @@ export class TryCatch {
|
|
|
40
28
|
];
|
|
41
29
|
}
|
|
42
30
|
}
|
|
43
|
-
/**
|
|
44
|
-
* Executes an asynchronous function (Promise) within a try-catch block.
|
|
45
|
-
* @template T The resolved value type of the Promise.
|
|
46
|
-
* @template E The type of the error that might be rejected (defaults to Error).
|
|
47
|
-
* @param fn The Promise to await.
|
|
48
|
-
* @param disableLogging console.error is default way of logging on error. You can disable it by setting it true
|
|
49
|
-
* @returns A tuple containing the resolved value of the Promise and an error (null if successful).
|
|
50
|
-
*/
|
|
51
31
|
static asyncFunction(fn, disableLogging) {
|
|
52
32
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53
33
|
try {
|
|
@@ -1,16 +1,28 @@
|
|
|
1
1
|
export declare class UUID {
|
|
2
|
+
private static REGEX_HEX;
|
|
3
|
+
private static REGEX_RFC4122;
|
|
2
4
|
private static BYTE_LENGTH;
|
|
5
|
+
private static STR_LENGTH;
|
|
3
6
|
private static HEX_STR_LENGTH;
|
|
7
|
+
static isValidHex(hex: string): boolean;
|
|
8
|
+
static isValidString(str: string): boolean;
|
|
9
|
+
static isValidBytes(bytes: ArrayBufferView): boolean;
|
|
10
|
+
static isValid(input: string | ArrayBufferView): boolean;
|
|
4
11
|
private static formatHex;
|
|
5
12
|
private static stripHyphens;
|
|
13
|
+
private static parseHex;
|
|
6
14
|
private static parseString;
|
|
7
|
-
static fromString(str: string): UUID;
|
|
8
15
|
private static parseBytes;
|
|
16
|
+
static fromHex(hex: string): UUID;
|
|
17
|
+
static fromString(str: string): UUID;
|
|
9
18
|
static fromBytes(bytes: ArrayBufferView): UUID;
|
|
19
|
+
private static parse;
|
|
20
|
+
static from(input: string | ArrayBufferView): UUID;
|
|
10
21
|
static nil(): UUID;
|
|
22
|
+
static max(): UUID;
|
|
11
23
|
static equals(...uuids: UUID[]): boolean;
|
|
12
24
|
static compare(uuid1: UUID, uuid2: UUID): number;
|
|
13
|
-
|
|
25
|
+
protected readonly bytes: Uint8Array;
|
|
14
26
|
private _str?;
|
|
15
27
|
private _hex?;
|
|
16
28
|
constructor(input: string | ArrayBufferView);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import redis, {
|
|
1
|
+
import redis, { createClient } from 'redis';
|
|
2
2
|
export declare class RedisClient {
|
|
3
3
|
private readonly options;
|
|
4
4
|
private status;
|
|
5
|
-
readonly client:
|
|
5
|
+
readonly client: ReturnType<typeof createClient>;
|
|
6
6
|
constructor(options?: RedisClient.RedisClientOptions);
|
|
7
7
|
getStatus(): RedisClient.Status;
|
|
8
8
|
start(): Promise<RedisClient.Status>;
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
export declare class ArrayUtils {
|
|
2
2
|
static castArray<T>(value: T | T[]): T[];
|
|
3
|
-
/**
|
|
4
|
-
* 객체를 요소로 가지는 배열에서 가장 큰 값(Property)를 가지는 객체를 반환한다
|
|
5
|
-
* @param e 객체 배열
|
|
6
|
-
* @param key 값을 비교할 Property 키
|
|
7
|
-
*/
|
|
8
3
|
static getGreatestObject(e: any[], key: string): any;
|
|
9
4
|
static removeDuplicate<T>(arr: T[]): T[];
|
|
10
5
|
static removeObjectDuplicate(arr: any[], key: string): any[];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { EnumEntries } from "./Enum.types";
|
|
2
|
+
export declare class Enum<E extends object> {
|
|
3
|
+
static entries<E extends object>(e: E): EnumEntries<E>;
|
|
4
|
+
static keys<E extends object>(e: E): ({ [K in keyof E]: E[K] extends Function ? never : K; }[keyof E] extends infer R ? R extends never ? never : R : never)[];
|
|
5
|
+
static values<E extends object>(e: E): ({ [K in keyof E]: E[K] extends Function ? never : E[K]; }[keyof E] extends infer R ? R extends never ? never : R : never)[];
|
|
6
|
+
static from<E extends object>(e: E): Enum<E>;
|
|
7
|
+
private readonly _e;
|
|
8
|
+
private readonly _entries;
|
|
9
|
+
private readonly _keys;
|
|
10
|
+
private readonly _values;
|
|
11
|
+
constructor(e: E);
|
|
12
|
+
value(): E;
|
|
13
|
+
entries(): EnumEntries<E>;
|
|
14
|
+
keys(): ({ [K in keyof E]: E[K] extends Function ? never : K; }[keyof E] extends infer R ? R extends never ? never : R : never)[];
|
|
15
|
+
values(): ({ [K in keyof E]: E[K] extends Function ? never : E[K]; }[keyof E] extends infer R ? R extends never ? never : R : never)[];
|
|
16
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
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
|
+
export type EnumEntry<E extends object> = [NonFunction<E, "keys">, NonFunction<E, "values">];
|
|
5
|
+
export type EnumEntries<E extends object> = EnumEntry<E>[];
|
|
6
|
+
export {};
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
export declare class UuidUtils {
|
|
2
2
|
static v4(): string;
|
|
3
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
4
|
static toString(binary: Uint8Array): string;
|
|
10
|
-
/** (UUID: string) to (UUID: Buffer) */
|
|
11
5
|
static toBuffer(uuid: string): Buffer;
|
|
12
6
|
static toBuffer(uuid: string | null | undefined): Buffer | null;
|
|
13
7
|
static isValidUUID(uuid: string): boolean;
|
|
@@ -8,6 +8,8 @@ export * from './BooleanUtils';
|
|
|
8
8
|
export * from './Calc';
|
|
9
9
|
export * from './CoordinateUtils';
|
|
10
10
|
export * from './DateUtils';
|
|
11
|
+
export * from './Enum';
|
|
12
|
+
export * from './Enum.types';
|
|
11
13
|
export * from './I18nUtils';
|
|
12
14
|
export * from './NumberUtils';
|
|
13
15
|
export * from './ObjectIdUtils';
|
|
@@ -1,24 +1,4 @@
|
|
|
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
1
|
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
2
|
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
3
|
static asyncFunction<T, E = Error>(fn: Promise<T>, disableLogging?: boolean): Promise<readonly [null, Awaited<T>] | readonly [E, undefined]>;
|
|
24
4
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powfix/core-js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"description": "core package",
|
|
5
5
|
"author": "Kwon Kyung-Min <powfix@gmail.com>",
|
|
6
6
|
"private": false,
|
|
@@ -49,7 +49,6 @@
|
|
|
49
49
|
"base-64": "^1.0.0",
|
|
50
50
|
"eventemitter3": "^5.0.1",
|
|
51
51
|
"jwt-decode": "^4.0.0",
|
|
52
|
-
"redis": "4.7.0",
|
|
53
52
|
"uuid": "9.0.1"
|
|
54
53
|
},
|
|
55
54
|
"devDependencies": {
|
|
@@ -60,6 +59,7 @@
|
|
|
60
59
|
"deepmerge": "^4.3.1",
|
|
61
60
|
"i18next": "25.4.2",
|
|
62
61
|
"moment": "^2.30.1",
|
|
62
|
+
"redis": "^5.8.2",
|
|
63
63
|
"sequelize": "6.37.7",
|
|
64
64
|
"sequelize-typescript": "^2.1.6",
|
|
65
65
|
"ts-node": "^10.9.2",
|