@hamjimin/xplat-back 0.1.0 → 0.3.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.
Files changed (76) hide show
  1. package/README.md +0 -1
  2. package/dist/cli/init.js +36 -0
  3. package/dist/cli/templates/api_code.ts.example +70 -0
  4. package/dist/cli/templates/constants.ts.example +113 -0
  5. package/dist/core/XplatSystem.d.ts +44 -0
  6. package/dist/core/XplatSystem.js +55 -0
  7. package/dist/index.d.ts +22 -3
  8. package/dist/index.js +40 -7
  9. package/dist/modules/app/app-factory.d.ts +12 -0
  10. package/dist/modules/app/app-factory.js +125 -0
  11. package/dist/modules/app/index.d.ts +11 -0
  12. package/dist/modules/app/index.js +16 -0
  13. package/dist/modules/auth/index.d.ts +36 -0
  14. package/dist/modules/auth/index.js +61 -0
  15. package/dist/modules/auth/jwt.d.ts +40 -0
  16. package/dist/modules/auth/jwt.js +49 -0
  17. package/dist/modules/auth/middleware.d.ts +20 -0
  18. package/dist/modules/auth/middleware.js +88 -0
  19. package/dist/modules/constants/api-code.d.ts +15 -0
  20. package/dist/modules/constants/api-code.js +50 -0
  21. package/dist/modules/constants/index.d.ts +30 -0
  22. package/dist/modules/constants/index.js +46 -0
  23. package/dist/modules/middleware/error-handler.d.ts +9 -0
  24. package/dist/modules/middleware/error-handler.js +31 -0
  25. package/dist/modules/middleware/index.d.ts +30 -0
  26. package/dist/modules/middleware/index.js +48 -0
  27. package/dist/modules/middleware/logger.d.ts +11 -0
  28. package/dist/modules/middleware/logger.js +43 -0
  29. package/dist/modules/middleware/validator.d.ts +13 -0
  30. package/dist/modules/middleware/validator.js +81 -0
  31. package/dist/modules/orm/index.d.ts +30 -0
  32. package/dist/modules/orm/index.js +46 -0
  33. package/dist/modules/orm/query-builder.d.ts +68 -0
  34. package/dist/modules/orm/query-builder.js +238 -0
  35. package/dist/modules/payment/index.d.ts +43 -0
  36. package/dist/modules/payment/index.js +92 -0
  37. package/dist/modules/payment/providers/kakaopay.d.ts +17 -0
  38. package/dist/modules/payment/providers/kakaopay.js +51 -0
  39. package/dist/modules/payment/providers/toss.d.ts +15 -0
  40. package/dist/modules/payment/providers/toss.js +54 -0
  41. package/dist/modules/payment/types.d.ts +46 -0
  42. package/dist/modules/payment/types.js +2 -0
  43. package/dist/modules/router/index.d.ts +10 -0
  44. package/dist/modules/router/index.js +16 -0
  45. package/dist/modules/router/route-factory.d.ts +10 -0
  46. package/dist/modules/router/route-factory.js +72 -0
  47. package/dist/modules/shipping/index.d.ts +19 -0
  48. package/dist/modules/shipping/index.js +66 -0
  49. package/dist/modules/shipping/providers/cj.d.ts +14 -0
  50. package/dist/modules/shipping/providers/cj.js +35 -0
  51. package/dist/modules/shipping/providers/cvs.d.ts +14 -0
  52. package/dist/modules/shipping/providers/cvs.js +35 -0
  53. package/dist/modules/shipping/providers/logen.d.ts +13 -0
  54. package/dist/modules/shipping/providers/logen.js +35 -0
  55. package/dist/modules/shipping/types.d.ts +54 -0
  56. package/dist/modules/shipping/types.js +2 -0
  57. package/dist/modules/storage/index.d.ts +81 -0
  58. package/dist/modules/storage/index.js +86 -0
  59. package/dist/modules/storage/s3.d.ts +80 -0
  60. package/dist/modules/storage/s3.js +133 -0
  61. package/dist/modules/utils/date.d.ts +37 -0
  62. package/dist/modules/utils/date.js +72 -0
  63. package/dist/modules/utils/index.d.ts +44 -0
  64. package/dist/modules/utils/index.js +139 -0
  65. package/dist/modules/utils/lodash.d.ts +107 -0
  66. package/dist/modules/utils/lodash.js +154 -0
  67. package/dist/modules/utils/password.d.ts +31 -0
  68. package/dist/modules/utils/password.js +102 -0
  69. package/dist/modules/utils/pk.d.ts +18 -0
  70. package/dist/modules/utils/pk.js +41 -0
  71. package/dist/modules/utils/response.d.ts +20 -0
  72. package/dist/modules/utils/response.js +87 -0
  73. package/dist/modules/utils/validation.d.ts +50 -0
  74. package/dist/modules/utils/validation.js +90 -0
  75. package/dist/types/index.d.ts +26 -0
  76. package/package.json +14 -2
