@simplysm/core-common 13.0.69 → 13.0.71

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 (151) hide show
  1. package/README.md +66 -267
  2. package/dist/common.types.d.ts +14 -14
  3. package/dist/errors/argument-error.d.ts +10 -10
  4. package/dist/errors/argument-error.d.ts.map +1 -1
  5. package/dist/errors/argument-error.js +2 -2
  6. package/dist/errors/argument-error.js.map +1 -1
  7. package/dist/errors/not-implemented-error.d.ts +8 -8
  8. package/dist/errors/not-implemented-error.js +2 -2
  9. package/dist/errors/not-implemented-error.js.map +1 -1
  10. package/dist/errors/sd-error.d.ts +10 -10
  11. package/dist/errors/sd-error.d.ts.map +1 -1
  12. package/dist/errors/timeout-error.d.ts +10 -10
  13. package/dist/errors/timeout-error.js +3 -3
  14. package/dist/errors/timeout-error.js.map +1 -1
  15. package/dist/extensions/arr-ext.d.ts +2 -2
  16. package/dist/extensions/arr-ext.helpers.d.ts +8 -8
  17. package/dist/extensions/arr-ext.helpers.js +1 -1
  18. package/dist/extensions/arr-ext.helpers.js.map +1 -1
  19. package/dist/extensions/arr-ext.js +13 -13
  20. package/dist/extensions/arr-ext.js.map +1 -1
  21. package/dist/extensions/arr-ext.types.d.ts +57 -57
  22. package/dist/extensions/arr-ext.types.d.ts.map +1 -1
  23. package/dist/extensions/map-ext.d.ts +16 -16
  24. package/dist/extensions/set-ext.d.ts +11 -11
  25. package/dist/features/debounce-queue.d.ts +17 -15
  26. package/dist/features/debounce-queue.d.ts.map +1 -1
  27. package/dist/features/debounce-queue.js +6 -6
  28. package/dist/features/debounce-queue.js.map +1 -1
  29. package/dist/features/event-emitter.d.ts +20 -20
  30. package/dist/features/event-emitter.js +17 -17
  31. package/dist/features/serial-queue.d.ts +11 -11
  32. package/dist/features/serial-queue.js +5 -5
  33. package/dist/features/serial-queue.js.map +1 -1
  34. package/dist/globals.d.ts +4 -4
  35. package/dist/types/date-only.d.ts +64 -64
  36. package/dist/types/date-only.d.ts.map +1 -1
  37. package/dist/types/date-only.js +63 -63
  38. package/dist/types/date-time.d.ts +37 -37
  39. package/dist/types/date-time.d.ts.map +1 -1
  40. package/dist/types/date-time.js +54 -37
  41. package/dist/types/date-time.js.map +1 -1
  42. package/dist/types/lazy-gc-map.d.ts +26 -26
  43. package/dist/types/lazy-gc-map.d.ts.map +1 -1
  44. package/dist/types/lazy-gc-map.js +26 -26
  45. package/dist/types/lazy-gc-map.js.map +1 -1
  46. package/dist/types/time.d.ts +25 -25
  47. package/dist/types/time.d.ts.map +1 -1
  48. package/dist/types/time.js +25 -25
  49. package/dist/types/time.js.map +1 -1
  50. package/dist/types/uuid.d.ts +11 -11
  51. package/dist/types/uuid.d.ts.map +1 -1
  52. package/dist/types/uuid.js +12 -12
  53. package/dist/types/uuid.js.map +1 -1
  54. package/dist/utils/bytes.d.ts +17 -17
  55. package/dist/utils/bytes.js +4 -4
  56. package/dist/utils/bytes.js.map +1 -1
  57. package/dist/utils/date-format.d.ts +45 -45
  58. package/dist/utils/date-format.js +1 -1
  59. package/dist/utils/date-format.js.map +1 -1
  60. package/dist/utils/error.d.ts +4 -4
  61. package/dist/utils/json.d.ts +17 -17
  62. package/dist/utils/json.js +3 -3
  63. package/dist/utils/json.js.map +1 -1
  64. package/dist/utils/num.d.ts +23 -23
  65. package/dist/utils/obj.d.ts +111 -111
  66. package/dist/utils/obj.d.ts.map +1 -1
  67. package/dist/utils/obj.js +3 -3
  68. package/dist/utils/obj.js.map +1 -1
  69. package/dist/utils/path.d.ts +10 -10
  70. package/dist/utils/primitive.d.ts +5 -5
  71. package/dist/utils/primitive.js +1 -1
  72. package/dist/utils/primitive.js.map +1 -1
  73. package/dist/utils/str.d.ts +46 -46
  74. package/dist/utils/str.d.ts.map +1 -1
  75. package/dist/utils/str.js +5 -5
  76. package/dist/utils/str.js.map +1 -1
  77. package/dist/utils/template-strings.d.ts +26 -26
  78. package/dist/utils/transferable.d.ts +18 -18
  79. package/dist/utils/transferable.js +1 -1
  80. package/dist/utils/transferable.js.map +1 -1
  81. package/dist/utils/wait.d.ts +9 -9
  82. package/dist/utils/xml.d.ts +13 -13
  83. package/dist/utils/xml.d.ts.map +1 -1
  84. package/dist/utils/xml.js +1 -0
  85. package/dist/utils/xml.js.map +1 -1
  86. package/dist/zip/sd-zip.d.ts +22 -22
  87. package/dist/zip/sd-zip.js +16 -16
  88. package/package.json +4 -4
  89. package/src/common.types.ts +17 -17
  90. package/src/errors/argument-error.ts +15 -15
  91. package/src/errors/not-implemented-error.ts +9 -9
  92. package/src/errors/sd-error.ts +12 -12
  93. package/src/errors/timeout-error.ts +12 -12
  94. package/src/extensions/arr-ext.helpers.ts +10 -10
  95. package/src/extensions/arr-ext.ts +57 -57
  96. package/src/extensions/arr-ext.types.ts +59 -59
  97. package/src/extensions/map-ext.ts +16 -16
  98. package/src/extensions/set-ext.ts +11 -11
  99. package/src/features/debounce-queue.ts +21 -19
  100. package/src/features/event-emitter.ts +25 -25
  101. package/src/features/serial-queue.ts +13 -13
  102. package/src/globals.ts +4 -4
  103. package/src/index.ts +1 -1
  104. package/src/types/date-only.ts +83 -83
  105. package/src/types/date-time.ts +64 -44
  106. package/src/types/lazy-gc-map.ts +45 -45
  107. package/src/types/time.ts +34 -34
  108. package/src/types/uuid.ts +17 -17
  109. package/src/utils/bytes.ts +35 -35
  110. package/src/utils/date-format.ts +65 -65
  111. package/src/utils/error.ts +4 -4
  112. package/src/utils/json.ts +39 -39
  113. package/src/utils/num.ts +23 -23
  114. package/src/utils/obj.ts +138 -138
  115. package/src/utils/path.ts +10 -10
  116. package/src/utils/primitive.ts +6 -6
  117. package/src/utils/str.ts +260 -261
  118. package/src/utils/template-strings.ts +29 -29
  119. package/src/utils/transferable.ts +284 -284
  120. package/src/utils/wait.ts +10 -10
  121. package/src/utils/xml.ts +20 -19
  122. package/src/zip/sd-zip.ts +25 -25
  123. package/tests/errors/errors.spec.ts +80 -0
  124. package/tests/extensions/array-extension.spec.ts +796 -0
  125. package/tests/extensions/map-extension.spec.ts +147 -0
  126. package/tests/extensions/set-extension.spec.ts +74 -0
  127. package/tests/types/date-only.spec.ts +638 -0
  128. package/tests/types/date-time.spec.ts +391 -0
  129. package/tests/types/lazy-gc-map.spec.ts +692 -0
  130. package/tests/types/time.spec.ts +559 -0
  131. package/tests/types/uuid.spec.ts +74 -0
  132. package/tests/utils/bytes-utils.spec.ts +230 -0
  133. package/tests/utils/date-format.spec.ts +373 -0
  134. package/tests/utils/debounce-queue.spec.ts +272 -0
  135. package/tests/utils/json.spec.ts +486 -0
  136. package/tests/utils/number.spec.ts +157 -0
  137. package/tests/utils/object.spec.ts +829 -0
  138. package/tests/utils/path.spec.ts +78 -0
  139. package/tests/utils/primitive.spec.ts +43 -0
  140. package/tests/utils/sd-event-emitter.spec.ts +216 -0
  141. package/tests/utils/serial-queue.spec.ts +365 -0
  142. package/tests/utils/string.spec.ts +281 -0
  143. package/tests/utils/template-strings.spec.ts +57 -0
  144. package/tests/utils/transferable.spec.ts +703 -0
  145. package/tests/utils/wait.spec.ts +145 -0
  146. package/tests/utils/xml.spec.ts +146 -0
  147. package/tests/zip/sd-zip.spec.ts +238 -0
  148. package/docs/extensions.md +0 -503
  149. package/docs/features.md +0 -109
  150. package/docs/types.md +0 -486
  151. package/docs/utils.md +0 -780
