@simplysm/core-common 13.0.100 → 14.0.4
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/README.md +86 -92
- package/dist/common.types.d.ts +14 -14
- package/dist/common.types.js +2 -1
- package/dist/common.types.js.map +1 -6
- package/dist/env.d.ts +8 -1
- package/dist/env.d.ts.map +1 -1
- package/dist/env.js +13 -9
- package/dist/env.js.map +1 -6
- package/dist/errors/argument-error.d.ts +10 -10
- package/dist/errors/argument-error.d.ts.map +1 -1
- package/dist/errors/argument-error.js +31 -14
- package/dist/errors/argument-error.js.map +1 -6
- package/dist/errors/not-implemented-error.d.ts +8 -8
- package/dist/errors/not-implemented-error.js +30 -12
- package/dist/errors/not-implemented-error.js.map +1 -6
- package/dist/errors/sd-error.d.ts +10 -10
- package/dist/errors/sd-error.d.ts.map +1 -1
- package/dist/errors/sd-error.js +45 -24
- package/dist/errors/sd-error.js.map +1 -6
- package/dist/errors/timeout-error.d.ts +10 -10
- package/dist/errors/timeout-error.js +34 -15
- package/dist/errors/timeout-error.js.map +1 -6
- package/dist/extensions/arr-ext.d.ts +2 -2
- package/dist/extensions/arr-ext.helpers.d.ts +10 -10
- package/dist/extensions/arr-ext.helpers.js +112 -89
- package/dist/extensions/arr-ext.helpers.js.map +1 -6
- package/dist/extensions/arr-ext.js +458 -422
- package/dist/extensions/arr-ext.js.map +1 -6
- package/dist/extensions/arr-ext.types.d.ts +57 -57
- package/dist/extensions/arr-ext.types.d.ts.map +1 -1
- package/dist/extensions/arr-ext.types.js +6 -1
- package/dist/extensions/arr-ext.types.js.map +1 -6
- package/dist/extensions/map-ext.d.ts +16 -16
- package/dist/extensions/map-ext.js +27 -22
- package/dist/extensions/map-ext.js.map +1 -6
- package/dist/extensions/set-ext.d.ts +11 -11
- package/dist/extensions/set-ext.js +32 -25
- package/dist/extensions/set-ext.js.map +1 -6
- package/dist/features/debounce-queue.d.ts +17 -17
- package/dist/features/debounce-queue.js +98 -70
- package/dist/features/debounce-queue.js.map +1 -6
- package/dist/features/event-emitter.d.ts +20 -20
- package/dist/features/event-emitter.js +101 -78
- package/dist/features/event-emitter.js.map +1 -6
- package/dist/features/serial-queue.d.ts +11 -11
- package/dist/features/serial-queue.js +78 -57
- package/dist/features/serial-queue.js.map +1 -6
- package/dist/globals.d.ts +4 -4
- package/dist/globals.js +9 -1
- package/dist/globals.js.map +1 -6
- package/dist/index.js +28 -27
- package/dist/index.js.map +1 -6
- package/dist/types/date-only.d.ts +64 -64
- package/dist/types/date-only.d.ts.map +1 -1
- package/dist/types/date-only.js +263 -252
- package/dist/types/date-only.js.map +1 -6
- package/dist/types/date-time.d.ts +36 -36
- package/dist/types/date-time.d.ts.map +1 -1
- package/dist/types/date-time.js +196 -288
- package/dist/types/date-time.js.map +1 -6
- package/dist/types/lazy-gc-map.d.ts +26 -26
- package/dist/types/lazy-gc-map.d.ts.map +1 -1
- package/dist/types/lazy-gc-map.js +202 -159
- package/dist/types/lazy-gc-map.js.map +1 -6
- package/dist/types/time.d.ts +23 -23
- package/dist/types/time.d.ts.map +1 -1
- package/dist/types/time.js +169 -158
- package/dist/types/time.js.map +1 -6
- package/dist/types/uuid.d.ts +11 -11
- package/dist/types/uuid.d.ts.map +1 -1
- package/dist/types/uuid.js +95 -70
- package/dist/types/uuid.js.map +1 -6
- package/dist/utils/bytes.d.ts +17 -17
- package/dist/utils/bytes.js +137 -81
- package/dist/utils/bytes.js.map +1 -6
- package/dist/utils/date-format.d.ts +40 -40
- package/dist/utils/date-format.js +187 -101
- package/dist/utils/date-format.js.map +1 -6
- package/dist/utils/error.d.ts +4 -4
- package/dist/utils/error.js +11 -6
- package/dist/utils/error.js.map +1 -6
- package/dist/utils/json.d.ts +19 -19
- package/dist/utils/json.js +187 -135
- package/dist/utils/json.js.map +1 -6
- package/dist/utils/num.d.ts +20 -20
- package/dist/utils/num.js +76 -34
- package/dist/utils/num.js.map +1 -6
- package/dist/utils/obj.d.ts +111 -111
- package/dist/utils/obj.d.ts.map +1 -1
- package/dist/utils/obj.js +706 -496
- package/dist/utils/obj.js.map +1 -6
- package/dist/utils/path.d.ts +10 -10
- package/dist/utils/path.js +35 -18
- package/dist/utils/path.js.map +1 -6
- package/dist/utils/primitive.d.ts +5 -5
- package/dist/utils/primitive.js +34 -14
- package/dist/utils/primitive.js.map +1 -6
- package/dist/utils/str.d.ts +38 -38
- package/dist/utils/str.js +217 -113
- package/dist/utils/str.js.map +1 -6
- package/dist/utils/template-strings.d.ts +26 -26
- package/dist/utils/template-strings.js +113 -40
- package/dist/utils/template-strings.js.map +1 -6
- package/dist/utils/transferable.d.ts +18 -18
- package/dist/utils/transferable.js +218 -151
- package/dist/utils/transferable.js.map +1 -6
- package/dist/utils/wait.d.ts +9 -9
- package/dist/utils/wait.js +30 -15
- package/dist/utils/wait.js.map +1 -6
- package/dist/utils/xml.d.ts +13 -13
- package/dist/utils/xml.js +84 -46
- package/dist/utils/xml.js.map +1 -6
- package/dist/utils/zip.d.ts +22 -22
- package/dist/utils/zip.js +172 -148
- package/dist/utils/zip.js.map +1 -6
- package/docs/array-extensions.md +430 -0
- package/docs/env.md +52 -0
- package/docs/errors.md +41 -56
- package/docs/features.md +82 -97
- package/docs/type-utilities.md +91 -0
- package/docs/types.md +221 -201
- package/docs/utils.md +319 -435
- package/package.json +7 -5
- package/src/common.types.ts +14 -14
- package/src/env.ts +12 -3
- package/src/errors/argument-error.ts +15 -15
- package/src/errors/not-implemented-error.ts +9 -9
- package/src/errors/sd-error.ts +12 -12
- package/src/errors/timeout-error.ts +12 -12
- package/src/extensions/arr-ext.helpers.ts +16 -16
- package/src/extensions/arr-ext.ts +35 -35
- package/src/extensions/arr-ext.types.ts +57 -57
- package/src/extensions/map-ext.ts +16 -16
- package/src/extensions/set-ext.ts +11 -11
- package/src/features/debounce-queue.ts +23 -23
- package/src/features/event-emitter.ts +25 -25
- package/src/features/serial-queue.ts +13 -13
- package/src/globals.ts +4 -4
- package/src/index.ts +5 -5
- package/src/types/date-only.ts +84 -83
- package/src/types/date-time.ts +43 -42
- package/src/types/lazy-gc-map.ts +44 -44
- package/src/types/time.ts +29 -29
- package/src/types/uuid.ts +15 -15
- package/src/utils/bytes.ts +35 -35
- package/src/utils/date-format.ts +59 -59
- package/src/utils/error.ts +4 -4
- package/src/utils/json.ts +41 -41
- package/src/utils/num.ts +20 -20
- package/src/utils/obj.ts +138 -138
- package/src/utils/path.ts +10 -10
- package/src/utils/primitive.ts +6 -6
- package/src/utils/str.ts +48 -48
- package/src/utils/template-strings.ts +29 -29
- package/src/utils/transferable.ts +38 -38
- package/src/utils/wait.ts +10 -10
- package/src/utils/xml.ts +19 -19
- package/src/utils/zip.ts +25 -25
- package/docs/extensions.md +0 -387
- package/tests/errors/errors.spec.ts +0 -80
- package/tests/extensions/array-extension.spec.ts +0 -654
- package/tests/extensions/map-extension.spec.ts +0 -117
- package/tests/extensions/set-extension.spec.ts +0 -67
- package/tests/types/date-only.spec.ts +0 -533
- package/tests/types/date-time.spec.ts +0 -246
- package/tests/types/lazy-gc-map.spec.ts +0 -606
- package/tests/types/time.spec.ts +0 -428
- package/tests/types/uuid.spec.ts +0 -74
- package/tests/utils/bytes-utils.spec.ts +0 -197
- package/tests/utils/date-format.spec.ts +0 -350
- package/tests/utils/debounce-queue.spec.ts +0 -226
- package/tests/utils/json.spec.ts +0 -400
- package/tests/utils/number.spec.ts +0 -136
- package/tests/utils/object.spec.ts +0 -810
- package/tests/utils/path.spec.ts +0 -70
- package/tests/utils/primitive.spec.ts +0 -43
- package/tests/utils/sd-event-emitter.spec.ts +0 -189
- package/tests/utils/serial-queue.spec.ts +0 -305
- package/tests/utils/string.spec.ts +0 -265
- package/tests/utils/template-strings.spec.ts +0 -48
- package/tests/utils/transferable.spec.ts +0 -639
- package/tests/utils/wait.spec.ts +0 -123
- package/tests/utils/xml.spec.ts +0 -146
- package/tests/utils/zip.spec.ts +0 -221
package/README.md
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
# @simplysm/core-common
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Provides error classes, immutable date/time types, prototype extensions, event handling, and utility namespaces that work in both browser and Node.js environments.
|
|
3
|
+
Platform-neutral utility library for the Simplysm framework. Provides type-safe primitives, collection extensions, error hierarchy, async utilities, and serialization helpers that work in both browser and Node.js environments.
|
|
6
4
|
|
|
7
5
|
## Installation
|
|
8
6
|
|
|
@@ -10,26 +8,41 @@ Provides error classes, immutable date/time types, prototype extensions, event h
|
|
|
10
8
|
npm install @simplysm/core-common
|
|
11
9
|
```
|
|
12
10
|
|
|
13
|
-
##
|
|
11
|
+
## API Overview
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
### Environment
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
| API | Type | Description |
|
|
16
|
+
|-----|------|-------------|
|
|
17
|
+
| `env` | `object` | Unified environment variables from `import.meta.env` and `process.env` |
|
|
18
|
+
| `parseBoolEnv` | `function` | Parse a value to boolean (`"true"`, `"1"`, `"yes"`, `"on"` -> `true`) |
|
|
20
19
|
|
|
21
|
-
|
|
20
|
+
-> See [docs/env.md](./docs/env.md) for details.
|
|
22
21
|
|
|
23
|
-
|
|
22
|
+
### Array / Set / Map Extensions
|
|
23
|
+
|
|
24
|
+
| API | Type | Description |
|
|
25
|
+
|-----|------|-------------|
|
|
26
|
+
| `Array.prototype.*` | extension | 30+ methods: `single`, `first`, `last`, `groupBy`, `toMap`, `distinct`, `orderBy`, `diffs`, `sum`, `min`, `max`, etc. |
|
|
27
|
+
| `Set.prototype.adds` | extension | Add multiple values at once |
|
|
28
|
+
| `Set.prototype.toggle` | extension | Toggle a value (add if absent, remove if present) |
|
|
29
|
+
| `Map.prototype.getOrCreate` | extension | Get value or create with default/factory |
|
|
30
|
+
| `Map.prototype.update` | extension | Update a value using a function |
|
|
31
|
+
| `ArrayDiffsResult` | type | Result type for `diffs()` |
|
|
32
|
+
| `ArrayOneWayDiffResult` | type | Result type for `oneWayDiffs()` |
|
|
33
|
+
| `TreeArray` | type | Tree node type for `toTree()` |
|
|
34
|
+
| `ComparableType` | type | Union of types usable in ordering |
|
|
35
|
+
|
|
36
|
+
-> See [docs/array-extensions.md](./docs/array-extensions.md) for details.
|
|
24
37
|
|
|
25
38
|
### Errors
|
|
26
39
|
|
|
27
40
|
| API | Type | Description |
|
|
28
41
|
|-----|------|-------------|
|
|
29
|
-
| `SdError` | class |
|
|
42
|
+
| `SdError` | class | Tree-structured error with cause chaining |
|
|
30
43
|
| `ArgumentError` | class | Invalid argument error with YAML-formatted details |
|
|
31
44
|
| `NotImplementedError` | class | Unimplemented feature error |
|
|
32
|
-
| `TimeoutError` | class |
|
|
45
|
+
| `TimeoutError` | class | Timeout exceeded error |
|
|
33
46
|
|
|
34
47
|
-> See [docs/errors.md](./docs/errors.md) for details.
|
|
35
48
|
|
|
@@ -38,17 +51,10 @@ If you import only specific modules (e.g., `@simplysm/core-common/dist/types/dat
|
|
|
38
51
|
| API | Type | Description |
|
|
39
52
|
|-----|------|-------------|
|
|
40
53
|
| `Uuid` | class | UUID v4 generation and parsing |
|
|
41
|
-
| `
|
|
42
|
-
| `
|
|
43
|
-
| `
|
|
44
|
-
| `
|
|
45
|
-
| `Bytes` | type alias | `Uint8Array` (replaces `Buffer`) |
|
|
46
|
-
| `PrimitiveTypeMap` | type | Mapping of type name strings to types |
|
|
47
|
-
| `PrimitiveTypeStr` | type | `keyof PrimitiveTypeMap` |
|
|
48
|
-
| `PrimitiveType` | type | Union of all primitive types |
|
|
49
|
-
| `DeepPartial<T>` | type | Recursively makes all properties optional |
|
|
50
|
-
| `Type<T>` | interface | Constructor type for DI and factory patterns |
|
|
51
|
-
| `env` | const | Unified `DEV` / `VER` environment accessor |
|
|
54
|
+
| `LazyGcMap` | class | Auto-expiring Map with LRU-style GC |
|
|
55
|
+
| `DateTime` | class | Immutable date-time wrapper with millisecond precision |
|
|
56
|
+
| `DateOnly` | class | Immutable date-only wrapper (no time component) |
|
|
57
|
+
| `Time` | class | Immutable time-only wrapper (no date component, 24h cyclic) |
|
|
52
58
|
|
|
53
59
|
-> See [docs/types.md](./docs/types.md) for details.
|
|
54
60
|
|
|
@@ -56,105 +62,93 @@ If you import only specific modules (e.g., `@simplysm/core-common/dist/types/dat
|
|
|
56
62
|
|
|
57
63
|
| API | Type | Description |
|
|
58
64
|
|-----|------|-------------|
|
|
59
|
-
| `
|
|
60
|
-
| `
|
|
61
|
-
| `
|
|
65
|
+
| `DebounceQueue` | class | Async debounce queue -- only executes the last enqueued function |
|
|
66
|
+
| `SerialQueue` | class | Async serial queue -- executes functions one at a time in order |
|
|
67
|
+
| `EventEmitter` | class | Type-safe event emitter built on EventTarget |
|
|
62
68
|
|
|
63
69
|
-> See [docs/features.md](./docs/features.md) for details.
|
|
64
70
|
|
|
65
|
-
###
|
|
71
|
+
### Utils (Namespace Exports)
|
|
66
72
|
|
|
67
73
|
| API | Type | Description |
|
|
68
74
|
|-----|------|-------------|
|
|
69
|
-
| `
|
|
70
|
-
| `
|
|
71
|
-
| `
|
|
75
|
+
| `obj` | namespace | Deep clone, deep equal, deep merge, 3-way merge, omit, pick, chain access, type-safe keys/entries |
|
|
76
|
+
| `str` | namespace | Korean suffix, full-width conversion, case transforms, `isNullOrEmpty`, `insert` |
|
|
77
|
+
| `num` | namespace | parseInt, parseFloat, parseRoundedInt, isNullOrEmpty, format |
|
|
78
|
+
| `bytes` | namespace | Uint8Array concat, hex, base64 conversions |
|
|
79
|
+
| `path` | namespace | POSIX-style path join, basename, extname (browser-safe) |
|
|
80
|
+
| `json` | namespace | JSON stringify/parse with custom type support (DateTime, Uuid, Map, Set, etc.) |
|
|
81
|
+
| `xml` | namespace | XML parse/stringify via fast-xml-parser |
|
|
82
|
+
| `wait` | namespace | `until` (poll condition) and `time` (delay) |
|
|
83
|
+
| `transfer` | namespace | Worker-transferable encode/decode for custom types |
|
|
84
|
+
| `err` | namespace | Extract error message from unknown |
|
|
85
|
+
| `dt` | namespace | Date/time format strings (C#-style patterns) |
|
|
86
|
+
| `primitive` | namespace | Runtime primitive type string detection |
|
|
87
|
+
| `js`, `ts`, `html`, `tsql`, `mysql`, `pgsql` | template tag | IDE syntax highlighting template tags with indent normalization |
|
|
88
|
+
| `ZipArchive` | class | ZIP read/write/compress/extract |
|
|
72
89
|
|
|
73
|
-
-> See [docs/
|
|
90
|
+
-> See [docs/utils.md](./docs/utils.md) for details.
|
|
74
91
|
|
|
75
|
-
### Utilities
|
|
92
|
+
### Type Utilities
|
|
76
93
|
|
|
77
94
|
| API | Type | Description |
|
|
78
95
|
|-----|------|-------------|
|
|
79
|
-
| `
|
|
80
|
-
| `
|
|
81
|
-
| `
|
|
82
|
-
| `
|
|
83
|
-
| `
|
|
84
|
-
| `
|
|
85
|
-
| `xml` | namespace | XML parse/stringify via fast-xml-parser |
|
|
86
|
-
| `wait` | namespace | `until` (polling) and `time` (delay) |
|
|
87
|
-
| `transfer` | namespace | Worker-safe encode/decode for custom types |
|
|
88
|
-
| `err` | namespace | Extract message from unknown error |
|
|
89
|
-
| `dt` | namespace | Date format, month normalization, 12h/24h conversion |
|
|
90
|
-
| `primitive` | namespace | Infer `PrimitiveTypeStr` from a value |
|
|
91
|
-
| `js`, `ts`, `html`, `tsql`, `mysql`, `pgsql` | function | Template tag functions for syntax highlighting |
|
|
92
|
-
| `ZipArchive` | class | ZIP read/write/compress with caching |
|
|
96
|
+
| `Bytes` | type alias | `Uint8Array` (replaces `Buffer`) |
|
|
97
|
+
| `PrimitiveTypeMap` | type | Maps type-string keys to their TypeScript types |
|
|
98
|
+
| `PrimitiveTypeStr` | type | `"string" \| "number" \| "boolean" \| "DateTime" \| "DateOnly" \| "Time" \| "Uuid" \| "Bytes"` |
|
|
99
|
+
| `PrimitiveType` | type | Union of all primitive type values |
|
|
100
|
+
| `DeepPartial<T>` | type | Recursively makes all properties optional |
|
|
101
|
+
| `Type<T>` | interface | Constructor type (`new (...args) => T`) |
|
|
93
102
|
|
|
94
|
-
-> See [docs/
|
|
103
|
+
-> See [docs/type-utilities.md](./docs/type-utilities.md) for details.
|
|
95
104
|
|
|
96
|
-
##
|
|
105
|
+
## Usage Examples
|
|
97
106
|
|
|
98
|
-
###
|
|
107
|
+
### Deep cloning and comparing objects
|
|
99
108
|
|
|
100
109
|
```typescript
|
|
101
|
-
import {
|
|
110
|
+
import { obj } from "@simplysm/core-common";
|
|
102
111
|
|
|
103
|
-
const
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
const parsed = DateTime.parse("2025-01-15 10:30:00");
|
|
112
|
+
const original = { a: 1, b: { c: [2, 3] } };
|
|
113
|
+
const cloned = obj.clone(original);
|
|
114
|
+
obj.equal(original, cloned); // true
|
|
107
115
|
|
|
108
|
-
const
|
|
109
|
-
|
|
116
|
+
const merged = obj.merge(original, { b: { d: 4 } });
|
|
117
|
+
// { a: 1, b: { c: [2, 3], d: 4 } }
|
|
110
118
|
```
|
|
111
119
|
|
|
112
|
-
###
|
|
120
|
+
### Using Array extensions
|
|
113
121
|
|
|
114
122
|
```typescript
|
|
115
|
-
import
|
|
116
|
-
|
|
117
|
-
const cloned = obj.clone(deepObject);
|
|
118
|
-
const isEqual = obj.equal(a, b, { ignoreArrayIndex: true });
|
|
119
|
-
const merged = obj.merge(base, override);
|
|
120
|
-
const value = obj.getChainValue(data, "a.b[0].c");
|
|
121
|
-
|
|
122
|
-
// Custom-type-aware JSON
|
|
123
|
-
const str = json.stringify({ date: new DateTime(), id: Uuid.generate() });
|
|
124
|
-
const restored = json.parse(str); // DateTime and Uuid instances restored
|
|
125
|
-
```
|
|
123
|
+
import "@simplysm/core-common";
|
|
126
124
|
|
|
127
|
-
|
|
125
|
+
const users = [
|
|
126
|
+
{ id: 1, role: "admin", name: "Alice" },
|
|
127
|
+
{ id: 2, role: "user", name: "Bob" },
|
|
128
|
+
{ id: 3, role: "user", name: "Carol" },
|
|
129
|
+
];
|
|
128
130
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
+
const grouped = users.groupBy((u) => u.role);
|
|
132
|
+
// [{ key: "admin", values: [Alice] }, { key: "user", values: [Bob, Carol] }]
|
|
131
133
|
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
items.orderBy(); // [1, 1, 3, 4, 5]
|
|
135
|
-
items.sum(); // 14
|
|
136
|
-
items.groupBy((x) => x % 2 === 0 ? "even" : "odd");
|
|
134
|
+
const userMap = users.toMap((u) => u.id);
|
|
135
|
+
// Map { 1 => Alice, 2 => Bob, 3 => Carol }
|
|
137
136
|
|
|
138
|
-
const
|
|
139
|
-
users.toMap((u) => u.id); // Map { 1 => {...}, 2 => {...} }
|
|
140
|
-
users.single((u) => u.id === 1); // { id: 1, name: "A" }
|
|
137
|
+
const sorted = users.orderBy((u) => u.name);
|
|
141
138
|
```
|
|
142
139
|
|
|
143
|
-
###
|
|
140
|
+
### JSON serialization with custom types
|
|
144
141
|
|
|
145
142
|
```typescript
|
|
146
|
-
import {
|
|
143
|
+
import { json, DateTime, Uuid } from "@simplysm/core-common";
|
|
147
144
|
|
|
148
|
-
|
|
145
|
+
const data = {
|
|
146
|
+
id: Uuid.generate(),
|
|
147
|
+
createdAt: new DateTime(2025, 6, 15, 10, 30, 0),
|
|
148
|
+
tags: new Set(["a", "b"]),
|
|
149
|
+
};
|
|
149
150
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
svc.on("data", (msg) => console.log(msg));
|
|
154
|
-
svc.emit("data", "hello");
|
|
155
|
-
svc.emit("done");
|
|
151
|
+
const serialized = json.stringify(data);
|
|
152
|
+
const restored = json.parse(serialized);
|
|
153
|
+
// restored.id is Uuid, restored.createdAt is DateTime, restored.tags is Set
|
|
156
154
|
```
|
|
157
|
-
|
|
158
|
-
## License
|
|
159
|
-
|
|
160
|
-
Apache-2.0
|
package/dist/common.types.d.ts
CHANGED
|
@@ -3,12 +3,12 @@ import { DateOnly } from "./types/date-only";
|
|
|
3
3
|
import { Time } from "./types/time";
|
|
4
4
|
import { Uuid } from "./types/uuid";
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Buffer 대신 사용하는 바이너리 타입
|
|
7
7
|
*/
|
|
8
8
|
export type Bytes = Uint8Array;
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* 원시 타입 매핑
|
|
11
|
+
* orm-common과 공유
|
|
12
12
|
*/
|
|
13
13
|
export type PrimitiveTypeMap = {
|
|
14
14
|
string: string;
|
|
@@ -21,19 +21,19 @@ export type PrimitiveTypeMap = {
|
|
|
21
21
|
Bytes: Bytes;
|
|
22
22
|
};
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* 원시 타입 문자열 key
|
|
25
25
|
*/
|
|
26
26
|
export type PrimitiveTypeStr = keyof PrimitiveTypeMap;
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* 원시 타입 union
|
|
29
29
|
*/
|
|
30
30
|
export type PrimitiveType = PrimitiveTypeMap[PrimitiveTypeStr] | undefined;
|
|
31
31
|
/**
|
|
32
|
-
* Deep Partial
|
|
32
|
+
* Deep Partial 타입
|
|
33
33
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
34
|
+
* 객체의 모든 속성을 재귀적으로 optional로 만든다.
|
|
35
|
+
* 원시 타입(string, number, boolean 등)은 그대로 유지하고,
|
|
36
|
+
* object/array 타입에만 재귀적으로 Partial을 적용한다.
|
|
37
37
|
*
|
|
38
38
|
* @example
|
|
39
39
|
* ```typescript
|
|
@@ -45,7 +45,7 @@ export type PrimitiveType = PrimitiveTypeMap[PrimitiveTypeStr] | undefined;
|
|
|
45
45
|
* };
|
|
46
46
|
* }
|
|
47
47
|
*
|
|
48
|
-
* //
|
|
48
|
+
* // 모든 깊이의 속성이 optional이 됨
|
|
49
49
|
* const partial: DeepPartial<User> = {
|
|
50
50
|
* profile: { address: {} }
|
|
51
51
|
* };
|
|
@@ -55,10 +55,10 @@ export type DeepPartial<TObject> = Partial<{
|
|
|
55
55
|
[K in keyof TObject]: TObject[K] extends PrimitiveType ? TObject[K] : DeepPartial<TObject[K]>;
|
|
56
56
|
}>;
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
58
|
+
* 생성자 타입
|
|
59
59
|
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
60
|
+
* 클래스 생성자를 타입으로 표현할 때 사용한다.
|
|
61
|
+
* 주로 의존성 주입, 팩토리 패턴, instanceof 체크에 활용된다.
|
|
62
62
|
*
|
|
63
63
|
* @example
|
|
64
64
|
* function create<T>(ctor: Type<T>): T {
|
|
@@ -66,7 +66,7 @@ export type DeepPartial<TObject> = Partial<{
|
|
|
66
66
|
* }
|
|
67
67
|
*
|
|
68
68
|
* class MyClass { name = "test"; }
|
|
69
|
-
* const instance = create(MyClass); // MyClass
|
|
69
|
+
* const instance = create(MyClass); // MyClass 인스턴스
|
|
70
70
|
*/
|
|
71
71
|
export interface Type<TInstance> extends Function {
|
|
72
72
|
new (...args: unknown[]): TInstance;
|
package/dist/common.types.js
CHANGED
|
@@ -2,4 +2,5 @@ import { DateTime } from "./types/date-time.js";
|
|
|
2
2
|
import { DateOnly } from "./types/date-only.js";
|
|
3
3
|
import { Time } from "./types/time.js";
|
|
4
4
|
import { Uuid } from "./types/uuid.js";
|
|
5
|
-
//#
|
|
5
|
+
//#endregion
|
|
6
|
+
//# sourceMappingURL=common.types.js.map
|
package/dist/common.types.js.map
CHANGED
|
@@ -1,6 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/common.types.ts"],
|
|
4
|
-
"mappings": "AAAA,SAAS,gBAAgB;AACzB,SAAS,gBAAgB;AACzB,SAAS,YAAY;AACrB,SAAS,YAAY;",
|
|
5
|
-
"names": []
|
|
6
|
-
}
|
|
1
|
+
{"version":3,"file":"common.types.js","sourceRoot":"","sources":["../src/common.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAuFpC,YAAY"}
|
package/dist/env.d.ts
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
declare global {
|
|
2
|
+
interface ImportMetaEnv extends Record<string, unknown> {
|
|
3
|
+
}
|
|
2
4
|
interface ImportMeta {
|
|
3
|
-
env
|
|
5
|
+
readonly env: ImportMetaEnv;
|
|
4
6
|
}
|
|
5
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* 환경변수 값을 boolean으로 파싱
|
|
10
|
+
* "true", "1", "yes", "on" (대소문자 무시) → true, 그 외 → false
|
|
11
|
+
*/
|
|
12
|
+
export declare function parseBoolEnv(value: unknown): boolean;
|
|
6
13
|
export declare const env: {
|
|
7
14
|
DEV: boolean;
|
|
8
15
|
VER?: string;
|
package/dist/env.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAEA,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,UAAU;QAClB,
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAEA,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,aAAc,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;KAAG;IAC1D,UAAU,UAAU;QAClB,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAC;KAC7B;CACF;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAEpD;AAMD,eAAO,MAAM,GAAG,EAAE;IAChB,GAAG,EAAE,OAAO,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAKxB,CAAC"}
|
package/dist/env.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* 환경변수 값을 boolean으로 파싱
|
|
3
|
+
* "true", "1", "yes", "on" (대소문자 무시) → true, 그 외 → false
|
|
4
|
+
*/
|
|
5
|
+
export function parseBoolEnv(value) {
|
|
6
|
+
return ["true", "1", "yes", "on"].includes(String(value ?? "").toLowerCase());
|
|
7
|
+
}
|
|
8
|
+
const _metaEnv = { ...import.meta.env };
|
|
2
9
|
const _processEnv = typeof process !== "undefined" ? process.env : {};
|
|
3
10
|
const _raw = { ..._metaEnv, ..._processEnv };
|
|
4
|
-
const env = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
11
|
+
export const env = {
|
|
12
|
+
..._raw,
|
|
13
|
+
DEV: parseBoolEnv(_raw["DEV"]),
|
|
14
|
+
VER: _raw["VER"],
|
|
8
15
|
};
|
|
9
|
-
|
|
10
|
-
env
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=env.js.map
|
|
16
|
+
//# sourceMappingURL=env.js.map
|
package/dist/env.js.map
CHANGED
|
@@ -1,6 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/env.ts"],
|
|
4
|
-
"mappings": "AAQA,MAAM,WAAoC,YAAY,OAAO,CAAC;AAC9D,MAAM,cAAuC,OAAO,YAAY,cAAc,QAAQ,MAAM,CAAC;AAC7F,MAAM,OAAgC,EAAE,GAAG,UAAU,GAAG,YAAY;AAE7D,MAAM,MAIT;AAAA,EACF,GAAG;AAAA,EACH,KAAK,KAAK,MAAM,OAAO,KAAK,KAAK,KAAK,QAAQ,OAAO,KAAK,KAAK,CAAC,MAAM,KAAK,KAAK,KAAK,IAAI,KAAK,CAAC;AAAA,EAC/F,KAAK,KAAK,KAAK;AACjB;",
|
|
5
|
-
"names": []
|
|
6
|
-
}
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AASA;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,OAAO,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;AAChF,CAAC;AAED,MAAM,QAAQ,GAA4B,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;AACjE,MAAM,WAAW,GAA4B,OAAO,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;AAC/F,MAAM,IAAI,GAA4B,EAAE,GAAG,QAAQ,EAAE,GAAG,WAAW,EAAE,CAAC;AAEtE,MAAM,CAAC,MAAM,GAAG,GAIZ;IACF,GAAG,IAAI;IACP,GAAG,EAAE,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC9B,GAAG,EAAE,IAAI,CAAC,KAAK,CAAuB;CACvC,CAAC"}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { SdError } from "./sd-error";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* 인자 오류
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* 유효하지 않은 인자를 전달받았을 때 발생하는 에러.
|
|
6
|
+
* 디버깅을 용이하게 하기 위해 인자 객체를 YAML 형식으로 메시지에 포함한다.
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
|
-
* //
|
|
9
|
+
* // 인자 객체만 전달
|
|
10
10
|
* throw new ArgumentError({ userId: 123, name: null });
|
|
11
|
-
* //
|
|
11
|
+
* // 결과 메시지: "잘못된 인자입니다.\n\nuserId: 123\nname: null"
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
|
-
* //
|
|
15
|
-
* throw new ArgumentError("
|
|
16
|
-
* //
|
|
14
|
+
* // 커스텀 메시지와 인자 객체를 전달
|
|
15
|
+
* throw new ArgumentError("잘못된 사용자", { userId: 123 });
|
|
16
|
+
* // 결과 메시지: "잘못된 사용자\n\nuserId: 123"
|
|
17
17
|
*/
|
|
18
18
|
export declare class ArgumentError extends SdError {
|
|
19
|
-
/**
|
|
19
|
+
/** 기본 메시지("잘못된 인자입니다.")와 함께 인자 객체를 YAML 형식으로 출력 */
|
|
20
20
|
constructor(argObj: Record<string, unknown>);
|
|
21
|
-
/**
|
|
21
|
+
/** 커스텀 메시지와 함께 인자 객체를 YAML 형식으로 출력 */
|
|
22
22
|
constructor(message: string, argObj: Record<string, unknown>);
|
|
23
23
|
constructor(arg1: Record<string, unknown> | string, arg2?: Record<string, unknown>);
|
|
24
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"argument-error.d.ts","sourceRoot":"","sources":["../../src/errors/argument-error.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,aAAc,SAAQ,OAAO;IACxC,
|
|
1
|
+
{"version":3,"file":"argument-error.d.ts","sourceRoot":"","sources":["../../src/errors/argument-error.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,aAAc,SAAQ,OAAO;IACxC,mDAAmD;gBACvC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC3C,sCAAsC;gBAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;gBAChD,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAYnF"}
|
|
@@ -1,18 +1,35 @@
|
|
|
1
|
+
// yaml 라이브러리를 사용하는 이유:
|
|
2
|
+
// 중첩된 객체 구조를 읽기 쉬운 형식으로 표현하기 위함.
|
|
3
|
+
// JSON.stringify보다 트리 구조가 더 명확하게 보임.
|
|
1
4
|
import YAML from "yaml";
|
|
2
5
|
import { SdError } from "./sd-error.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
/**
|
|
7
|
+
* 인자 오류
|
|
8
|
+
*
|
|
9
|
+
* 유효하지 않은 인자를 전달받았을 때 발생하는 에러.
|
|
10
|
+
* 디버깅을 용이하게 하기 위해 인자 객체를 YAML 형식으로 메시지에 포함한다.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // 인자 객체만 전달
|
|
14
|
+
* throw new ArgumentError({ userId: 123, name: null });
|
|
15
|
+
* // 결과 메시지: "잘못된 인자입니다.\n\nuserId: 123\nname: null"
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* // 커스텀 메시지와 인자 객체를 전달
|
|
19
|
+
* throw new ArgumentError("잘못된 사용자", { userId: 123 });
|
|
20
|
+
* // 결과 메시지: "잘못된 사용자\n\nuserId: 123"
|
|
21
|
+
*/
|
|
22
|
+
export class ArgumentError extends SdError {
|
|
23
|
+
constructor(arg1, arg2) {
|
|
24
|
+
const message = typeof arg1 === "string" ? arg1 : undefined;
|
|
25
|
+
const argObj = typeof arg1 === "string" ? arg2 : arg1;
|
|
26
|
+
if (argObj != null) {
|
|
27
|
+
super((message ?? "잘못된 인자입니다.") + "\n\n" + YAML.stringify(argObj));
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
super(message ?? "잘못된 인자입니다.");
|
|
31
|
+
}
|
|
32
|
+
this.name = "ArgumentError";
|
|
11
33
|
}
|
|
12
|
-
this.name = "ArgumentError";
|
|
13
|
-
}
|
|
14
34
|
}
|
|
15
|
-
|
|
16
|
-
ArgumentError
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=argument-error.js.map
|
|
35
|
+
//# sourceMappingURL=argument-error.js.map
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/errors/argument-error.ts"],
|
|
4
|
-
"mappings": "AAGA,OAAO,UAAU;AACjB,SAAS,eAAe;AAkBjB,MAAM,sBAAsB,QAAQ;AAAA,EAMzC,YAAY,MAAwC,MAAgC;AAClF,UAAM,UAAU,OAAO,SAAS,WAAW,OAAO;AAClD,UAAM,SAAS,OAAO,SAAS,WAAW,OAAO;AAEjD,QAAI,UAAU,MAAM;AAClB,aAAO,WAAW,wBAAwB,SAAS,KAAK,UAAU,MAAM,CAAC;AAAA,IAC3E,OAAO;AACL,YAAM,WAAW,oBAAoB;AAAA,IACvC;AACA,SAAK,OAAO;AAAA,EACd;AACF;",
|
|
5
|
-
"names": []
|
|
6
|
-
}
|
|
1
|
+
{"version":3,"file":"argument-error.js","sourceRoot":"","sources":["../../src/errors/argument-error.ts"],"names":[],"mappings":"AAAA,uBAAuB;AACvB,iCAAiC;AACjC,qCAAqC;AACrC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,aAAc,SAAQ,OAAO;IAMxC,YAAY,IAAsC,EAAE,IAA8B;QAChF,MAAM,OAAO,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;QAC5D,MAAM,MAAM,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;QAEtD,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;YACnB,KAAK,CAAC,CAAC,OAAO,IAAI,YAAY,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;QACrE,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,OAAO,IAAI,YAAY,CAAC,CAAC;QACjC,CAAC;QACD,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF"}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { SdError } from "./sd-error";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* 미구현 오류
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* 아직 구현되지 않은 기능이 호출되었을 때 발생하는 에러.
|
|
6
|
+
* 추상 메서드 스텁, 향후 구현 예정인 분기 등에 사용된다.
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
|
-
* //
|
|
9
|
+
* // 추상 메서드 구현 전
|
|
10
10
|
* class BaseService {
|
|
11
11
|
* process(): void {
|
|
12
|
-
* throw new NotImplementedError("
|
|
12
|
+
* throw new NotImplementedError("서브클래스에서 구현 필요");
|
|
13
13
|
* }
|
|
14
14
|
* }
|
|
15
15
|
*
|
|
16
16
|
* @example
|
|
17
|
-
* //
|
|
17
|
+
* // 향후 구현 예정인 분기
|
|
18
18
|
* switch (type) {
|
|
19
19
|
* case "A": return handleA();
|
|
20
|
-
* case "B": throw new NotImplementedError(
|
|
20
|
+
* case "B": throw new NotImplementedError(`타입 ${type} 처리`);
|
|
21
21
|
* }
|
|
22
22
|
*/
|
|
23
23
|
export declare class NotImplementedError extends SdError {
|
|
24
24
|
/**
|
|
25
|
-
* @param message
|
|
25
|
+
* @param message 추가 설명 메시지
|
|
26
26
|
*/
|
|
27
27
|
constructor(message?: string);
|
|
28
28
|
}
|
|
@@ -1,14 +1,32 @@
|
|
|
1
1
|
import { SdError } from "./sd-error.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
/**
|
|
3
|
+
* 미구현 오류
|
|
4
|
+
*
|
|
5
|
+
* 아직 구현되지 않은 기능이 호출되었을 때 발생하는 에러.
|
|
6
|
+
* 추상 메서드 스텁, 향후 구현 예정인 분기 등에 사용된다.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* // 추상 메서드 구현 전
|
|
10
|
+
* class BaseService {
|
|
11
|
+
* process(): void {
|
|
12
|
+
* throw new NotImplementedError("서브클래스에서 구현 필요");
|
|
13
|
+
* }
|
|
14
|
+
* }
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // 향후 구현 예정인 분기
|
|
18
|
+
* switch (type) {
|
|
19
|
+
* case "A": return handleA();
|
|
20
|
+
* case "B": throw new NotImplementedError(`타입 ${type} 처리`);
|
|
21
|
+
* }
|
|
22
|
+
*/
|
|
23
|
+
export class NotImplementedError extends SdError {
|
|
24
|
+
/**
|
|
25
|
+
* @param message 추가 설명 메시지
|
|
26
|
+
*/
|
|
27
|
+
constructor(message) {
|
|
28
|
+
super("미구현" + (message != null ? ": " + message : ""));
|
|
29
|
+
this.name = "NotImplementedError";
|
|
30
|
+
}
|
|
10
31
|
}
|
|
11
|
-
|
|
12
|
-
NotImplementedError
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=not-implemented-error.js.map
|
|
32
|
+
//# sourceMappingURL=not-implemented-error.js.map
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/errors/not-implemented-error.ts"],
|
|
4
|
-
"mappings": "AAAA,SAAS,eAAe;AAuBjB,MAAM,4BAA4B,QAAQ;AAAA;AAAA;AAAA;AAAA,EAI/C,YAAY,SAAkB;AAC5B,UAAM,qBAAqB,WAAW,OAAO,OAAO,UAAU,GAAG;AACjE,SAAK,OAAO;AAAA,EACd;AACF;",
|
|
5
|
-
"names": []
|
|
6
|
-
}
|
|
1
|
+
{"version":3,"file":"not-implemented-error.js","sourceRoot":"","sources":["../../src/errors/not-implemented-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,mBAAoB,SAAQ,OAAO;IAC9C;;OAEG;IACH,YAAY,OAAgB;QAC1B,KAAK,CAAC,KAAK,GAAG,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACvD,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF"}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* 트리 구조 조합을 지원하는 에러 클래스
|
|
3
|
+
* ES2024 cause 속성을 활용
|
|
4
4
|
*
|
|
5
5
|
* @example
|
|
6
|
-
* //
|
|
6
|
+
* // 원인 에러를 감싸기
|
|
7
7
|
* try {
|
|
8
8
|
* await fetch(url);
|
|
9
9
|
* } catch (err) {
|
|
10
|
-
* throw new SdError(err, "API
|
|
10
|
+
* throw new SdError(err, "API 호출 실패", "사용자 로드 실패");
|
|
11
11
|
* }
|
|
12
|
-
* //
|
|
12
|
+
* // 결과 메시지: "사용자 로드 실패 => API 호출 실패 => 원본 에러 메시지"
|
|
13
13
|
*
|
|
14
14
|
* @example
|
|
15
|
-
* //
|
|
16
|
-
* throw new SdError("
|
|
17
|
-
* //
|
|
15
|
+
* // 메시지만으로 생성
|
|
16
|
+
* throw new SdError("잘못된 상태", "처리 불가");
|
|
17
|
+
* // 결과 메시지: "처리 불가 => 잘못된 상태"
|
|
18
18
|
*/
|
|
19
19
|
export declare class SdError extends Error {
|
|
20
20
|
cause?: Error;
|
|
21
|
-
/**
|
|
21
|
+
/** 원인 에러를 감싸서 생성. 메시지는 역순으로 결합됨 (상위 메시지 => 하위 메시지 => 원인 메시지) */
|
|
22
22
|
constructor(cause: Error, ...messages: string[]);
|
|
23
|
-
/**
|
|
23
|
+
/** 메시지만으로 생성. 메시지는 역순으로 결합됨 (상위 메시지 => 하위 메시지) */
|
|
24
24
|
constructor(...messages: string[]);
|
|
25
25
|
constructor(arg1?: unknown, ...messages: string[]);
|
|
26
26
|
}
|