@@ -0,0 +1,80 @@
1
+ import { S3Client } from '@aws-sdk/client-s3';
2
+ /**
3
+ * S3 스토리지 유틸리티
4
+ *
5
+ * zium-backend의 util/s3.ts를 기반으로 작성되었습니다.
6
+ */
7
+ export interface S3Config {
8
+ region?: string;
9
+ bucket?: string;
10
+ accessKeyId?: string;
11
+ secretAccessKey?: string;
12
+ }
13
+ /**
14
+ * 날짜 기반 접두사 생성 (YYYY/MM/DD)
15
+ */
16
+ export declare function getDatePrefix(d?: Date): string;
17
+ /**
18
+ * S3 키 생성
19
+ */
20
+ export declare function buildS3Key(basePrefix: string, fileName: string, d?: Date): string;
21
+ /**
22
+ * S3 클라이언트 생성
23
+ */
24
+ export declare function createS3Client(config?: S3Config): S3Client;
25
+ /**
26
+ * S3 객체 가져오기
27
+ */
28
+ export declare function getObject(s3Client: S3Client, params: {
29
+ key: string;
30
+ bucket: string;
31
+ downloadFileName?: string;
32
+ }): Promise<import("@aws-sdk/client-s3").GetObjectCommandOutput>;
33
+ /**
34
+ * PDF 버퍼 업로드
35
+ */
36
+ export declare function uploadPdfBuffer(s3Client: S3Client, params: {
37
+ basePrefix: string;
38
+ fileName: string;
39
+ body: Buffer;
40
+ bucket: string;
41
+ }): Promise<{
42
+ bucket: string;
43
+ key: string;
44
+ }>;
45
+ /**
46
+ * 일반 파일 업로드
47
+ */
48
+ export declare function uploadFile(s3Client: S3Client, params: {
49
+ key: string;
50
+ body: Buffer | string;
51
+ bucket: string;
52
+ contentType?: string;
53
+ }): Promise<{
54
+ bucket: string;
55
+ key: string;
56
+ }>;
57
+ /**
58
+ * Presigned 다운로드 URL 생성
59
+ */
60
+ export declare function getPresignedDownloadUrl(s3Client: S3Client, params: {
61
+ key: string;
62
+ bucket: string;
63
+ expiresInSec?: number;
64
+ downloadFileName?: string;
65
+ }): Promise<string>;
66
+ /**
67
+ * S3 객체 삭제
68
+ */
69
+ export declare function deleteObjectByKey(s3Client: S3Client, params: {
70
+ key: string;
71
+ bucket: string;
72
+ }): Promise<void>;
73
+ /**
74
+ * URL에서 S3 키 추출
75
+ */
76
+ export declare function extractKeyFromUrl(urlOrKey: string, bucket: string): string;
77
+ /**
78
+ * S3 객체 URL 생성
79
+ */
80
+ export declare function buildObjectUrl(key: string, bucket: string, region?: string): string;
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDatePrefix = getDatePrefix;
4
+ exports.buildS3Key = buildS3Key;
5
+ exports.createS3Client = createS3Client;
6
+ exports.getObject = getObject;
7
+ exports.uploadPdfBuffer = uploadPdfBuffer;
8
+ exports.uploadFile = uploadFile;
9
+ exports.getPresignedDownloadUrl = getPresignedDownloadUrl;
10
+ exports.deleteObjectByKey = deleteObjectByKey;
11
+ exports.extractKeyFromUrl = extractKeyFromUrl;
12
+ exports.buildObjectUrl = buildObjectUrl;
13
+ const client_s3_1 = require("@aws-sdk/client-s3");
14
+ const s3_request_presigner_1 = require("@aws-sdk/s3-request-presigner");
15
+ /**
16
+ * 날짜 기반 접두사 생성 (YYYY/MM/DD)
17
+ */
18
+ function getDatePrefix(d = new Date()) {
19
+ const yyyy = d.getFullYear();
20
+ const mm = String(d.getMonth() + 1).padStart(2, '0');
21
+ const dd = String(d.getDate()).padStart(2, '0');
22
+ return `${yyyy}/${mm}/${dd}`;
23
+ }
24
+ /**
25
+ * S3 키 생성
26
+ */
27
+ function buildS3Key(basePrefix, fileName, d = new Date()) {
28
+ return `${basePrefix}/${getDatePrefix(d)}/${fileName}`;
29
+ }
30
+ /**
31
+ * S3 클라이언트 생성
32
+ */
33
+ function createS3Client(config = {}) {
34
+ const region = config.region || process.env.AWS_REGION || 'ap-northeast-2';
35
+ const accessKeyId = config.accessKeyId || process.env.S3_ACCESS_KEY || '';
36
+ const secretAccessKey = config.secretAccessKey || process.env.S3_SECRET_KEY || '';
37
+ return new client_s3_1.S3Client({
38
+ region,
39
+ credentials: {
40
+ accessKeyId,
41
+ secretAccessKey,
42
+ },
43
+ });
44
+ }
45
+ /**
46
+ * S3 객체 가져오기
47
+ */
48
+ async function getObject(s3Client, params) {
49
+ const command = new client_s3_1.GetObjectCommand({
50
+ Bucket: params.bucket,
51
+ Key: params.key,
52
+ });
53
+ return await s3Client.send(command);
54
+ }
55
+ /**
56
+ * PDF 버퍼 업로드
57
+ */
58
+ async function uploadPdfBuffer(s3Client, params) {
59
+ const key = buildS3Key(params.basePrefix, params.fileName);
60
+ await s3Client.send(new client_s3_1.PutObjectCommand({
61
+ Bucket: params.bucket,
62
+ Key: key,
63
+ Body: params.body,
64
+ ContentType: 'application/pdf',
65
+ }));
66
+ return { bucket: params.bucket, key };
67
+ }
68
+ /**
69
+ * 일반 파일 업로드
70
+ */
71
+ async function uploadFile(s3Client, params) {
72
+ await s3Client.send(new client_s3_1.PutObjectCommand({
73
+ Bucket: params.bucket,
74
+ Key: params.key,
75
+ Body: params.body,
76
+ ContentType: params.contentType || 'application/octet-stream',
77
+ }));
78
+ return { bucket: params.bucket, key: params.key };
79
+ }
80
+ /**
81
+ * Presigned 다운로드 URL 생성
82
+ */
83
+ async function getPresignedDownloadUrl(s3Client, params) {
84
+ const command = new client_s3_1.GetObjectCommand({
85
+ Bucket: params.bucket,
86
+ Key: params.key,
87
+ ResponseContentType: 'application/pdf',
88
+ ResponseContentDisposition: params.downloadFileName
89
+ ? `attachment; filename="${params.downloadFileName}"`
90
+ : 'attachment',
91
+ });
92
+ const url = await (0, s3_request_presigner_1.getSignedUrl)(s3Client, command, {
93
+ expiresIn: params.expiresInSec || 3600,
94
+ });
95
+ return url;
96
+ }
97
+ /**
98
+ * S3 객체 삭제
99
+ */
100
+ async function deleteObjectByKey(s3Client, params) {
101
+ await s3Client.send(new client_s3_1.DeleteObjectCommand({
102
+ Bucket: params.bucket,
103
+ Key: params.key,
104
+ }));
105
+ }
106
+ /**
107
+ * URL에서 S3 키 추출
108
+ */
109
+ function extractKeyFromUrl(urlOrKey, bucket) {
110
+ if (!/^https?:\/\//i.test(urlOrKey)) {
111
+ return urlOrKey.replace(/^\//, '');
112
+ }
113
+ try {
114
+ const u = new URL(urlOrKey);
115
+ let p = u.pathname || '';
116
+ if (p.startsWith('/'))
117
+ p = p.slice(1);
118
+ if (p.startsWith(`${bucket}/`)) {
119
+ p = p.slice(bucket.length + 1);
120
+ }
121
+ return p;
122
+ }
123
+ catch (_) {
124
+ return urlOrKey;
125
+ }
126
+ }
127
+ /**
128
+ * S3 객체 URL 생성
129
+ */
130
+ function buildObjectUrl(key, bucket, region) {
131
+ const r = region || process.env.AWS_REGION || 'ap-northeast-2';
132
+ return `https://${bucket}.s3.${r}.amazonaws.com/${key}`;
133
+ }
@@ -0,0 +1,37 @@
1
+ /**
2
+ * 날짜/시간 유틸리티
3
+ *
4
+ * zium-backend의 commonUtil.ts를 기반으로 작성되었습니다.
5
+ */
6
+ /**
7
+ * UTC를 한국 시간(KST) 문자열로 변환
8
+ * @param date Date 객체
9
+ * @returns "YYYY-MM-DD HH:mm:ss" 형식의 문자열
10
+ */
11
+ export declare function convertUTCtoKST(date: Date): string;
12
+ /**
13
+ * 한국 시간 문자열을 Date 객체로 변환
14
+ * @param dateStr "2024-01-15"
15
+ * @param timeStr "14:30"
16
+ * @returns Date 객체 (한국 시간 기준)
17
+ */
18
+ export declare function convertKSTtoDate(dateStr: string, timeStr: string): Date;
19
+ /**
20
+ * 한국 시간 Date 객체 생성
21
+ * @param dateStr "2024-01-15"
22
+ * @param timeStr "14:30"
23
+ * @returns Date 객체 (한국 시간으로 설정됨)
24
+ */
25
+ export declare function createKoreaDate(dateStr: string, timeStr: string): Date;
26
+ /**
27
+ * 현재 한국 시간 반환
28
+ * @returns Date 객체
29
+ */
30
+ export declare function getCurrentKoreaTime(): Date;
31
+ /**
32
+ * Date 객체를 한국 시간 문자열로 변환
33
+ * @param date Date 객체
34
+ * @param format "datetime" | "date" | "time"
35
+ * @returns 포맷된 한국 시간 문자열
36
+ */
37
+ export declare function formatKoreaTime(date: Date, format?: 'datetime' | 'date' | 'time'): string;
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ /**
3
+ * 날짜/시간 유틸리티
4
+ *
5
+ * zium-backend의 commonUtil.ts를 기반으로 작성되었습니다.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.convertUTCtoKST = convertUTCtoKST;
9
+ exports.convertKSTtoDate = convertKSTtoDate;
10
+ exports.createKoreaDate = createKoreaDate;
11
+ exports.getCurrentKoreaTime = getCurrentKoreaTime;
12
+ exports.formatKoreaTime = formatKoreaTime;
13
+ /**
14
+ * UTC를 한국 시간(KST) 문자열로 변환
15
+ * @param date Date 객체
16
+ * @returns "YYYY-MM-DD HH:mm:ss" 형식의 문자열
17
+ */
18
+ function convertUTCtoKST(date) {
19
+ if (!(date instanceof Date) || isNaN(date.getTime()))
20
+ return '';
21
+ const kstDate = new Date(date.getTime() + 9 * 60 * 60 * 1000);
22
+ return kstDate.toISOString().replace('T', ' ').substring(0, 19);
23
+ }
24
+ /**
25
+ * 한국 시간 문자열을 Date 객체로 변환
26
+ * @param dateStr "2024-01-15"
27
+ * @param timeStr "14:30"
28
+ * @returns Date 객체 (한국 시간 기준)
29
+ */
30
+ function convertKSTtoDate(dateStr, timeStr) {
31
+ const combined = `${dateStr} ${timeStr}:00`;
32
+ const koreaTime = new Date(combined);
33
+ // 한국 시간을 UTC로 변환 (9시간 빼기)
34
+ return new Date(koreaTime.getTime() - 9 * 60 * 60 * 1000);
35
+ }
36
+ /**
37
+ * 한국 시간 Date 객체 생성
38
+ * @param dateStr "2024-01-15"
39
+ * @param timeStr "14:30"
40
+ * @returns Date 객체 (한국 시간으로 설정됨)
41
+ */
42
+ function createKoreaDate(dateStr, timeStr) {
43
+ const [year, month, day] = dateStr.split('-').map(Number);
44
+ const [hours, minutes] = timeStr.split(':').map(Number);
45
+ // UTC 기준으로 생성하여 formatKoreaTime과 호환
46
+ return new Date(Date.UTC(year, month - 1, day, hours, minutes, 0, 0));
47
+ }
48
+ /**
49
+ * 현재 한국 시간 반환
50
+ * @returns Date 객체
51
+ */
52
+ function getCurrentKoreaTime() {
53
+ return new Date();
54
+ }
55
+ /**
56
+ * Date 객체를 한국 시간 문자열로 변환
57
+ * @param date Date 객체
58
+ * @param format "datetime" | "date" | "time"
59
+ * @returns 포맷된 한국 시간 문자열
60
+ */
61
+ function formatKoreaTime(date, format = 'datetime') {
62
+ const kstString = convertUTCtoKST(date);
63
+ switch (format) {
64
+ case 'date':
65
+ return kstString.split(' ')[0]; // "2024-01-15"
66
+ case 'time':
67
+ return kstString.split(' ')[1]; // "14:30:00"
68
+ case 'datetime':
69
+ default:
70
+ return kstString; // "2024-01-15 14:30:00"
71
+ }
72
+ }
@@ -0,0 +1,44 @@
1
+ import { LodashUtils } from './lodash';
2
+ /**
3
+ * UtilsModule - 공통 유틸리티 모듈
4
+ */
5
+ export declare class UtilsModule {
6
+ readonly date: DateUtils;
7
+ readonly password: PasswordUtils;
8
+ readonly response: ResponseUtils;
9
+ readonly validation: ValidationUtils;
10
+ readonly pk: PKUtils;
11
+ readonly lodash: LodashUtils;
12
+ constructor();
13
+ }
14
+ export declare class DateUtils {
15
+ convertUTCtoKST(date: Date): string;
16
+ convertKSTtoDate(dateStr: string, timeStr: string): Date;
17
+ createKoreaDate(dateStr: string, timeStr: string): Date;
18
+ getCurrentKoreaTime(): Date;
19
+ formatKoreaTime(date: Date, format?: 'datetime' | 'date' | 'time'): string;
20
+ }
21
+ export declare class PasswordUtils {
22
+ bcrypt(password: string): Promise<string>;
23
+ check(password: string, hash: string): Promise<boolean>;
24
+ crypto(password: string): Promise<string | null>;
25
+ decrypt(encryptedPassword: string): string | null;
26
+ generate(length?: number): string;
27
+ }
28
+ export declare class ResponseUtils {
29
+ success(data: any): any;
30
+ error(code: number, message?: string): any;
31
+ safeResponse(data: any): any;
32
+ }
33
+ export declare class ValidationUtils {
34
+ isEmail(email: string): boolean;
35
+ isPassword(password: string, options?: any): boolean;
36
+ isPhone(phone: string): boolean;
37
+ isNotEmpty(str: string): boolean;
38
+ isNumber(value: any): boolean;
39
+ isURL(url: string): boolean;
40
+ }
41
+ export declare class PKUtils {
42
+ make(convertStr?: string): Promise<string>;
43
+ makeWithLength(length: number, prefix?: string): Promise<string>;
44
+ }
@@ -0,0 +1,139 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.PKUtils = exports.ValidationUtils = exports.ResponseUtils = exports.PasswordUtils = exports.DateUtils = exports.UtilsModule = void 0;
37
+ const dateUtils = __importStar(require("./date"));
38
+ const passwordUtils = __importStar(require("./password"));
39
+ const responseUtils = __importStar(require("./response"));
40
+ const validationUtils = __importStar(require("./validation"));
41
+ const pkUtils = __importStar(require("./pk"));
42
+ const lodash_1 = require("./lodash");
43
+ /**
44
+ * UtilsModule - 공통 유틸리티 모듈
45
+ */
46
+ class UtilsModule {
47
+ constructor() {
48
+ this.date = new DateUtils();
49
+ this.password = new PasswordUtils();
50
+ this.response = new ResponseUtils();
51
+ this.validation = new ValidationUtils();
52
+ this.pk = new PKUtils();
53
+ this.lodash = new lodash_1.LodashUtils();
54
+ }
55
+ }
56
+ exports.UtilsModule = UtilsModule;
57
+ // 날짜 유틸리티 클래스
58
+ class DateUtils {
59
+ convertUTCtoKST(date) {
60
+ return dateUtils.convertUTCtoKST(date);
61
+ }
62
+ convertKSTtoDate(dateStr, timeStr) {
63
+ return dateUtils.convertKSTtoDate(dateStr, timeStr);
64
+ }
65
+ createKoreaDate(dateStr, timeStr) {
66
+ return dateUtils.createKoreaDate(dateStr, timeStr);
67
+ }
68
+ getCurrentKoreaTime() {
69
+ return dateUtils.getCurrentKoreaTime();
70
+ }
71
+ formatKoreaTime(date, format = 'datetime') {
72
+ return dateUtils.formatKoreaTime(date, format);
73
+ }
74
+ }
75
+ exports.DateUtils = DateUtils;
76
+ // 비밀번호 유틸리티 클래스
77
+ class PasswordUtils {
78
+ async bcrypt(password) {
79
+ return passwordUtils.bcryptPassword(password);
80
+ }
81
+ async check(password, hash) {
82
+ return passwordUtils.checkPassword(password, hash);
83
+ }
84
+ async crypto(password) {
85
+ return passwordUtils.cryptoPassword(password);
86
+ }
87
+ decrypt(encryptedPassword) {
88
+ return passwordUtils.decryptPassword(encryptedPassword);
89
+ }
90
+ generate(length = 12) {
91
+ return passwordUtils.generatePassword(length);
92
+ }
93
+ }
94
+ exports.PasswordUtils = PasswordUtils;
95
+ // 응답 유틸리티 클래스
96
+ class ResponseUtils {
97
+ success(data) {
98
+ return responseUtils.success(data);
99
+ }
100
+ error(code, message) {
101
+ return responseUtils.error(code, message);
102
+ }
103
+ safeResponse(data) {
104
+ return responseUtils.safeResponse(data);
105
+ }
106
+ }
107
+ exports.ResponseUtils = ResponseUtils;
108
+ // 검증 유틸리티 클래스
109
+ class ValidationUtils {
110
+ isEmail(email) {
111
+ return validationUtils.isEmail(email);
112
+ }
113
+ isPassword(password, options) {
114
+ return validationUtils.isPassword(password, options);
115
+ }
116
+ isPhone(phone) {
117
+ return validationUtils.isPhone(phone);
118
+ }
119
+ isNotEmpty(str) {
120
+ return validationUtils.isNotEmpty(str);
121
+ }
122
+ isNumber(value) {
123
+ return validationUtils.isNumber(value);
124
+ }
125
+ isURL(url) {
126
+ return validationUtils.isURL(url);
127
+ }
128
+ }
129
+ exports.ValidationUtils = ValidationUtils;
130
+ // PK 생성 유틸리티 클래스
131
+ class PKUtils {
132
+ async make(convertStr) {
133
+ return pkUtils.makePK(convertStr);
134
+ }
135
+ async makeWithLength(length, prefix = '') {
136
+ return pkUtils.makePKWithLength(length, prefix);
137
+ }
138
+ }
139
+ exports.PKUtils = PKUtils;
@@ -0,0 +1,107 @@
1
+ import _ from 'lodash';
2
+ /**
3
+ * Lodash 유틸리티 래퍼
4
+ *
5
+ * company-common-utils를 참고하여 작성되었습니다.
6
+ * 모든 lodash 함수에 직접 접근할 수 있도록 제공합니다.
7
+ */
8
+ export declare class LodashUtils {
9
+ /**
10
+ * lodash 인스턴스 직접 접근
11
+ */
12
+ get _(): _.LoDashStatic;
13
+ /**
14
+ * 객체 깊은 복사
15
+ */
16
+ deepClone<T>(value: T): T;
17
+ /**
18
+ * 객체 병합
19
+ */
20
+ merge<T extends object>(target: T, ...sources: Partial<T>[]): T;
21
+ /**
22
+ * 배열에서 중복 제거
23
+ */
24
+ uniq<T>(array: T[]): T[];
25
+ /**
26
+ * 객체에서 특정 경로의 값 가져오기
27
+ */
28
+ get<T>(object: any, path: string, defaultValue?: T): T;
29
+ /**
30
+ * 객체에 특정 경로로 값 설정
31
+ */
32
+ set<T>(object: any, path: string, value: T): any;
33
+ /**
34
+ * 배열 그룹화
35
+ */
36
+ groupBy<T>(collection: T[], iteratee: string | ((item: T) => string)): Record<string, T[]>;
37
+ /**
38
+ * 디바운스 함수
39
+ */
40
+ debounce<T extends (...args: any[]) => any>(func: T, wait: number, options?: _.DebounceSettings): _.DebouncedFunc<T>;
41
+ /**
42
+ * 스로틀 함수
43
+ */
44
+ throttle<T extends (...args: any[]) => any>(func: T, wait: number, options?: _.ThrottleSettings): _.DebouncedFunc<T>;
45
+ /**
46
+ * 배열에서 특정 조건으로 필터링
47
+ */
48
+ filter<T>(collection: T[], predicate: ((item: T) => boolean) | string | object): T[];
49
+ /**
50
+ * 배열에서 특정 조건으로 찾기
51
+ */
52
+ find<T>(collection: T[], predicate: ((item: T) => boolean) | string | object): T | undefined;
53
+ /**
54
+ * 배열에서 특정 조건으로 매핑
55
+ */
56
+ map<T, U>(collection: T[], iteratee: ((item: T) => U) | string | number): U[];
57
+ /**
58
+ * 배열에서 특정 조건으로 리듀스
59
+ */
60
+ reduce<T, U>(collection: T[], iteratee: (acc: U, value: T, index: number, collection: T[]) => U, accumulator: U): U;
61
+ /**
62
+ * 객체 키 순회
63
+ */
64
+ keys(object: object): string[];
65
+ /**
66
+ * 객체 값 순회
67
+ */
68
+ values<T>(object: {
69
+ [key: string]: T;
70
+ }): T[];
71
+ /**
72
+ * 객체가 비어있는지 확인
73
+ */
74
+ isEmpty(value: any): boolean;
75
+ /**
76
+ * 객체 병합 (assign과 유사)
77
+ */
78
+ assign<T extends object>(target: T, ...sources: Partial<T>[]): T;
79
+ /**
80
+ * 객체 키-값 쌍으로 변환
81
+ */
82
+ toPairs<T>(object: {
83
+ [key: string]: T;
84
+ }): [string, T][];
85
+ /**
86
+ * 키-값 쌍에서 객체로 변환
87
+ */
88
+ fromPairs<T>(pairs: [string, T][]): {
89
+ [key: string]: T;
90
+ };
91
+ /**
92
+ * 배열을 청크로 나누기
93
+ */
94
+ chunk<T>(array: T[], size: number): T[][];
95
+ /**
96
+ * 배열에서 특정 값 제거
97
+ */
98
+ without<T>(array: T[], ...values: T[]): T[];
99
+ /**
100
+ * 배열 평탄화
101
+ */
102
+ flatten<T>(array: (T | T[])[]): any[];
103
+ /**
104
+ * 배열 깊이 평탄화
105
+ */
106
+ flattenDeep<T>(array: any[]): any[];
107
+ }