@@ -5,25 +5,25 @@ export interface ZipArchiveProgress {
5
5
  extractedSize: number;
6
6
  }
7
7
  /**
8
- * ZIP 아카이브 처리 클래스
8
+ * ZIP archive processing class
9
9
  *
10
- * ZIP 파일의 읽기, 쓰기, 압축/해제를 처리합니다.
11
- * 내부 캐시를 사용하여 동일 파일의 중복 압축 해제를 방지합니다.
10
+ * Handles reading, writing, compression, and decompression of ZIP files.
11
+ * Uses internal caching to prevent duplicate decompression of the same file.
12
12
  *
13
13
  * @example
14
- * // ZIP 파일 읽기
14
+ * // Read ZIP file
15
15
  * await using archive = new ZipArchive(zipBytes);
16
16
  * const content = await archive.get("file.txt");
17
17
  *
18
18
  * @example
19
- * // ZIP 파일 생성
19
+ * // Create ZIP file
20
20
  * await using archive = new ZipArchive();
21
21
  * archive.write("file.txt", textBytes);
22
22
  * archive.write("data.json", jsonBytes);
23
23
  * const zipBytes = await archive.compress();
24
24
  *
25
25
  * @example
26
- * // 전체 압축 해제 (진행률 표시)
26
+ * // Extract all files (with progress reporting)
27
27
  * await using archive = new ZipArchive(zipBytes);
28
28
  * const files = await archive.extractAll((progress) => {
29
29
  * console.log(`${progress.fileName}: ${progress.extractedSize}/${progress.totalSize}`);
@@ -34,46 +34,46 @@ export declare class ZipArchive {
34
34
  private readonly _cache;
35
35
  private _entries?;
36
36
  /**
37
- * ZipArchive 생성
38
- * @param data ZIP 데이터 (생략 아카이브 생성)
37
+ * Create ZipArchive
38
+ * @param data ZIP data (omit to create a new archive)
39
39
  */
40
40
  constructor(data?: Blob | Bytes);
41
41
  private _getEntries;
42
42
  /**
43
- * 모든 파일을 압축 해제
44
- * @param progressCallback 진행률 콜백
43
+ * Extract all files
44
+ * @param progressCallback Progress callback
45
45
  */
46
46
  extractAll(progressCallback?: (progress: ZipArchiveProgress) => void): Promise<Map<string, Bytes | undefined>>;
47
47
  /**
48
- * 특정 파일 압축 해제
49
- * @param fileName 파일 이름
48
+ * Extract specific file
49
+ * @param fileName File name
50
50
  */
51
51
  get(fileName: string): Promise<Bytes | undefined>;
52
52
  /**
53
- * 파일 존재 여부 확인
54
- * @param fileName 파일 이름
53
+ * Check if file exists
54
+ * @param fileName File name
55
55
  */
56
56
  exists(fileName: string): Promise<boolean>;
57
57
  /**
58
- * 파일 쓰기 (캐시에 저장)
59
- * @param fileName 파일 이름
60
- * @param bytes 파일 내용
58
+ * Write file (store in cache)
59
+ * @param fileName File name
60
+ * @param bytes File content
61
61
  */
62
62
  write(fileName: string, bytes: Bytes): void;
63
63
  /**
64
- * 캐시된 파일들을 ZIP으로 압축
64
+ * Compress cached files to ZIP
65
65
  *
66
66
  * @remarks
67
- * 내부적으로 `extractAll()`을 호출하여 모든 파일을 메모리에 로드한 압축합니다.
68
- * 대용량 ZIP 파일의 경우 메모리 사용량에 주의가 필요합니다.
67
+ * Internally calls `extractAll()` to load all files into memory before compressing.
68
+ * Be mindful of memory usage when dealing with large ZIP files.
69
69
  */
70
70
  compress(): Promise<Bytes>;
71
71
  /**
72
- * 리더 닫기 캐시 정리
72
+ * Close reader and clear cache
73
73
  */
74
74
  close(): Promise<void>;
75
75
  /**
76
- * await using 지원
76
+ * Support for await using
77
77
  */
78
78
  [Symbol.asyncDispose](): Promise<void>;
79
79
  }
@@ -10,8 +10,8 @@ class ZipArchive {
10
10
  _cache = /* @__PURE__ */ new Map();
11
11
  _entries;
12
12
  /**
13
- * ZipArchive 생성
14
- * @param data ZIP 데이터 (생략 아카이브 생성)
13
+ * Create ZipArchive
14
+ * @param data ZIP data (omit to create a new archive)
15
15
  */
16
16
  constructor(data) {
17
17
  if (!data) return;
@@ -29,8 +29,8 @@ class ZipArchive {
29
29
  }
30
30
  //#region extractAll
31
31
  /**
32
- * 모든 파일을 압축 해제
33
- * @param progressCallback 진행률 콜백
32
+ * Extract all files
33
+ * @param progressCallback Progress callback
34
34
  */
35
35
  async extractAll(progressCallback) {
36
36
  const entries = await this._getEntries();
@@ -68,8 +68,8 @@ class ZipArchive {
68
68
  //#endregion
69
69
  //#region get
70
70
  /**
71
- * 특정 파일 압축 해제
72
- * @param fileName 파일 이름
71
+ * Extract specific file
72
+ * @param fileName File name
73
73
  */
74
74
  async get(fileName) {
75
75
  if (this._cache.has(fileName)) {
@@ -92,8 +92,8 @@ class ZipArchive {
92
92
  //#endregion
93
93
  //#region exists
94
94
  /**
95
- * 파일 존재 여부 확인
96
- * @param fileName 파일 이름
95
+ * Check if file exists
96
+ * @param fileName File name
97
97
  */
98
98
  async exists(fileName) {
99
99
  if (this._cache.has(fileName)) {
@@ -109,9 +109,9 @@ class ZipArchive {
109
109
  //#endregion
110
110
  //#region write
111
111
  /**
112
- * 파일 쓰기 (캐시에 저장)
113
- * @param fileName 파일 이름
114
- * @param bytes 파일 내용
112
+ * Write file (store in cache)
113
+ * @param fileName File name
114
+ * @param bytes File content
115
115
  */
116
116
  write(fileName, bytes) {
117
117
  this._cache.set(fileName, bytes);
@@ -119,11 +119,11 @@ class ZipArchive {
119
119
  //#endregion
120
120
  //#region compress
121
121
  /**
122
- * 캐시된 파일들을 ZIP으로 압축
122
+ * Compress cached files to ZIP
123
123
  *
124
124
  * @remarks
125
- * 내부적으로 `extractAll()`을 호출하여 모든 파일을 메모리에 로드한 압축합니다.
126
- * 대용량 ZIP 파일의 경우 메모리 사용량에 주의가 필요합니다.
125
+ * Internally calls `extractAll()` to load all files into memory before compressing.
126
+ * Be mindful of memory usage when dealing with large ZIP files.
127
127
  */
128
128
  async compress() {
129
129
  const fileMap = await this.extractAll();
@@ -138,7 +138,7 @@ class ZipArchive {
138
138
  //#endregion
139
139
  //#region close
140
140
  /**
141
- * 리더 닫기 캐시 정리
141
+ * Close reader and clear cache
142
142
  */
143
143
  async close() {
144
144
  var _a;
@@ -146,7 +146,7 @@ class ZipArchive {
146
146
  this._cache.clear();
147
147
  }
148
148
  /**
149
- * await using 지원
149
+ * Support for await using
150
150
  */
151
151
  async [Symbol.asyncDispose]() {
152
152
  await this.close();
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@simplysm/core-common",
3
- "version": "13.0.69",
4
- "description": "심플리즘 패키지 - 코어 모듈 (common)",
5
- "author": "김석래",
3
+ "version": "13.0.71",
4
+ "description": "Simplysm package - Core module (common)",
5
+ "author": "simplysm",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
8
8
  "type": "git",
@@ -15,7 +15,7 @@
15
15
  "files": [
16
16
  "dist",
17
17
  "src",
18
- "docs"
18
+ "tests"
19
19
  ],
20
20
  "sideEffects": [
21
21
  "./src/extensions/arr-ext.ts",
@@ -3,20 +3,20 @@ import { DateOnly } from "./types/date-only";
3
3
  import { Time } from "./types/time";
4
4
  import { Uuid } from "./types/uuid";
5
5
 
6
- //#region Bytes 타입
6
+ //#region Bytes Type
7
7
 
8
8
  /**
9
- * Buffer 대신 사용하는 바이너리 타입
9
+ * Binary type used instead of Buffer
10
10
  */
11
11
  export type Bytes = Uint8Array;
12
12
 
13
13
  //#endregion
14
14
 
15
- //#region Primitive 타입
15
+ //#region Primitive Type
16
16
 
17
17
  /**
18
- * Primitive 타입 매핑
19
- * orm-common과 공유
18
+ * Primitive type mapping
19
+ * Shared with orm-common
20
20
  */
21
21
  export type PrimitiveTypeMap = {
22
22
  string: string;
@@ -30,25 +30,25 @@ export type PrimitiveTypeMap = {
30
30
  };
31
31
 
32
32
  /**
33
- * Primitive 타입 문자열
33
+ * Primitive type string key
34
34
  */
35
35
  export type PrimitiveTypeStr = keyof PrimitiveTypeMap;
36
36
 
37
37
  /**
38
- * Primitive 타입 유니온
38
+ * Primitive type union
39
39
  */
40
40
  export type PrimitiveType = PrimitiveTypeMap[PrimitiveTypeStr] | undefined;
41
41
 
42
42
  //#endregion
43
43
 
44
- //#region 유틸리티 타입
44
+ //#region Utility Types
45
45
 
46
46
  /**
47
- * 깊은 Partial 타입
47
+ * Deep Partial type
48
48
  *
49
- * 객체의 모든 속성을 재귀적으로 선택적(optional)으로 만듭니다.
50
- * Primitive 타입(string, number, boolean ) 그대로 유지하고,
51
- * 객체/배열 타입만 재귀적으로 Partial 적용합니다.
49
+ * Recursively makes all properties of an object optional.
50
+ * Primitive types (string, number, boolean, etc.) are kept as-is,
51
+ * only object/array types have Partial applied recursively.
52
52
  *
53
53
  * @example
54
54
  * ```typescript
@@ -60,7 +60,7 @@ export type PrimitiveType = PrimitiveTypeMap[PrimitiveTypeStr] | undefined;
60
60
  * };
61
61
  * }
62
62
  *
63
- * // 모든 깊이의 속성이 선택적이
63
+ * // All properties at every depth become optional
64
64
  * const partial: DeepPartial<User> = {
65
65
  * profile: { address: {} }
66
66
  * };
@@ -71,10 +71,10 @@ export type DeepPartial<TObject> = Partial<{
71
71
  }>;
72
72
 
73
73
  /**
74
- * 생성자 타입
74
+ * Constructor type
75
75
  *
76
- * 클래스 생성자를 타입으로 표현할 사용합니다.
77
- * 주로 의존성 주입, 팩토리 패턴, instanceof 체크 등에서 활용됩니다.
76
+ * Used to represent a class constructor as a type.
77
+ * Primarily used in dependency injection, factory patterns, and instanceof checks.
78
78
  *
79
79
  * @example
80
80
  * function create<T>(ctor: Type<T>): T {
@@ -82,7 +82,7 @@ export type DeepPartial<TObject> = Partial<{
82
82
  * }
83
83
  *
84
84
  * class MyClass { name = "test"; }
85
- * const instance = create(MyClass); // MyClass 인스턴스
85
+ * const instance = create(MyClass); // MyClass instance
86
86
  */
87
87
  export interface Type<TInstance> extends Function {
88
88
  new (...args: unknown[]): TInstance;
@@ -1,29 +1,29 @@
1
- // yaml 라이브러리를 사용하는 이유:
2
- // 중첩된 객체 구조를 가독성 좋게 표현하기 위함.
3
- // JSON.stringify보다 트리 구조가 명확하게 보임.
1
+ // Why we use the yaml library:
2
+ // To represent nested object structures in a readable format.
3
+ // Tree structure is more clearly visible than JSON.stringify.
4
4
  import YAML from "yaml";
5
5
  import { SdError } from "./sd-error";
6
6
 
7
7
  /**
8
- * 인수 오류
8
+ * Argument error
9
9
  *
10
- * 잘못된 인수를 받았을 발생시키는 에러이다.
11
- * 인수 객체를 YAML 형식으로 메시지에 포함하여 디버깅을 용이하게 한다.
10
+ * An error thrown when invalid arguments are received.
11
+ * Includes the argument object in YAML format in the message to facilitate debugging.
12
12
  *
13
13
  * @example
14
- * // 인수 객체만 전달
14
+ * // Passing only the argument object
15
15
  * throw new ArgumentError({ userId: 123, name: null });
16
- * // 결과 메시지: "인수가 잘못되었습니다.\n\nuserId: 123\nname: null"
16
+ * // Result message: "Invalid arguments.\n\nuserId: 123\nname: null"
17
17
  *
18
18
  * @example
19
- * // 커스텀 메시지와 인수 객체 전달
20
- * throw new ArgumentError("유효하지 않은 사용자", { userId: 123 });
21
- * // 결과 메시지: "유효하지 않은 사용자\n\nuserId: 123"
19
+ * // Passing a custom message and argument object
20
+ * throw new ArgumentError("Invalid user", { userId: 123 });
21
+ * // Result message: "Invalid user\n\nuserId: 123"
22
22
  */
23
23
  export class ArgumentError extends SdError {
24
- /** 기본 메시지("인수가 잘못되었습니다.")와 함께 인수 객체를 YAML 형식으로 출력 */
24
+ /** Output argument object in YAML format with default message ("Invalid arguments.") */
25
25
  constructor(argObj: Record<string, unknown>);
26
- /** 커스텀 메시지와 함께 인수 객체를 YAML 형식으로 출력 */
26
+ /** Output argument object in YAML format with a custom message */
27
27
  constructor(message: string, argObj: Record<string, unknown>);
28
28
  constructor(arg1: Record<string, unknown> | string, arg2?: Record<string, unknown>);
29
29
  constructor(arg1: Record<string, unknown> | string, arg2?: Record<string, unknown>) {
@@ -31,9 +31,9 @@ export class ArgumentError extends SdError {
31
31
  const argObj = typeof arg1 === "string" ? arg2 : arg1;
32
32
 
33
33
  if (argObj != null) {
34
- super((message ?? "인수가 잘못되었습니다.") + "\n\n" + YAML.stringify(argObj));
34
+ super((message ?? "Invalid arguments.") + "\n\n" + YAML.stringify(argObj));
35
35
  } else {
36
- super(message ?? "인수가 잘못되었습니다.");
36
+ super(message ?? "Invalid arguments.");
37
37
  }
38
38
  this.name = "ArgumentError";
39
39
  }
@@ -1,32 +1,32 @@
1
1
  import { SdError } from "./sd-error";
2
2
 
3
3
  /**
4
- * 미구현 오류
4
+ * Not implemented error
5
5
  *
6
- * 아직 구현되지 않은 기능을 호출했을 발생시키는 에러이다.
7
- * 추상 메서드 스텁, 향후 구현 예정인 분기 등에 사용한다.
6
+ * An error thrown when a feature that has not yet been implemented is called.
7
+ * Used for abstract method stubs, branches planned for future implementation, etc.
8
8
  *
9
9
  * @example
10
- * // 추상 메서드 구현
10
+ * // Before abstract method implementation
11
11
  * class BaseService {
12
12
  * process(): void {
13
- * throw new NotImplementedError("서브클래스에서 구현 필요");
13
+ * throw new NotImplementedError("Implementation required in subclass");
14
14
  * }
15
15
  * }
16
16
  *
17
17
  * @example
18
- * // 향후 구현 예정 분기
18
+ * // Branch planned for future implementation
19
19
  * switch (type) {
20
20
  * case "A": return handleA();
21
- * case "B": throw new NotImplementedError(`타입 ${type} 처리`);
21
+ * case "B": throw new NotImplementedError(`Handling for type ${type}`);
22
22
  * }
23
23
  */
24
24
  export class NotImplementedError extends SdError {
25
25
  /**
26
- * @param message 추가 설명 메시지
26
+ * @param message Additional description message
27
27
  */
28
28
  constructor(message?: string) {
29
- super("구현되어 있지 않습니다" + (message != null ? ": " + message : ""));
29
+ super("Not implemented" + (message != null ? ": " + message : ""));
30
30
  this.name = "NotImplementedError";
31
31
  }
32
32
  }
@@ -1,27 +1,27 @@
1
1
  /**
2
- * 오류의 Tree 구조 구성이 가능한 오류 클래스
3
- * ES2024 cause 속성 활용
2
+ * Error class supporting Tree structure composition
3
+ * Utilizes ES2024 cause property
4
4
  *
5
5
  * @example
6
- * // 원인 에러를 감싸서 생성
6
+ * // Wrap a cause error
7
7
  * try {
8
8
  * await fetch(url);
9
9
  * } catch (err) {
10
- * throw new SdError(err, "API 호출 실패", "사용자 로드 실패");
10
+ * throw new SdError(err, "API call failed", "User load failed");
11
11
  * }
12
- * // 결과 메시지: "사용자 로드 실패 => API 호출 실패 => 원본 에러 메시지"
12
+ * // Result message: "User load failed => API call failed => original error message"
13
13
  *
14
14
  * @example
15
- * // 메시지만으로 생성
16
- * throw new SdError("잘못된 상태", "처리 불가");
17
- * // 결과 메시지: "처리 불가 => 잘못된 상태"
15
+ * // Create with message only
16
+ * throw new SdError("invalid state", "processing not possible");
17
+ * // Result message: "processing not possible => invalid state"
18
18
  */
19
19
  export class SdError extends Error {
20
20
  override cause?: Error;
21
21
 
22
- /** 원인 에러를 감싸서 생성. 메시지는 역순으로 연결됨 (상위 메시지 => 하위 메시지 => 원인 메시지) */
22
+ /** Create by wrapping a cause error. Messages are joined in reverse order (upper message => lower message => cause message) */
23
23
  constructor(cause: Error, ...messages: string[]);
24
- /** 메시지만으로 생성. 메시지는 역순으로 연결됨 (상위 메시지 => 하위 메시지) */
24
+ /** Create with messages only. Messages are joined in reverse order (upper message => lower message) */
25
25
  constructor(...messages: string[]);
26
26
  constructor(arg1?: unknown, ...messages: string[]);
27
27
  constructor(arg1?: unknown, ...messages: string[]) {
@@ -46,7 +46,7 @@ export class SdError extends Error {
46
46
  Object.setPrototypeOf(this, new.target.prototype);
47
47
  this.name = "SdError";
48
48
 
49
- // V8 엔진(Node.js, Chrome)에서만 사용 가능한 captureStackTrace
49
+ // captureStackTrace available only on V8 engine (Node.js, Chrome)
50
50
  if ("captureStackTrace" in Error) {
51
51
  (Error.captureStackTrace as (targetObject: object, constructorOpt?: Function) => void)(
52
52
  this,
@@ -54,7 +54,7 @@ export class SdError extends Error {
54
54
  );
55
55
  }
56
56
 
57
- // cause 체인의 stack 현재 stack에 추가
57
+ // Add cause chain stack to current stack
58
58
  if (cause?.stack != null) {
59
59
  this.stack += `\n---- cause stack ----\n${cause.stack}`;
60
60
  }
@@ -1,36 +1,36 @@
1
1
  import { SdError } from "./sd-error";
2
2
 
3
3
  /**
4
- * 타임아웃 오류
4
+ * Timeout error
5
5
  *
6
- * 대기 시간이 초과되었을 발생하는 에러이다.
7
- * Wait.until() 등의 비동기 대기 함수에서 최대 시도 횟수를 초과하면 자동으로 발생한다.
6
+ * An error that occurs when the waiting time is exceeded.
7
+ * Automatically thrown when the maximum number of attempts is exceeded in async waiting functions like Wait.until().
8
8
  *
9
9
  * @example
10
- * // Wait.until에서 자동 발생
10
+ * // Automatically thrown from Wait.until
11
11
  * try {
12
- * await Wait.until(() => isReady, 100, 50); // 100ms 간격, 최대 50
12
+ * await Wait.until(() => isReady, 100, 50); // 100ms interval, max 50 attempts
13
13
  * } catch (err) {
14
14
  * if (err instanceof TimeoutError) {
15
- * console.log("시간 초과");
15
+ * console.log("Timeout exceeded");
16
16
  * }
17
17
  * }
18
18
  *
19
19
  * @example
20
- * // 직접 발생
20
+ * // Thrown directly
21
21
  * if (elapsed > maxTime) {
22
- * throw new TimeoutError(undefined, "API 응답 대기 초과");
22
+ * throw new TimeoutError(undefined, "Waiting for API response exceeded");
23
23
  * }
24
24
  */
25
25
  export class TimeoutError extends SdError {
26
26
  /**
27
- * @param count 시도 횟수
28
- * @param message 추가 메시지
27
+ * @param count Number of attempts
28
+ * @param message Additional message
29
29
  */
30
30
  constructor(count?: number, message?: string) {
31
31
  super(
32
- "대기 시간이 초과되었습니다" +
33
- (count != null ? `(${count})` : "") +
32
+ "Waiting time exceeded" +
33
+ (count != null ? `(${count} attempts)` : "") +
34
34
  (message != null ? `: ${message}` : ""),
35
35
  );
36
36
  this.name = "TimeoutError";
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Array 확장 헬퍼 함수
2
+ * Array extension helper functions
3
3
  */
4
4
 
5
5
  import { DateTime } from "../types/date-time";
@@ -9,7 +9,7 @@ import { ArgumentError } from "../errors/argument-error";
9
9
  import type { ComparableType } from "./arr-ext.types";
10
10
 
11
11
  /**
12
- * DateTime, DateOnly, Time 비교 가능한 primitive 값으로 변환
12
+ * Convert DateTime, DateOnly, Time to comparable primitive values
13
13
  */
14
14
  export function toComparable(value: ComparableType): string | number | boolean | undefined {
15
15
  if (value instanceof DateOnly || value instanceof DateTime || value instanceof Time) {
@@ -19,13 +19,13 @@ export function toComparable(value: ComparableType): string | number | boolean |
19
19
  }
20
20
 
21
21
  /**
22
- * 정렬을 위한 비교 함수
22
+ * Comparison function for sorting
23
23
  *
24
- * @param pp 비교 대상 1
25
- * @param pn 비교 대상 2
26
- * @param desc true: 내림차순, false: 오름차순
27
- * @returns 음수: pp 앞, 0: 같음, 양수: pn
28
- * @note null/undefined 값은 오름차순 앞으로, 내림차순 뒤로 정렬됨
24
+ * @param pp comparison target 1
25
+ * @param pn comparison target 2
26
+ * @param desc true: descending, false: ascending
27
+ * @returns negative: pp comes first, 0: equal, positive: pn comes first
28
+ * @note null/undefined values are sorted first in ascending, last in descending
29
29
  */
30
30
  export function compareForOrder(pp: ComparableType, pn: ComparableType, desc: boolean): number {
31
31
  const cpp = toComparable(pp);
@@ -45,11 +45,11 @@ export function compareForOrder(pp: ComparableType, pn: ComparableType, desc: bo
45
45
  return cpp < cpn ? -1 : cpp > cpn ? 1 : 0;
46
46
  }
47
47
  if (typeof cpn === "boolean" && typeof cpp === "boolean") {
48
- // true > false: 오름차순 true가 뒤, 내림차순 true가
48
+ // true > false: true comes last in ascending, first in descending
49
49
  return cpn ? (desc ? 1 : -1) : desc ? -1 : 1;
50
50
  }
51
51
 
52
- throw new ArgumentError("orderBy 사용할 없는 타입입니다.", {
52
+ throw new ArgumentError("Cannot use orderBy with this type.", {
53
53
  type1: typeof cpp,
54
54
  type2: typeof cpn,
55
55
  });