ts-deco 1.0.3
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 +294 -0
- package/dist/decorators/utils/apply-decorators.d.ts +21 -0
- package/dist/decorators/utils/apply-decorators.d.ts.map +1 -0
- package/dist/decorators/utils/apply-decorators.js +52 -0
- package/dist/decorators/utils/apply-decorators.js.map +1 -0
- package/dist/decorators/validators/boolean.decorator.d.ts +6 -0
- package/dist/decorators/validators/boolean.decorator.d.ts.map +1 -0
- package/dist/decorators/validators/boolean.decorator.js +40 -0
- package/dist/decorators/validators/boolean.decorator.js.map +1 -0
- package/dist/decorators/validators/date.decorator.d.ts +6 -0
- package/dist/decorators/validators/date.decorator.d.ts.map +1 -0
- package/dist/decorators/validators/date.decorator.js +24 -0
- package/dist/decorators/validators/date.decorator.js.map +1 -0
- package/dist/decorators/validators/enum.decorator.d.ts +6 -0
- package/dist/decorators/validators/enum.decorator.d.ts.map +1 -0
- package/dist/decorators/validators/enum.decorator.js +15 -0
- package/dist/decorators/validators/enum.decorator.js.map +1 -0
- package/dist/decorators/validators/number.decorator.d.ts +7 -0
- package/dist/decorators/validators/number.decorator.d.ts.map +1 -0
- package/dist/decorators/validators/number.decorator.js +45 -0
- package/dist/decorators/validators/number.decorator.js.map +1 -0
- package/dist/decorators/validators/property.decorator.d.ts +14 -0
- package/dist/decorators/validators/property.decorator.d.ts.map +1 -0
- package/dist/decorators/validators/property.decorator.js +58 -0
- package/dist/decorators/validators/property.decorator.js.map +1 -0
- package/dist/decorators/validators/string.decorator.d.ts +6 -0
- package/dist/decorators/validators/string.decorator.d.ts.map +1 -0
- package/dist/decorators/validators/string.decorator.js +15 -0
- package/dist/decorators/validators/string.decorator.js.map +1 -0
- package/dist/decorators/validators/utils/common-decorators.d.ts +46 -0
- package/dist/decorators/validators/utils/common-decorators.d.ts.map +1 -0
- package/dist/decorators/validators/utils/common-decorators.js +75 -0
- package/dist/decorators/validators/utils/common-decorators.js.map +1 -0
- package/dist/decorators/validators/utils/swagger.decorator.d.ts +8 -0
- package/dist/decorators/validators/utils/swagger.decorator.d.ts.map +1 -0
- package/dist/decorators/validators/utils/swagger.decorator.js +38 -0
- package/dist/decorators/validators/utils/swagger.decorator.js.map +1 -0
- package/dist/decorators/validators/utils/swagger.types.d.ts +45 -0
- package/dist/decorators/validators/utils/swagger.types.d.ts.map +1 -0
- package/dist/decorators/validators/utils/swagger.types.js +3 -0
- package/dist/decorators/validators/utils/swagger.types.js.map +1 -0
- package/dist/decorators/validators/utils/validator-options.d.ts +8 -0
- package/dist/decorators/validators/utils/validator-options.d.ts.map +1 -0
- package/dist/decorators/validators/utils/validator-options.js +11 -0
- package/dist/decorators/validators/utils/validator-options.js.map +1 -0
- package/dist/decorators/validators/validator.type.d.ts +20 -0
- package/dist/decorators/validators/validator.type.d.ts.map +1 -0
- package/dist/decorators/validators/validator.type.js +3 -0
- package/dist/decorators/validators/validator.type.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/package.json +40 -0
package/README.md
ADDED
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
# ts-deco
|
|
2
|
+
|
|
3
|
+
TypeScript decorator utilities with **strict validation standards**
|
|
4
|
+
|
|
5
|
+
## νΉμ§
|
|
6
|
+
|
|
7
|
+
### π μ격ν κ²μ¦ κΈ°μ€
|
|
8
|
+
|
|
9
|
+
κΈ°μ‘΄μ λλν 컀μ€ν
λ°μ½λ μ΄ν° λ°©μκ³Ό λ¬λ¦¬, `ts-deco`λ **μ격ν νμ
κ²μ¦κ³Ό κ²μ¦ κ·μΉ**μ μ 곡ν©λλ€.
|
|
10
|
+
|
|
11
|
+
- β
**νμ
μμ μ±**: λͺ¨λ λ°μ½λ μ΄ν°λ μ격ν νμ
체ν¬λ₯Ό κ±°μΉ©λλ€
|
|
12
|
+
- β
**λͺ
μμ κ²μ¦**: μ΅μ
κ³Ό κ²μ¦ κ·μΉμ΄ λͺ
ννκ² μ μλμ΄ μμ΅λλ€
|
|
13
|
+
- β
**μΌκ΄λ λμ**: λͺ¨λ λ°μ½λ μ΄ν°κ° λμΌν κΈ°μ€μΌλ‘ λμν©λλ€
|
|
14
|
+
- β
**λ°νμ μμ μ±**: μλͺ»λ νμ
μ΄λ κ°μ λν΄ λͺ
νν μλ¬λ₯Ό μ 곡ν©λλ€
|
|
15
|
+
|
|
16
|
+
### κΈ°μ‘΄ λ°©μ vs ts-deco
|
|
17
|
+
|
|
18
|
+
| κΈ°μ‘΄ 컀μ€ν
λ°©μ | ts-deco |
|
|
19
|
+
|----------------|---------|
|
|
20
|
+
| λμ¨ν νμ
μ²΄ν¬ | μ격ν νμ
κ²μ¦ |
|
|
21
|
+
| λΆλͺ
νν κ²μ¦ κ·μΉ | λͺ
μμ κ²μ¦ μ΅μ
|
|
|
22
|
+
| μΌκ΄μ± μλ λμ | νμ€νλ λμ |
|
|
23
|
+
| λ°νμ μλ¬ κ°λ₯μ± | νμ
μμ μ± λ³΄μ₯ |
|
|
24
|
+
|
|
25
|
+
## μ€μΉ
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install ts-deco
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## λ°°ν¬
|
|
32
|
+
|
|
33
|
+
### μ¬μ μ€λΉ
|
|
34
|
+
|
|
35
|
+
#### 1. npm λ‘κ·ΈμΈ
|
|
36
|
+
|
|
37
|
+
λ°°ν¬νκΈ° μ μ npmμ λ‘κ·ΈμΈν΄μΌ ν©λλ€:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm login
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
npm κ³μ μ΄ μλ€λ©΄ [npmjs.com](https://www.npmjs.com)μμ κ³μ μ μμ±νμΈμ.
|
|
44
|
+
|
|
45
|
+
#### 2. 2λ¨κ³ μΈμ¦ (2FA) μ€μ
|
|
46
|
+
|
|
47
|
+
npm ν¨ν€μ§ λ°°ν¬λ₯Ό μν΄μλ **2λ¨κ³ μΈμ¦(2FA)** λλ **granular access token**μ΄ νμν©λλ€.
|
|
48
|
+
|
|
49
|
+
**λ°©λ² 1: 2FA νμ±ν (κΆμ₯)**
|
|
50
|
+
|
|
51
|
+
1. [npmjs.com](https://www.npmjs.com)μ λ‘κ·ΈμΈ
|
|
52
|
+
2. κ³μ μ€μ β "Two-Factor Authentication" νμ±ν
|
|
53
|
+
3. μΈμ¦ μ±(Google Authenticator λ±)μΌλ‘ QR μ½λ μ€μΊ
|
|
54
|
+
4. λ°°ν¬ μ OTP μ½λ μ
λ ₯
|
|
55
|
+
|
|
56
|
+
**λ°©λ² 2: Granular Access Token μ¬μ©**
|
|
57
|
+
|
|
58
|
+
1. [npmjs.com](https://www.npmjs.com) β Account Settings β Access Tokens
|
|
59
|
+
2. "Generate New Token" β "Granular Access Token" μ ν
|
|
60
|
+
3. κΆν: "Publish" μ ν
|
|
61
|
+
4. "Bypass 2FA" μ΅μ
νμ±ν (μ νμ¬ν)
|
|
62
|
+
5. μμ±λ ν ν°μ μ¬μ©νμ¬ λ‘κ·ΈμΈ:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
npm login --auth-type=legacy
|
|
66
|
+
# λλ νκ²½λ³μλ‘ μ€μ
|
|
67
|
+
export NPM_TOKEN=your_token_here
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
> **μ°Έκ³ **: Granular Access Tokenμ μ¬μ©νλ©΄ 2FAλ₯Ό μ°νν μ μμ§λ§, 보μμ μν΄ 2FA νμ±νλ₯Ό κΆμ₯ν©λλ€.
|
|
71
|
+
|
|
72
|
+
### npm μ€ν¬λ¦½νΈ μ¬μ©
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# ν¨μΉ λ²μ (1.0.0 -> 1.0.1)
|
|
76
|
+
npm run publish:patch
|
|
77
|
+
|
|
78
|
+
# λ§μ΄λ λ²μ (1.0.0 -> 1.1.0)
|
|
79
|
+
npm run publish:minor
|
|
80
|
+
|
|
81
|
+
# λ©μ΄μ λ²μ (1.0.0 -> 2.0.0)
|
|
82
|
+
npm run publish:major
|
|
83
|
+
|
|
84
|
+
# λ°°ν¬ μ νμΈ (μ€μ λ°°ν¬νμ§ μμ)
|
|
85
|
+
npm run publish:dry-run
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### λ°°ν¬ μ€ν¬λ¦½νΈ μ¬μ©
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# ν¨μΉ λ²μ λ°°ν¬
|
|
92
|
+
./deploy.sh patch
|
|
93
|
+
|
|
94
|
+
# λ§μ΄λ λ²μ λ°°ν¬
|
|
95
|
+
./deploy.sh minor
|
|
96
|
+
|
|
97
|
+
# λ©μ΄μ λ²μ λ°°ν¬
|
|
98
|
+
./deploy.sh major
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
> **μ°Έκ³ **: λ°°ν¬ μ μ μλμΌλ‘ λΉλκ° μ€νλλ©°, `prepublishOnly` ν
μ ν΅ν΄ λΉλκ° νμΈλ©λλ€.
|
|
102
|
+
|
|
103
|
+
## μ£Όμ κΈ°λ₯
|
|
104
|
+
|
|
105
|
+
- **μ격ν νμ
κ²μ¦**μ μ 곡νλ DTO κ²μ¦ λ°μ½λ μ΄ν°
|
|
106
|
+
- `DtoString`: λ¬Έμμ΄ νμ
μ격 κ²μ¦
|
|
107
|
+
- `DtoNumber`: μ«μ νμ
λ° λ²μ κ²μ¦ (min/max)
|
|
108
|
+
- `DtoDate`: λ μ§ νμ
κ²μ¦ λ° λ³ν
|
|
109
|
+
- `DtoBoolean`: λΆλ¦° νμ
κ²μ¦ λ° λ³ν
|
|
110
|
+
- `DtoEnum`: μ΄κ±°ν νμ
μ격 κ²μ¦
|
|
111
|
+
- `Property`: ν΅ν© νμ
κΈ°λ° κ²μ¦
|
|
112
|
+
- **νμ
μμ ν** μ νΈλ¦¬ν° ν¨μ (`applyDecorators`)
|
|
113
|
+
|
|
114
|
+
## μ¬μ© μμ
|
|
115
|
+
|
|
116
|
+
### κΈ°λ³Έ μ¬μ©λ²
|
|
117
|
+
|
|
118
|
+
```typescript
|
|
119
|
+
import { DtoString, DtoNumber, Property } from 'ts-deco';
|
|
120
|
+
|
|
121
|
+
class CreateUserDto {
|
|
122
|
+
// νμ λ¬Έμμ΄ νλ (μ격ν κ²μ¦)
|
|
123
|
+
@DtoString({ optional: false })
|
|
124
|
+
name: string;
|
|
125
|
+
|
|
126
|
+
// μ«μ λ²μ κ²μ¦ (0 ~ 120)
|
|
127
|
+
@DtoNumber({ min: 0, max: 120 })
|
|
128
|
+
age: number;
|
|
129
|
+
|
|
130
|
+
// μ νμ λ¬Έμμ΄ νλ
|
|
131
|
+
@Property({ type: String, optional: true })
|
|
132
|
+
email?: string;
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### μ격ν κ²μ¦ μμ
|
|
137
|
+
|
|
138
|
+
```typescript
|
|
139
|
+
import { DtoNumber, DtoEnum } from 'ts-deco';
|
|
140
|
+
|
|
141
|
+
enum UserRole {
|
|
142
|
+
ADMIN = 'admin',
|
|
143
|
+
USER = 'user',
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
class UpdateUserDto {
|
|
147
|
+
// μ΅μ/μ΅λκ°μ΄ λͺ
μμ μΌλ‘ κ²μ¦λ¨
|
|
148
|
+
@DtoNumber({
|
|
149
|
+
min: 1,
|
|
150
|
+
max: 100,
|
|
151
|
+
isInt: true, // μ μλ§ νμ©
|
|
152
|
+
minMessage: 'μ΅μκ°μ 1 μ΄μμ΄μ΄μΌ ν©λλ€',
|
|
153
|
+
maxMessage: 'μ΅λκ°μ 100 μ΄νμ¬μΌ ν©λλ€'
|
|
154
|
+
})
|
|
155
|
+
score: number;
|
|
156
|
+
|
|
157
|
+
// μ΄κ±°ν κ°λ§ νμ© (μ격ν νμ
체ν¬)
|
|
158
|
+
@DtoEnum(UserRole, {
|
|
159
|
+
optional: false,
|
|
160
|
+
exclude: [] // νΉμ κ° μ μΈ κ°λ₯
|
|
161
|
+
})
|
|
162
|
+
role: UserRole;
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## applyDecorators
|
|
167
|
+
|
|
168
|
+
μ¬λ¬ λ°μ½λ μ΄ν°λ₯Ό νλλ‘ ν©μΉλ μ νΈλ¦¬ν° ν¨μμ
λλ€.
|
|
169
|
+
|
|
170
|
+
```typescript
|
|
171
|
+
import { applyDecorators } from 'ts-deco';
|
|
172
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
173
|
+
import { IsString } from 'class-validator';
|
|
174
|
+
|
|
175
|
+
const MyDecorator = applyDecorators(
|
|
176
|
+
ApiProperty(),
|
|
177
|
+
IsString()
|
|
178
|
+
);
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### μ£Όμμ¬ν
|
|
182
|
+
|
|
183
|
+
β οΈ **λͺ¨λ λ°μ½λ μ΄ν°λ λμΌν νμ
μ΄μ΄μΌ ν©λλ€.**
|
|
184
|
+
- `ClassDecorator`λΌλ¦¬λ§ ν©μΉ μ μμ΅λλ€
|
|
185
|
+
- `PropertyDecorator`λΌλ¦¬λ§ ν©μΉ μ μμ΅λλ€
|
|
186
|
+
- `MethodDecorator`λΌλ¦¬λ§ ν©μΉ μ μμ΅λλ€
|
|
187
|
+
- `ParameterDecorator`λΌλ¦¬λ§ ν©μΉ μ μμ΅λλ€
|
|
188
|
+
|
|
189
|
+
### λ°μ½λ μ΄ν° νμ
λ³ λ°νκ°
|
|
190
|
+
|
|
191
|
+
- **ClassDecorator**: `Function | void` λ°ν κ°λ₯
|
|
192
|
+
- **MethodDecorator**: `PropertyDescriptor | void` λ°ν κ°λ₯
|
|
193
|
+
- **PropertyDecorator**: λ°νκ° μμ (void)
|
|
194
|
+
- **ParameterDecorator**: λ°νκ° μμ (void)
|
|
195
|
+
|
|
196
|
+
## μ격ν κ²μ¦ κ·μΉ
|
|
197
|
+
|
|
198
|
+
`ts-deco`λ λ€μκ³Ό κ°μ μ격ν κ²μ¦ κ·μΉμ μ μ©ν©λλ€:
|
|
199
|
+
|
|
200
|
+
- **νμ
λΆμΌμΉ μ μ¦μ μλ¬**: μλͺ»λ νμ
μ΄ μ λ¬λλ©΄ λͺ
νν μλ¬ λ©μμ§ μ 곡
|
|
201
|
+
- **λ²μ κ²μ¦**: `min`/`max` μ΅μ
μ΄ μ 곡λλ©΄ λ°λμ κ²μ¦
|
|
202
|
+
- **νμ νλ κ²μ¦**: `optional: false`μΈ κ²½μ° κ°μ΄ μμΌλ©΄ μλ¬
|
|
203
|
+
- **λ°°μ΄ κ²μ¦**: `isArray: true`μΈ κ²½μ° λ°°μ΄ νμ
λ§ νμ©
|
|
204
|
+
- **μ΄κ±°ν κ²μ¦**: `DtoEnum`μ μ 곡λ enum κ°λ§ νμ©
|
|
205
|
+
|
|
206
|
+
## λ°μ½λ μ΄ν° μ§μ
|
|
207
|
+
|
|
208
|
+
### Legacy Decorators (νμ¬ μ§μ)
|
|
209
|
+
|
|
210
|
+
β οΈ **μ΄ μ νΈλ¦¬ν°λ TypeScript legacy decoratorsλ₯Ό μ§μν©λλ€.**
|
|
211
|
+
|
|
212
|
+
νμ¬ μ΄ λΌμ΄λΈλ¬λ¦¬λ **Legacy Decorators** (λλ Stage 2 Decorators)λ₯Ό κΈ°λ°μΌλ‘ μλν©λλ€. μ΄λ TypeScriptμμ μ€λ«λμ μ¬μ©λμ΄ μ¨ μμ μ μΈ λ°μ½λ μ΄ν° μμ€ν
μ
λλ€.
|
|
213
|
+
|
|
214
|
+
### Stage 3 Decoratorsλ μμ§ μ§μνμ§ μμ΅λλ€
|
|
215
|
+
|
|
216
|
+
**Stage 3 Decoratorsλ?**
|
|
217
|
+
|
|
218
|
+
- JavaScript/TypeScriptμ μλ‘μ΄ λ°μ½λ μ΄ν° μ μμΌλ‘, ECMAScript νμ€ν κ³Όμ μ Stage 3 λ¨κ³μ μλ μ μμ
λλ€
|
|
219
|
+
- TypeScript 5.0 μ΄νμ λμ
λ μλ‘μ΄ λ°μ½λ μ΄ν° APIμ
λλ€
|
|
220
|
+
- κΈ°μ‘΄ Legacy Decoratorsμλ λ€λ₯Έ λ¬Έλ²κ³Ό λμ λ°©μμ κ°μ§λλ€
|
|
221
|
+
|
|
222
|
+
**μ μμ§ μ§μνμ§ μλμ?**
|
|
223
|
+
|
|
224
|
+
1. **νΈνμ±**: νμ¬ λλΆλΆμ NestJS, class-validator, class-transformer λ± μ£Όμ λΌμ΄λΈλ¬λ¦¬λ€μ΄ Legacy Decoratorsλ₯Ό κΈ°λ°μΌλ‘ μλν©λλ€
|
|
225
|
+
2. **μμ μ±**: Legacy Decoratorsλ μ€λ«λμ κ²μ¦λ μμ μ μΈ μμ€ν
μ
λλ€
|
|
226
|
+
3. **νμ€ν μ§ν μ€**: Stage 3 Decoratorsλ μμ§ Stage 4(μ΅μ’
νμ€)κ° μλλ©°, μ¬μμ΄ λ³κ²½λ μ μμ΅λλ€
|
|
227
|
+
|
|
228
|
+
**Legacy Decorators vs Stage 3 Decorators**
|
|
229
|
+
|
|
230
|
+
| νλͺ© | Legacy Decorators (νμ¬ μ§μ) | Stage 3 Decorators (λ―Έμ§μ) |
|
|
231
|
+
|------|------------------------------|----------------------------|
|
|
232
|
+
| TypeScript μ€μ | `experimentalDecorators: true` | λ³λ μ€μ νμ |
|
|
233
|
+
| λ¬Έλ² | `@decorator` νν | `@decorator` νν (λ΄λΆ λμ λ€λ¦) |
|
|
234
|
+
| νμ
μκ·Έλμ² | `(target, propertyKey, descriptor)` | `(value, context)` |
|
|
235
|
+
| λΌμ΄λΈλ¬λ¦¬ νΈνμ± | NestJS, class-validator λ±κ³Ό νΈν | μμ§ μΌλΆ λΌμ΄λΈλ¬λ¦¬λ§ μ§μ |
|
|
236
|
+
| μμ μ± | κ²μ¦λ¨ | νμ€ν μ§ν μ€ |
|
|
237
|
+
|
|
238
|
+
**μ°Έκ³ **: Stage 3 Decoratorsκ° νμ€νλκ³ μ£Όμ λΌμ΄λΈλ¬λ¦¬λ€μ΄ μ§μνκ² λλ©΄, ν₯ν λ²μ μμ μ§μμ μΆκ°ν μμ μ
λλ€.
|
|
239
|
+
|
|
240
|
+
## μμ‘΄μ±
|
|
241
|
+
|
|
242
|
+
μ΄ λΌμ΄λΈλ¬λ¦¬λ λ€μ ν¨ν€μ§λ€μ **peer dependencies**λ‘ μ¬μ©ν©λλ€:
|
|
243
|
+
|
|
244
|
+
### Peer Dependencies
|
|
245
|
+
|
|
246
|
+
| ν¨ν€μ§ | λ²μ | μ©λ | λΌμ΄μ μ€ |
|
|
247
|
+
|--------|------|------|----------|
|
|
248
|
+
| `@nestjs/swagger` | ^7.0.0 | API λ¬Έμν λ°μ½λ μ΄ν° (`ApiProperty`, `ApiPropertyOptional`) | MIT |
|
|
249
|
+
| `class-transformer` | ^0.5.0 | νμ
λ³ν λ°μ½λ μ΄ν° (`Type`, `Transform`) | MIT |
|
|
250
|
+
| `class-validator` | ^0.14.0 | κ²μ¦ λ°μ½λ μ΄ν° (`IsString`, `IsNumber`, `IsDate`, `IsBoolean`, `IsEnum`, `IsArray`, `IsDefined`, `IsNotEmpty`, `IsOptional`, `Min`, `Max` λ±) | MIT |
|
|
251
|
+
|
|
252
|
+
### κ°λ° μμ‘΄μ±
|
|
253
|
+
|
|
254
|
+
- `typescript`: ^5.0.0 (μ»΄νμΌ νμ νμ
κ²μ¬ λ° νΈλμ€νμΌ)
|
|
255
|
+
|
|
256
|
+
> **μ°Έκ³ **: μ΄ λΌμ΄λΈλ¬λ¦¬λ λ°νμμ μ ν¨ν€μ§λ€μ΄ μ€μΉλμ΄ μμ΄μΌ ν©λλ€. `npm install` μ μλμΌλ‘ μ€μΉλμ§ μμΌλ―λ‘, νλ‘μ νΈμ μ§μ μ€μΉν΄μΌ ν©λλ€.
|
|
257
|
+
|
|
258
|
+
## λΌμ΄μ μ€
|
|
259
|
+
|
|
260
|
+
### λ³Έ νλ‘μ νΈ λΌμ΄μ μ€
|
|
261
|
+
|
|
262
|
+
μ΄ νλ‘μ νΈλ **ISC (Internet Systems Consortium) License** νμ λ°°ν¬λ©λλ€.
|
|
263
|
+
|
|
264
|
+
```
|
|
265
|
+
ISC License
|
|
266
|
+
|
|
267
|
+
Copyright (c) 2025 ts-deco contributors
|
|
268
|
+
|
|
269
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
270
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
271
|
+
copyright notice and this permission notice appear in all copies.
|
|
272
|
+
|
|
273
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
274
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
275
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
276
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
277
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
278
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
279
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### μμ‘΄μ± λΌμ΄μ μ€
|
|
283
|
+
|
|
284
|
+
μ΄ νλ‘μ νΈκ° μ¬μ©νλ λͺ¨λ μμ‘΄μ±μ **MIT License** νμ λ°°ν¬λλ©°, ISC Licenseμ νΈνλ©λλ€.
|
|
285
|
+
|
|
286
|
+
- `@nestjs/swagger`: MIT License
|
|
287
|
+
- `class-transformer`: MIT License
|
|
288
|
+
- `class-validator`: MIT License
|
|
289
|
+
|
|
290
|
+
κ° ν¨ν€μ§μ λΌμ΄μ μ€ μ λ¬Έμ ν΄λΉ ν¨ν€μ§μ `LICENSE` νμΌ λλ npm ν¨ν€μ§ νμ΄μ§μμ νμΈν μ μμ΅λλ€.
|
|
291
|
+
|
|
292
|
+
### λΌμ΄μ μ€ νΈνμ±
|
|
293
|
+
|
|
294
|
+
ISC Licenseλ MIT Licenseμ λ§€μ° μ μ¬νλ©°, λ λΌμ΄μ μ€ λͺ¨λ λ§€μ° κ΄λν(permissive) μ€νμμ€ λΌμ΄μ μ€μ
λλ€. μ΄ νλ‘μ νΈμ μμ‘΄μ± ν¨ν€μ§λ€μ λͺ¨λ μνΈ νΈνλλ λΌμ΄μ μ€λ₯Ό μ¬μ©νλ―λ‘ λ²μ λ¬Έμ κ° μμ΅λλ€.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* μ¬λ¬ λ°μ½λ μ΄ν°λ₯Ό νλλ‘ ν©μΉλ μ νΈλ¦¬ν° ν¨μ
|
|
3
|
+
* TypeScriptμ λͺ¨λ λ°μ½λ μ΄ν° νμ
μ μ§μν©λλ€.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Class λ°μ½λ μ΄ν°λ₯Ό ν©μΉ©λλ€.
|
|
7
|
+
*/
|
|
8
|
+
export declare function applyDecorators(...decorators: ClassDecorator[]): ClassDecorator;
|
|
9
|
+
/**
|
|
10
|
+
* Property λ°μ½λ μ΄ν°λ₯Ό ν©μΉ©λλ€.
|
|
11
|
+
*/
|
|
12
|
+
export declare function applyDecorators(...decorators: PropertyDecorator[]): PropertyDecorator;
|
|
13
|
+
/**
|
|
14
|
+
* Method λ°μ½λ μ΄ν°λ₯Ό ν©μΉ©λλ€.
|
|
15
|
+
*/
|
|
16
|
+
export declare function applyDecorators(...decorators: MethodDecorator[]): MethodDecorator;
|
|
17
|
+
/**
|
|
18
|
+
* Parameter λ°μ½λ μ΄ν°λ₯Ό ν©μΉ©λλ€.
|
|
19
|
+
*/
|
|
20
|
+
export declare function applyDecorators(...decorators: ParameterDecorator[]): ParameterDecorator;
|
|
21
|
+
//# sourceMappingURL=apply-decorators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-decorators.d.ts","sourceRoot":"","sources":["../../../src/decorators/utils/apply-decorators.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,UAAU,EAAE,cAAc,EAAE,GAAG,cAAc,CAAC;AAEjF;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,UAAU,EAAE,iBAAiB,EAAE,GAAG,iBAAiB,CAAC;AAEvF;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,UAAU,EAAE,eAAe,EAAE,GAAG,eAAe,CAAC;AAEnF;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,UAAU,EAAE,kBAAkB,EAAE,GAAG,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* μ¬λ¬ λ°μ½λ μ΄ν°λ₯Ό νλλ‘ ν©μΉλ μ νΈλ¦¬ν° ν¨μ
|
|
4
|
+
* TypeScriptμ λͺ¨λ λ°μ½λ μ΄ν° νμ
μ μ§μν©λλ€.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.applyDecorators = applyDecorators;
|
|
8
|
+
/**
|
|
9
|
+
* μ¬λ¬ λ°μ½λ μ΄ν°λ₯Ό νλλ‘ ν©μΉλ ꡬν ν¨μ
|
|
10
|
+
*
|
|
11
|
+
* β οΈ μ£Όμ: λͺ¨λ λ°μ½λ μ΄ν°λ λμΌν νμ
μ΄μ΄μΌ ν©λλ€.
|
|
12
|
+
* (ClassDecorator, PropertyDecorator, MethodDecorator, ParameterDecorator μ€ νλ)
|
|
13
|
+
*/
|
|
14
|
+
function applyDecorators(...decorators) {
|
|
15
|
+
return function (target, propertyKey, descriptorOrIndex) {
|
|
16
|
+
for (const decorator of decorators) {
|
|
17
|
+
if (descriptorOrIndex !== undefined) {
|
|
18
|
+
if (typeof descriptorOrIndex === 'number') {
|
|
19
|
+
// ParameterDecorator: (target, propertyKey, parameterIndex) => void
|
|
20
|
+
// λ°νκ° μμ (void)
|
|
21
|
+
decorator(target, propertyKey, descriptorOrIndex);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
// MethodDecorator: (target, propertyKey, descriptor) => PropertyDescriptor | void
|
|
25
|
+
// PropertyDescriptorλ₯Ό λ°νν μ μμ
|
|
26
|
+
const result = decorator(target, propertyKey, descriptorOrIndex);
|
|
27
|
+
if (result !== undefined) {
|
|
28
|
+
descriptorOrIndex = result;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
else if (propertyKey !== undefined) {
|
|
33
|
+
// PropertyDecorator: (target, propertyKey) => void
|
|
34
|
+
// λ°νκ° μμ (void)
|
|
35
|
+
decorator(target, propertyKey);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
// ClassDecorator: (target) => Function | void
|
|
39
|
+
// Functionμ λ°νν μ μμ
|
|
40
|
+
const result = decorator(target);
|
|
41
|
+
if (result !== undefined) {
|
|
42
|
+
target = result;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
// MethodDecoratorμΌ λλ PropertyDescriptor λ°ν
|
|
47
|
+
// ClassDecoratorμΌ λλ Function λ°ν
|
|
48
|
+
// PropertyDecorator/ParameterDecoratorμΌ λλ λ°νκ° μμ (undefined)
|
|
49
|
+
return descriptorOrIndex ?? target;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=apply-decorators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-decorators.js","sourceRoot":"","sources":["../../../src/decorators/utils/apply-decorators.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AA4BH,0CAmCC;AAzCD;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,GAAG,UAAiB;IAChD,OAAO,UAAU,MAAW,EAAE,WAA6B,EAAE,iBAA+C;QACxG,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACjC,IAAI,iBAAiB,KAAK,SAAS,EAAE,CAAC;gBAClC,IAAI,OAAO,iBAAiB,KAAK,QAAQ,EAAE,CAAC;oBACxC,oEAAoE;oBACpE,gBAAgB;oBAChB,SAAS,CAAC,MAAM,EAAE,WAAW,EAAE,iBAAiB,CAAC,CAAC;gBACtD,CAAC;qBAAM,CAAC;oBACJ,kFAAkF;oBAClF,+BAA+B;oBAC/B,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,WAAW,EAAE,iBAAiB,CAAC,CAAC;oBACjE,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;wBACvB,iBAAiB,GAAG,MAAM,CAAC;oBAC/B,CAAC;gBACL,CAAC;YACL,CAAC;iBAAM,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;gBACnC,mDAAmD;gBACnD,gBAAgB;gBAChB,SAAS,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;YACnC,CAAC;iBAAM,CAAC;gBACJ,8CAA8C;gBAC9C,qBAAqB;gBACrB,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;gBACjC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;oBACvB,MAAM,GAAG,MAAM,CAAC;gBACpB,CAAC;YACL,CAAC;QACL,CAAC;QAED,4CAA4C;QAC5C,iCAAiC;QACjC,8DAA8D;QAC9D,OAAO,iBAAiB,IAAI,MAAM,CAAC;IACvC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ApiPropertyOptions } from '@nestjs/swagger';
|
|
2
|
+
import { DtoValidatorOptions } from './validator.type';
|
|
3
|
+
type DtoBooleanOptions = ApiPropertyOptions & DtoValidatorOptions;
|
|
4
|
+
export default function DtoBoolean(options?: DtoBooleanOptions): PropertyDecorator;
|
|
5
|
+
export {};
|
|
6
|
+
//# sourceMappingURL=boolean.decorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boolean.decorator.d.ts","sourceRoot":"","sources":["../../../src/decorators/validators/boolean.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAKrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAGvD,KAAK,iBAAiB,GAAG,kBAAkB,GAAG,mBAAmB,CAAC;AAElE,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,OAAO,CAAC,EAAE,iBAAiB,qBAgC7D"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = DtoBoolean;
|
|
4
|
+
const class_validator_1 = require("class-validator");
|
|
5
|
+
const apply_decorators_1 = require("../utils/apply-decorators");
|
|
6
|
+
const class_transformer_1 = require("class-transformer");
|
|
7
|
+
const validator_options_1 = require("./utils/validator-options");
|
|
8
|
+
const common_decorators_1 = require("./utils/common-decorators");
|
|
9
|
+
function DtoBoolean(options) {
|
|
10
|
+
const { isArray = false, optional = false, validatorMessage, arrayMessage, ...swaggerOptions } = options || {};
|
|
11
|
+
const validatorOption = (0, validator_options_1.getValidatorOptions)({ isArray, validatorMessage });
|
|
12
|
+
const each = validatorOption.each ?? false;
|
|
13
|
+
return (0, apply_decorators_1.applyDecorators)((0, common_decorators_1.getApiPropertyDecorator)(optional, Boolean, isArray, swaggerOptions), (0, class_transformer_1.Transform)(({ value }) => {
|
|
14
|
+
if (Array.isArray(value)) {
|
|
15
|
+
return value.map(v => {
|
|
16
|
+
if (typeof v === 'boolean')
|
|
17
|
+
return v;
|
|
18
|
+
if (typeof v === 'string') {
|
|
19
|
+
const lower = v.toLowerCase();
|
|
20
|
+
if (['true', '1'].includes(lower))
|
|
21
|
+
return true;
|
|
22
|
+
if (['false', '0'].includes(lower))
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
return v;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
if (typeof value === 'boolean')
|
|
29
|
+
return value;
|
|
30
|
+
if (typeof value === 'string') {
|
|
31
|
+
const lower = value.toLowerCase();
|
|
32
|
+
if (['true', '1'].includes(lower))
|
|
33
|
+
return true;
|
|
34
|
+
if (['false', '0'].includes(lower))
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
return value;
|
|
38
|
+
}), (0, common_decorators_1.getRequiredValidator)(optional, each), ...(0, common_decorators_1.getIsArrayDecorator)(isArray, arrayMessage), (0, class_validator_1.IsBoolean)(validatorOption));
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=boolean.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boolean.decorator.js","sourceRoot":"","sources":["../../../src/decorators/validators/boolean.decorator.ts"],"names":[],"mappings":";;AAUA,6BAgCC;AAzCD,qDAA4C;AAC5C,gEAA4D;AAC5D,yDAA8C;AAC9C,iEAAgE;AAEhE,iEAA+G;AAI/G,SAAwB,UAAU,CAAC,OAA2B;IAC1D,MAAM,EAAE,OAAO,GAAG,KAAK,EAAE,QAAQ,GAAG,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,GAAG,cAAc,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IAE/G,MAAM,eAAe,GAAG,IAAA,uCAAmB,EAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC,CAAC;IAC3E,MAAM,IAAI,GAAG,eAAe,CAAC,IAAI,IAAI,KAAK,CAAC;IAE3C,OAAO,IAAA,kCAAe,EAClB,IAAA,2CAAuB,EAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,CAAC,EACnE,IAAA,6BAAS,EAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;QACpB,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACvB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;gBACjB,IAAI,OAAO,CAAC,KAAK,SAAS;oBAAE,OAAO,CAAC,CAAC;gBACrC,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;oBACxB,MAAM,KAAK,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;oBAC9B,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;wBAAE,OAAO,IAAI,CAAC;oBAC/C,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;wBAAE,OAAO,KAAK,CAAC;gBACrD,CAAC;gBACD,OAAO,CAAC,CAAC;YACb,CAAC,CAAC,CAAC;QACP,CAAC;QACD,IAAI,OAAO,KAAK,KAAK,SAAS;YAAE,OAAO,KAAK,CAAC;QAC7C,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC5B,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;YAClC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;gBAAE,OAAO,IAAI,CAAC;YAC/C,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;gBAAE,OAAO,KAAK,CAAC;QACrD,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC,CAAC,EACF,IAAA,wCAAoB,EAAC,QAAQ,EAAE,IAAI,CAAC,EACpC,GAAG,IAAA,uCAAmB,EAAC,OAAO,EAAE,YAAY,CAAC,EAC7C,IAAA,2BAAS,EAAC,eAAe,CAAC,CAC7B,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ApiPropertyOptions } from '@nestjs/swagger';
|
|
2
|
+
import { DtoValidatorOptions } from './validator.type';
|
|
3
|
+
type DtoDateOptions = ApiPropertyOptions & DtoValidatorOptions;
|
|
4
|
+
export default function DtoDate(options?: DtoDateOptions): PropertyDecorator;
|
|
5
|
+
export {};
|
|
6
|
+
//# sourceMappingURL=date.decorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date.decorator.d.ts","sourceRoot":"","sources":["../../../src/decorators/validators/date.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAKrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAGvD,KAAK,cAAc,GAAG,kBAAkB,GAAG,mBAAmB,CAAC;AAE/D,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,OAAO,CAAC,EAAE,cAAc,qBAsBvD"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = DtoDate;
|
|
4
|
+
const class_validator_1 = require("class-validator");
|
|
5
|
+
const apply_decorators_1 = require("../utils/apply-decorators");
|
|
6
|
+
const class_transformer_1 = require("class-transformer");
|
|
7
|
+
const validator_options_1 = require("./utils/validator-options");
|
|
8
|
+
const common_decorators_1 = require("./utils/common-decorators");
|
|
9
|
+
function DtoDate(options) {
|
|
10
|
+
const { isArray = false, optional = false, validatorMessage, arrayMessage, ...swaggerOptions } = options || {};
|
|
11
|
+
const validatorOption = (0, validator_options_1.getValidatorOptions)({ isArray, validatorMessage });
|
|
12
|
+
const each = validatorOption.each ?? false;
|
|
13
|
+
return (0, apply_decorators_1.applyDecorators)((0, common_decorators_1.getApiPropertyDecorator)(optional, Date, isArray, swaggerOptions), (0, class_transformer_1.Transform)(({ value }) => {
|
|
14
|
+
if (Array.isArray(value)) {
|
|
15
|
+
return value.map(v => {
|
|
16
|
+
const d = new Date(v);
|
|
17
|
+
return isNaN(d.getTime()) ? v : d;
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
const d = new Date(value);
|
|
21
|
+
return isNaN(d.getTime()) ? value : d;
|
|
22
|
+
}), (0, common_decorators_1.getRequiredValidator)(optional, each), ...(0, common_decorators_1.getIsArrayDecorator)(isArray, arrayMessage), (0, class_validator_1.IsDate)(validatorOption));
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=date.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date.decorator.js","sourceRoot":"","sources":["../../../src/decorators/validators/date.decorator.ts"],"names":[],"mappings":";;AAUA,0BAsBC;AA/BD,qDAAyC;AACzC,gEAA4D;AAC5D,yDAA8C;AAC9C,iEAAgE;AAEhE,iEAA+G;AAI/G,SAAwB,OAAO,CAAC,OAAwB;IACpD,MAAM,EAAE,OAAO,GAAG,KAAK,EAAE,QAAQ,GAAG,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,GAAG,cAAc,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IAE/G,MAAM,eAAe,GAAG,IAAA,uCAAmB,EAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC,CAAC;IAC3E,MAAM,IAAI,GAAG,eAAe,CAAC,IAAI,IAAI,KAAK,CAAC;IAE3C,OAAO,IAAA,kCAAe,EAClB,IAAA,2CAAuB,EAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,cAAc,CAAC,EAChE,IAAA,6BAAS,EAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;QACpB,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACvB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;gBACjB,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;gBACtB,OAAO,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACtC,CAAC,CAAC,CAAC;QACP,CAAC;QACD,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1B,OAAO,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC,CAAC,EACF,IAAA,wCAAoB,EAAC,QAAQ,EAAE,IAAI,CAAC,EACpC,GAAG,IAAA,uCAAmB,EAAC,OAAO,EAAE,YAAY,CAAC,EAC7C,IAAA,wBAAM,EAAC,eAAe,CAAC,CAC1B,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ApiPropertyOptions } from '@nestjs/swagger';
|
|
2
|
+
import { DtoEnumValidatorOptions } from './validator.type';
|
|
3
|
+
type DtoEnumOptions = ApiPropertyOptions & DtoEnumValidatorOptions;
|
|
4
|
+
export default function DtoEnum(enumType: object, options?: DtoEnumOptions): PropertyDecorator;
|
|
5
|
+
export {};
|
|
6
|
+
//# sourceMappingURL=enum.decorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enum.decorator.d.ts","sourceRoot":"","sources":["../../../src/decorators/validators/enum.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAIrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAG3D,KAAK,cAAc,GAAG,kBAAkB,GAAG,uBAAuB,CAAC;AAEnE,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,qBAmBzE"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = DtoEnum;
|
|
4
|
+
const class_validator_1 = require("class-validator");
|
|
5
|
+
const apply_decorators_1 = require("../utils/apply-decorators");
|
|
6
|
+
const validator_options_1 = require("./utils/validator-options");
|
|
7
|
+
const common_decorators_1 = require("./utils/common-decorators");
|
|
8
|
+
function DtoEnum(enumType, options) {
|
|
9
|
+
const { isArray = false, optional = false, exclude = [], validatorMessage, arrayMessage, ...swaggerOptions } = options || {};
|
|
10
|
+
const validatorOption = (0, validator_options_1.getValidatorOptions)({ isArray, validatorMessage });
|
|
11
|
+
const each = validatorOption.each ?? false;
|
|
12
|
+
const enumValues = Object.values(enumType).filter(v => !exclude.includes(v));
|
|
13
|
+
return (0, apply_decorators_1.applyDecorators)((0, common_decorators_1.getApiPropertyDecorator)(optional, undefined, isArray, { enum: enumValues, ...swaggerOptions }), (0, common_decorators_1.getRequiredValidator)(optional, each), ...(0, common_decorators_1.getIsArrayDecorator)(isArray, arrayMessage), (0, class_validator_1.IsEnum)(enumValues, validatorOption));
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=enum.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enum.decorator.js","sourceRoot":"","sources":["../../../src/decorators/validators/enum.decorator.ts"],"names":[],"mappings":";;AASA,0BAmBC;AA3BD,qDAAyC;AACzC,gEAA4D;AAC5D,iEAAgE;AAEhE,iEAA+G;AAI/G,SAAwB,OAAO,CAAC,QAAgB,EAAE,OAAwB;IACtE,MAAM,EACF,OAAO,GAAG,KAAK,EACf,QAAQ,GAAG,KAAK,EAChB,OAAO,GAAG,EAAE,EACZ,gBAAgB,EAChB,YAAY,EACZ,GAAG,cAAc,EACpB,GAAG,OAAO,IAAI,EAAE,CAAC;IAClB,MAAM,eAAe,GAAG,IAAA,uCAAmB,EAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC,CAAC;IAC3E,MAAM,IAAI,GAAG,eAAe,CAAC,IAAI,IAAI,KAAK,CAAC;IAC3C,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IAE7E,OAAO,IAAA,kCAAe,EAClB,IAAA,2CAAuB,EAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,cAAc,EAAE,CAAC,EAC9F,IAAA,wCAAoB,EAAC,QAAQ,EAAE,IAAI,CAAC,EACpC,GAAG,IAAA,uCAAmB,EAAC,OAAO,EAAE,YAAY,CAAC,EAC7C,IAAA,wBAAM,EAAC,UAAiB,EAAE,eAAe,CAAC,CAC7C,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ApiPropertyOptions } from '@nestjs/swagger';
|
|
2
|
+
import { IsNumberOptions } from 'class-validator';
|
|
3
|
+
import { DtoNumberValidatorOptions } from './validator.type';
|
|
4
|
+
type DtoNumberOptions = ApiPropertyOptions & IsNumberOptions & DtoNumberValidatorOptions;
|
|
5
|
+
export default function DtoNumber(options?: DtoNumberOptions): PropertyDecorator;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=number.decorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number.decorator.d.ts","sourceRoot":"","sources":["../../../src/decorators/validators/number.decorator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,EAAmB,eAAe,EAAY,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAI7D,KAAK,gBAAgB,GAAG,kBAAkB,GAAG,eAAe,GAAG,yBAAyB,CAAC;AAEzF,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,OAAO,CAAC,EAAE,gBAAgB,qBAoE3D"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = DtoNumber;
|
|
4
|
+
const apply_decorators_1 = require("../utils/apply-decorators");
|
|
5
|
+
const class_transformer_1 = require("class-transformer");
|
|
6
|
+
const class_validator_1 = require("class-validator");
|
|
7
|
+
const validator_options_1 = require("./utils/validator-options");
|
|
8
|
+
const common_decorators_1 = require("./utils/common-decorators");
|
|
9
|
+
function DtoNumber(options) {
|
|
10
|
+
const { isArray = false, optional = false, isInt = false, validatorMessage, arrayMessage, min, max,
|
|
11
|
+
// IsNumberOptions
|
|
12
|
+
allowNaN = false, allowInfinity = false, maxDecimalPlaces = 0, minMessage, maxMessage,
|
|
13
|
+
// ApiPropertyOptions
|
|
14
|
+
...swaggerOptions } = options || {};
|
|
15
|
+
const validatorOption = (0, validator_options_1.getValidatorOptions)({ isArray, validatorMessage });
|
|
16
|
+
const each = validatorOption.each ?? false;
|
|
17
|
+
// Min/Max κ²μ¦μ© μ΅μ
(message μ μΈ, minMessage/maxMessageκ° μ°μ )
|
|
18
|
+
const { message: _, ...minMaxValidatorOption } = validatorOption;
|
|
19
|
+
const isNumberOption = allowNaN !== undefined || allowInfinity !== undefined || maxDecimalPlaces !== undefined
|
|
20
|
+
? {
|
|
21
|
+
...(allowNaN !== undefined && { allowNaN }),
|
|
22
|
+
...(allowInfinity !== undefined && { allowInfinity }),
|
|
23
|
+
...(maxDecimalPlaces !== undefined && { maxDecimalPlaces }),
|
|
24
|
+
}
|
|
25
|
+
: undefined;
|
|
26
|
+
// μ«μ κ²μ¦ λ°μ½λ μ΄ν°
|
|
27
|
+
const numberValidator = isInt ? (0, class_validator_1.IsInt)(validatorOption) : (0, class_validator_1.IsNumber)(isNumberOption, validatorOption);
|
|
28
|
+
const minMaxValidators = [];
|
|
29
|
+
if (min !== undefined) {
|
|
30
|
+
minMaxValidators.push((0, class_validator_1.Min)(min, {
|
|
31
|
+
...minMaxValidatorOption,
|
|
32
|
+
each,
|
|
33
|
+
message: minMessage,
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
if (max !== undefined) {
|
|
37
|
+
minMaxValidators.push((0, class_validator_1.Max)(max, {
|
|
38
|
+
...minMaxValidatorOption,
|
|
39
|
+
each,
|
|
40
|
+
message: maxMessage,
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
return (0, apply_decorators_1.applyDecorators)((0, common_decorators_1.getApiPropertyDecorator)(optional, Number, isArray, swaggerOptions), (0, common_decorators_1.getRequiredValidator)(optional, each), (0, class_transformer_1.Transform)(({ value }) => (Array.isArray(value) ? value.map(Number) : Number(value))), numberValidator, ...(0, common_decorators_1.getIsArrayDecorator)(isArray, arrayMessage), ...minMaxValidators);
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=number.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number.decorator.js","sourceRoot":"","sources":["../../../src/decorators/validators/number.decorator.ts"],"names":[],"mappings":";;AAUA,4BAoEC;AA9ED,gEAA4D;AAE5D,yDAA8C;AAC9C,qDAA6E;AAE7E,iEAAgE;AAChE,iEAA+G;AAI/G,SAAwB,SAAS,CAAC,OAA0B;IACxD,MAAM,EACF,OAAO,GAAG,KAAK,EACf,QAAQ,GAAG,KAAK,EAChB,KAAK,GAAG,KAAK,EACb,gBAAgB,EAChB,YAAY,EACZ,GAAG,EACH,GAAG;IAEH,kBAAkB;IAClB,QAAQ,GAAG,KAAK,EAChB,aAAa,GAAG,KAAK,EACrB,gBAAgB,GAAG,CAAC,EACpB,UAAU,EACV,UAAU;IAEV,qBAAqB;IACrB,GAAG,cAAc,EACpB,GAAG,OAAO,IAAI,EAAE,CAAC;IAElB,MAAM,eAAe,GAAG,IAAA,uCAAmB,EAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC,CAAC;IAC3E,MAAM,IAAI,GAAG,eAAe,CAAC,IAAI,IAAI,KAAK,CAAC;IAE3C,yDAAyD;IACzD,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,qBAAqB,EAAE,GAAG,eAAe,CAAC;IAEjE,MAAM,cAAc,GAChB,QAAQ,KAAK,SAAS,IAAI,aAAa,KAAK,SAAS,IAAI,gBAAgB,KAAK,SAAS;QACnF,CAAC,CAAC;YACI,GAAG,CAAC,QAAQ,KAAK,SAAS,IAAI,EAAE,QAAQ,EAAE,CAAC;YAC3C,GAAG,CAAC,aAAa,KAAK,SAAS,IAAI,EAAE,aAAa,EAAE,CAAC;YACrD,GAAG,CAAC,gBAAgB,KAAK,SAAS,IAAI,EAAE,gBAAgB,EAAE,CAAC;SAC9D;QACH,CAAC,CAAC,SAAS,CAAC;IAEpB,cAAc;IACd,MAAM,eAAe,GAAG,KAAK,CAAC,CAAC,CAAC,IAAA,uBAAK,EAAC,eAAe,CAAC,CAAC,CAAC,CAAC,IAAA,0BAAQ,EAAC,cAAc,EAAE,eAAe,CAAC,CAAC;IAEnG,MAAM,gBAAgB,GAAwB,EAAE,CAAC;IAEjD,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACpB,gBAAgB,CAAC,IAAI,CACjB,IAAA,qBAAG,EAAC,GAAG,EAAE;YACL,GAAG,qBAAqB;YACxB,IAAI;YACJ,OAAO,EAAE,UAAU;SACtB,CAAC,CACL,CAAC;IACN,CAAC;IACD,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACpB,gBAAgB,CAAC,IAAI,CACjB,IAAA,qBAAG,EAAC,GAAG,EAAE;YACL,GAAG,qBAAqB;YACxB,IAAI;YACJ,OAAO,EAAE,UAAU;SACtB,CAAC,CACL,CAAC;IACN,CAAC;IAED,OAAO,IAAA,kCAAe,EAClB,IAAA,2CAAuB,EAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,CAAC,EAClE,IAAA,wCAAoB,EAAC,QAAQ,EAAE,IAAI,CAAC,EACpC,IAAA,6BAAS,EAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EACpF,eAAe,EACf,GAAG,IAAA,uCAAmB,EAAC,OAAO,EAAE,YAAY,CAAC,EAC7C,GAAG,gBAAgB,CACtB,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ApiPropertyOptions } from '@nestjs/swagger';
|
|
2
|
+
import { IsNumberOptions } from 'class-validator';
|
|
3
|
+
import { DtoEnumValidatorOptions, DtoNumberValidatorOptions, DtoValidatorOptions } from './validator.type';
|
|
4
|
+
type PropertyStringOptions = ApiPropertyOptions & DtoValidatorOptions;
|
|
5
|
+
type PropertyNumberOptions = ApiPropertyOptions & IsNumberOptions & DtoNumberValidatorOptions;
|
|
6
|
+
type PropertyDateOptions = ApiPropertyOptions & DtoValidatorOptions;
|
|
7
|
+
type PropertyBooleanOptions = ApiPropertyOptions & DtoValidatorOptions;
|
|
8
|
+
type PropertyEnumOptions = ApiPropertyOptions & DtoEnumValidatorOptions & {
|
|
9
|
+
enum: object;
|
|
10
|
+
};
|
|
11
|
+
type PropertyOptions = PropertyStringOptions | PropertyNumberOptions | PropertyDateOptions | PropertyBooleanOptions | PropertyEnumOptions;
|
|
12
|
+
export default function Property(options: PropertyOptions): PropertyDecorator;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=property.decorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"property.decorator.d.ts","sourceRoot":"","sources":["../../../src/decorators/validators/property.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAMlD,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAG3G,KAAK,qBAAqB,GAAG,kBAAkB,GAAG,mBAAmB,CAAC;AACtE,KAAK,qBAAqB,GAAG,kBAAkB,GAAG,eAAe,GAAG,yBAAyB,CAAC;AAC9F,KAAK,mBAAmB,GAAG,kBAAkB,GAAG,mBAAmB,CAAC;AACpE,KAAK,sBAAsB,GAAG,kBAAkB,GAAG,mBAAmB,CAAC;AACvE,KAAK,mBAAmB,GAAG,kBAAkB,GAAG,uBAAuB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAG3F,KAAK,eAAe,GACd,qBAAqB,GACrB,qBAAqB,GACrB,mBAAmB,GACnB,sBAAsB,GACtB,mBAAmB,CAAC;AAE1B,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,iBAAiB,CAkD5E"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = Property;
|
|
7
|
+
const string_decorator_1 = __importDefault(require("./string.decorator"));
|
|
8
|
+
const number_decorator_1 = __importDefault(require("./number.decorator"));
|
|
9
|
+
const date_decorator_1 = __importDefault(require("./date.decorator"));
|
|
10
|
+
const boolean_decorator_1 = __importDefault(require("./boolean.decorator"));
|
|
11
|
+
const enum_decorator_1 = __importDefault(require("./enum.decorator"));
|
|
12
|
+
function Property(options) {
|
|
13
|
+
// enumμ΄ μμΌλ©΄ enum μ²λ¦¬
|
|
14
|
+
if ('enum' in options && options.enum) {
|
|
15
|
+
const { enum: enumType, ...restOptions } = options;
|
|
16
|
+
return (0, enum_decorator_1.default)(enumType, restOptions);
|
|
17
|
+
}
|
|
18
|
+
// typeμ΄ μμΌλ©΄ μλ¬
|
|
19
|
+
if (!options.type) {
|
|
20
|
+
throw new Error('type λλ enum μμ±μ΄ νμν©λλ€.');
|
|
21
|
+
}
|
|
22
|
+
const { type, ...restOptions } = options;
|
|
23
|
+
// typeμ΄ μμ±μ ν¨μμΈ κ²½μ° nameμΌλ‘ λΆκΈ° μ²λ¦¬
|
|
24
|
+
if (typeof type === 'function') {
|
|
25
|
+
const typeName = type.name;
|
|
26
|
+
switch (typeName) {
|
|
27
|
+
case 'String':
|
|
28
|
+
return (0, string_decorator_1.default)(restOptions);
|
|
29
|
+
case 'Number':
|
|
30
|
+
return (0, number_decorator_1.default)(restOptions);
|
|
31
|
+
case 'Date':
|
|
32
|
+
return (0, date_decorator_1.default)(restOptions);
|
|
33
|
+
case 'Boolean':
|
|
34
|
+
return (0, boolean_decorator_1.default)(restOptions);
|
|
35
|
+
default:
|
|
36
|
+
throw new Error(`μ§μνμ§ μλ νμ
μ
λλ€.: ${typeName}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
// typeμ΄ λ¬Έμμ΄μΈ κ²½μ°λ μ²λ¦¬ (νμ νΈνμ±)
|
|
40
|
+
if (typeof type === 'string') {
|
|
41
|
+
const typeStr = type;
|
|
42
|
+
if (typeStr === 'string' || typeStr === 'String') {
|
|
43
|
+
return (0, string_decorator_1.default)(restOptions);
|
|
44
|
+
}
|
|
45
|
+
if (typeStr === 'number' || typeStr === 'Number') {
|
|
46
|
+
return (0, number_decorator_1.default)(restOptions);
|
|
47
|
+
}
|
|
48
|
+
if (typeStr === 'date' || typeStr === 'Date') {
|
|
49
|
+
return (0, date_decorator_1.default)(restOptions);
|
|
50
|
+
}
|
|
51
|
+
if (typeStr === 'boolean' || typeStr === 'Boolean') {
|
|
52
|
+
return (0, boolean_decorator_1.default)(restOptions);
|
|
53
|
+
}
|
|
54
|
+
throw new Error(`μ§μνμ§ μλ νμ
μ
λλ€.: ${typeStr}`);
|
|
55
|
+
}
|
|
56
|
+
throw new Error('μ§μνμ§ μλ type νμμ
λλ€.');
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=property.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"property.decorator.js","sourceRoot":"","sources":["../../../src/decorators/validators/property.decorator.ts"],"names":[],"mappings":";;;;;AAwBA,2BAkDC;AAxED,0EAA2C;AAC3C,0EAA2C;AAC3C,sEAAuC;AACvC,4EAA6C;AAC7C,sEAAuC;AAkBvC,SAAwB,QAAQ,CAAC,OAAwB;IACrD,oBAAoB;IACpB,IAAI,MAAM,IAAI,OAAO,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACpC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,WAAW,EAAE,GAAG,OAAO,CAAC;QACnD,OAAO,IAAA,wBAAO,EAAC,QAAQ,EAAE,WAA4C,CAAC,CAAC;IAC3E,CAAC;IAED,eAAe;IACf,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC/C,CAAC;IAED,MAAM,EAAE,IAAI,EAAE,GAAG,WAAW,EAAE,GAAG,OAAO,CAAC;IAEzC,gCAAgC;IAChC,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE,CAAC;QAC7B,MAAM,QAAQ,GAAI,IAAiB,CAAC,IAAI,CAAC;QACzC,QAAQ,QAAQ,EAAE,CAAC;YACf,KAAK,QAAQ;gBACT,OAAO,IAAA,0BAAS,EAAC,WAA8C,CAAC,CAAC;YACrE,KAAK,QAAQ;gBACT,OAAO,IAAA,0BAAS,EAAC,WAA8C,CAAC,CAAC;YACrE,KAAK,MAAM;gBACP,OAAO,IAAA,wBAAO,EAAC,WAA4C,CAAC,CAAC;YACjE,KAAK,SAAS;gBACV,OAAO,IAAA,2BAAU,EAAC,WAA+C,CAAC,CAAC;YACvE;gBACI,MAAM,IAAI,KAAK,CAAC,mBAAmB,QAAQ,EAAE,CAAC,CAAC;QACvD,CAAC;IACL,CAAC;IAED,6BAA6B;IAC7B,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC3B,MAAM,OAAO,GAAG,IAAW,CAAC;QAC5B,IAAI,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,QAAQ,EAAE,CAAC;YAC/C,OAAO,IAAA,0BAAS,EAAC,WAA8C,CAAC,CAAC;QACrE,CAAC;QACD,IAAI,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,QAAQ,EAAE,CAAC;YAC/C,OAAO,IAAA,0BAAS,EAAC,WAA8C,CAAC,CAAC;QACrE,CAAC;QACD,IAAI,OAAO,KAAK,MAAM,IAAI,OAAO,KAAK,MAAM,EAAE,CAAC;YAC3C,OAAO,IAAA,wBAAO,EAAC,WAA4C,CAAC,CAAC;QACjE,CAAC;QACD,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YACjD,OAAO,IAAA,2BAAU,EAAC,WAA+C,CAAC,CAAC;QACvE,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,mBAAmB,OAAO,EAAE,CAAC,CAAC;IAClD,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ApiPropertyOptions } from '@nestjs/swagger';
|
|
2
|
+
import { DtoValidatorOptions } from './validator.type';
|
|
3
|
+
type DtoStringOptions = ApiPropertyOptions & DtoValidatorOptions;
|
|
4
|
+
export default function DtoString(options?: DtoStringOptions): PropertyDecorator;
|
|
5
|
+
export {};
|
|
6
|
+
//# sourceMappingURL=string.decorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string.decorator.d.ts","sourceRoot":"","sources":["../../../src/decorators/validators/string.decorator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAKvD,KAAK,gBAAgB,GAAG,kBAAkB,GAAG,mBAAmB,CAAC;AAEjE,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,OAAO,CAAC,EAAE,gBAAgB,qBAoB3D"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = DtoString;
|
|
4
|
+
const class_transformer_1 = require("class-transformer");
|
|
5
|
+
const class_validator_1 = require("class-validator");
|
|
6
|
+
const validator_options_1 = require("./utils/validator-options");
|
|
7
|
+
const common_decorators_1 = require("./utils/common-decorators");
|
|
8
|
+
const apply_decorators_1 = require("../utils/apply-decorators");
|
|
9
|
+
function DtoString(options) {
|
|
10
|
+
const { isArray = false, optional = false, validatorMessage, notEmptyMessage, arrayMessage, ...swaggerOptions } = options || {};
|
|
11
|
+
const validatorOption = (0, validator_options_1.getValidatorOptions)({ isArray, validatorMessage });
|
|
12
|
+
const each = validatorOption.each ?? false;
|
|
13
|
+
return (0, apply_decorators_1.applyDecorators)((0, common_decorators_1.getApiPropertyDecorator)(optional, String, isArray, swaggerOptions), (0, class_transformer_1.Type)(() => String), (0, common_decorators_1.getRequiredValidator)(optional, each, true, notEmptyMessage), ...(0, common_decorators_1.getIsArrayDecorator)(isArray, arrayMessage), (0, class_validator_1.IsString)(validatorOption));
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=string.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string.decorator.js","sourceRoot":"","sources":["../../../src/decorators/validators/string.decorator.ts"],"names":[],"mappings":";;AAUA,4BAoBC;AA9BD,yDAAyC;AACzC,qDAA2C;AAG3C,iEAAgE;AAChE,iEAA+G;AAC/G,gEAA4D;AAI5D,SAAwB,SAAS,CAAC,OAA0B;IACxD,MAAM,EACF,OAAO,GAAG,KAAK,EACf,QAAQ,GAAG,KAAK,EAChB,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,GAAG,cAAc,EACpB,GAAG,OAAO,IAAI,EAAE,CAAC;IAElB,MAAM,eAAe,GAAG,IAAA,uCAAmB,EAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC,CAAC;IAC3E,MAAM,IAAI,GAAG,eAAe,CAAC,IAAI,IAAI,KAAK,CAAC;IAE3C,OAAO,IAAA,kCAAe,EAClB,IAAA,2CAAuB,EAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,CAAC,EAClE,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC,EAClB,IAAA,wCAAoB,EAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,eAAe,CAAC,EAC3D,GAAG,IAAA,uCAAmB,EAAC,OAAO,EAAE,YAAY,CAAC,EAC7C,IAAA,0BAAQ,EAAC,eAAe,CAAC,CAC5B,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ApiPropertyOptions } from '@nestjs/swagger';
|
|
2
|
+
import { DtoValidatorOptions } from '../validator.type';
|
|
3
|
+
/**
|
|
4
|
+
* PropertyDecorator νμ
μ μ
|
|
5
|
+
* TypeScriptμ κΈ°λ³Έ PropertyDecoratorμ νΈνλλλ‘ μ μ
|
|
6
|
+
*/
|
|
7
|
+
export type PropertyDecorator = (target: any, propertyKey: string | symbol) => void;
|
|
8
|
+
/**
|
|
9
|
+
* κ³΅ν΅ μ΅μ
μΆμΆ νμ
|
|
10
|
+
*/
|
|
11
|
+
export type CommonOptions = DtoValidatorOptions & {
|
|
12
|
+
isArray?: boolean;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* κ³΅ν΅ μ΅μ
μμ νμ€ μ΅μ
μΆμΆ
|
|
16
|
+
*/
|
|
17
|
+
export declare const extractCommonOptions: <T extends CommonOptions>(options?: T) => {
|
|
18
|
+
isArray: boolean;
|
|
19
|
+
optional: boolean;
|
|
20
|
+
validatorMessage: string | undefined;
|
|
21
|
+
arrayMessage: string | undefined;
|
|
22
|
+
notEmptyMessage: string | undefined;
|
|
23
|
+
swaggerOptions: Omit<T, keyof CommonOptions>;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* ApiProperty λλ ApiPropertyOptional λ°μ½λ μ΄ν° λ°ν
|
|
27
|
+
*/
|
|
28
|
+
export declare const getApiPropertyDecorator: (optional: boolean, type: ApiPropertyOptions["type"], isArray: boolean, swaggerOptions?: Partial<ApiPropertyOptions>) => globalThis.PropertyDecorator;
|
|
29
|
+
/**
|
|
30
|
+
* IsOptional λλ IsDefined/IsNotEmpty λ°μ½λ μ΄ν° λ°ν
|
|
31
|
+
*/
|
|
32
|
+
export declare const getRequiredValidator: (optional: boolean, each: boolean, useIsNotEmpty?: boolean, notEmptyMessage?: string) => globalThis.PropertyDecorator;
|
|
33
|
+
/**
|
|
34
|
+
* IsArray λ°μ½λ μ΄ν° μ‘°κ±΄λΆ λ°ν
|
|
35
|
+
*/
|
|
36
|
+
export declare const getIsArrayDecorator: (isArray: boolean, arrayMessage?: string) => globalThis.PropertyDecorator[];
|
|
37
|
+
/**
|
|
38
|
+
* κ³΅ν΅ λ°μ½λ μ΄ν° λ°°μ΄ μμ± (ApiProperty, Type λ³ν, νμ/μ ν κ²μ¦, λ°°μ΄ κ²μ¦)
|
|
39
|
+
*/
|
|
40
|
+
export declare const createCommonDecorators: (options: CommonOptions & {
|
|
41
|
+
type: ApiPropertyOptions["type"];
|
|
42
|
+
typeTransformer?: PropertyDecorator;
|
|
43
|
+
customValidator?: PropertyDecorator | PropertyDecorator[];
|
|
44
|
+
useIsNotEmpty?: boolean;
|
|
45
|
+
}) => PropertyDecorator;
|
|
46
|
+
//# sourceMappingURL=common-decorators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common-decorators.d.ts","sourceRoot":"","sources":["../../../../src/decorators/validators/utils/common-decorators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAGvF,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAGxD;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAC;AAEpF;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,mBAAmB,GAAG;IAC9C,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAAI,CAAC,SAAS,aAAa,EAAE,UAAU,CAAC;;;;;;oBAgB/B,IAAI,CAAC,CAAC,EAAE,MAAM,aAAa,CAAC;CAErE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB,GAChC,UAAU,OAAO,EACjB,MAAM,kBAAkB,CAAC,MAAM,CAAC,EAChC,SAAS,OAAO,EAChB,iBAAiB,OAAO,CAAC,kBAAkB,CAAC,iCAS/C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAC7B,UAAU,OAAO,EACjB,MAAM,OAAO,EACb,gBAAe,OAAe,EAC9B,kBAAkB,MAAM,iCAS3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAI,SAAS,OAAO,EAAE,eAAe,MAAM,mCAE1E,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,GAC/B,SAAS,aAAa,GAAG;IACrB,IAAI,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACjC,eAAe,CAAC,EAAE,iBAAiB,CAAC;IACpC,eAAe,CAAC,EAAE,iBAAiB,GAAG,iBAAiB,EAAE,CAAC;IAC1D,aAAa,CAAC,EAAE,OAAO,CAAC;CAC3B,KACF,iBAkBF,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createCommonDecorators = exports.getIsArrayDecorator = exports.getRequiredValidator = exports.getApiPropertyDecorator = exports.extractCommonOptions = void 0;
|
|
4
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
5
|
+
const class_validator_1 = require("class-validator");
|
|
6
|
+
const apply_decorators_1 = require("../../utils/apply-decorators");
|
|
7
|
+
const validator_options_1 = require("./validator-options");
|
|
8
|
+
/**
|
|
9
|
+
* κ³΅ν΅ μ΅μ
μμ νμ€ μ΅μ
μΆμΆ
|
|
10
|
+
*/
|
|
11
|
+
const extractCommonOptions = (options) => {
|
|
12
|
+
const { isArray = false, optional = false, validatorMessage, arrayMessage, notEmptyMessage, ...swaggerOptions } = options || {};
|
|
13
|
+
return {
|
|
14
|
+
isArray,
|
|
15
|
+
optional,
|
|
16
|
+
validatorMessage,
|
|
17
|
+
arrayMessage,
|
|
18
|
+
notEmptyMessage,
|
|
19
|
+
swaggerOptions: swaggerOptions,
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
exports.extractCommonOptions = extractCommonOptions;
|
|
23
|
+
/**
|
|
24
|
+
* ApiProperty λλ ApiPropertyOptional λ°μ½λ μ΄ν° λ°ν
|
|
25
|
+
*/
|
|
26
|
+
const getApiPropertyDecorator = (optional, type, isArray, swaggerOptions) => {
|
|
27
|
+
const apiOptions = {
|
|
28
|
+
type,
|
|
29
|
+
isArray,
|
|
30
|
+
...swaggerOptions,
|
|
31
|
+
};
|
|
32
|
+
return optional ? (0, swagger_1.ApiPropertyOptional)(apiOptions) : (0, swagger_1.ApiProperty)(apiOptions);
|
|
33
|
+
};
|
|
34
|
+
exports.getApiPropertyDecorator = getApiPropertyDecorator;
|
|
35
|
+
/**
|
|
36
|
+
* IsOptional λλ IsDefined/IsNotEmpty λ°μ½λ μ΄ν° λ°ν
|
|
37
|
+
*/
|
|
38
|
+
const getRequiredValidator = (optional, each, useIsNotEmpty = false, notEmptyMessage) => {
|
|
39
|
+
if (optional) {
|
|
40
|
+
return (0, class_validator_1.IsOptional)({ each });
|
|
41
|
+
}
|
|
42
|
+
if (useIsNotEmpty) {
|
|
43
|
+
return (0, class_validator_1.IsNotEmpty)({ message: notEmptyMessage ?? undefined, each });
|
|
44
|
+
}
|
|
45
|
+
return (0, class_validator_1.IsDefined)({ each });
|
|
46
|
+
};
|
|
47
|
+
exports.getRequiredValidator = getRequiredValidator;
|
|
48
|
+
/**
|
|
49
|
+
* IsArray λ°μ½λ μ΄ν° μ‘°κ±΄λΆ λ°ν
|
|
50
|
+
*/
|
|
51
|
+
const getIsArrayDecorator = (isArray, arrayMessage) => {
|
|
52
|
+
return isArray ? [(0, class_validator_1.IsArray)({ message: arrayMessage ?? undefined })] : [];
|
|
53
|
+
};
|
|
54
|
+
exports.getIsArrayDecorator = getIsArrayDecorator;
|
|
55
|
+
/**
|
|
56
|
+
* κ³΅ν΅ λ°μ½λ μ΄ν° λ°°μ΄ μμ± (ApiProperty, Type λ³ν, νμ/μ ν κ²μ¦, λ°°μ΄ κ²μ¦)
|
|
57
|
+
*/
|
|
58
|
+
const createCommonDecorators = (options) => {
|
|
59
|
+
const extracted = (0, exports.extractCommonOptions)(options);
|
|
60
|
+
const { isArray, optional, validatorMessage, arrayMessage, notEmptyMessage, swaggerOptions } = extracted;
|
|
61
|
+
const { type, typeTransformer, customValidator, useIsNotEmpty } = options;
|
|
62
|
+
const validatorOption = (0, validator_options_1.getValidatorOptions)({ isArray, validatorMessage });
|
|
63
|
+
const each = validatorOption.each ?? false;
|
|
64
|
+
const useIsNotEmptyValue = useIsNotEmpty ?? false;
|
|
65
|
+
const decorators = [
|
|
66
|
+
(0, exports.getApiPropertyDecorator)(optional, type, isArray, swaggerOptions),
|
|
67
|
+
...(typeTransformer ? [typeTransformer] : []),
|
|
68
|
+
(0, exports.getRequiredValidator)(optional, each, useIsNotEmptyValue, notEmptyMessage),
|
|
69
|
+
...(0, exports.getIsArrayDecorator)(isArray, arrayMessage),
|
|
70
|
+
...(customValidator ? (Array.isArray(customValidator) ? customValidator : [customValidator]) : []),
|
|
71
|
+
];
|
|
72
|
+
return (0, apply_decorators_1.applyDecorators)(...decorators);
|
|
73
|
+
};
|
|
74
|
+
exports.createCommonDecorators = createCommonDecorators;
|
|
75
|
+
//# sourceMappingURL=common-decorators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common-decorators.js","sourceRoot":"","sources":["../../../../src/decorators/validators/utils/common-decorators.ts"],"names":[],"mappings":";;;AAAA,6CAAuF;AACvF,qDAA6E;AAC7E,mEAA+D;AAE/D,2DAA0D;AAe1D;;GAEG;AACI,MAAM,oBAAoB,GAAG,CAA0B,OAAW,EAAE,EAAE;IACzE,MAAM,EACF,OAAO,GAAG,KAAK,EACf,QAAQ,GAAG,KAAK,EAChB,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,GAAG,cAAc,EACpB,GAAG,OAAO,IAAI,EAAE,CAAC;IAElB,OAAO;QACH,OAAO;QACP,QAAQ;QACR,gBAAgB;QAChB,YAAY;QACZ,eAAe;QACf,cAAc,EAAE,cAA8C;KACjE,CAAC;AACN,CAAC,CAAC;AAlBW,QAAA,oBAAoB,wBAkB/B;AAEF;;GAEG;AACI,MAAM,uBAAuB,GAAG,CACnC,QAAiB,EACjB,IAAgC,EAChC,OAAgB,EAChB,cAA4C,EAC9C,EAAE;IACA,MAAM,UAAU,GAAG;QACf,IAAI;QACJ,OAAO;QACP,GAAG,cAAc;KACE,CAAC;IAExB,OAAO,QAAQ,CAAC,CAAC,CAAC,IAAA,6BAAmB,EAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAA,qBAAW,EAAC,UAAU,CAAC,CAAC;AAChF,CAAC,CAAC;AAbW,QAAA,uBAAuB,2BAalC;AAEF;;GAEG;AACI,MAAM,oBAAoB,GAAG,CAChC,QAAiB,EACjB,IAAa,EACb,gBAAyB,KAAK,EAC9B,eAAwB,EAC1B,EAAE;IACA,IAAI,QAAQ,EAAE,CAAC;QACX,OAAO,IAAA,4BAAU,EAAC,EAAE,IAAI,EAAE,CAAC,CAAC;IAChC,CAAC;IACD,IAAI,aAAa,EAAE,CAAC;QAChB,OAAO,IAAA,4BAAU,EAAC,EAAE,OAAO,EAAE,eAAe,IAAI,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,IAAA,2BAAS,EAAC,EAAE,IAAI,EAAE,CAAC,CAAC;AAC/B,CAAC,CAAC;AAbW,QAAA,oBAAoB,wBAa/B;AAEF;;GAEG;AACI,MAAM,mBAAmB,GAAG,CAAC,OAAgB,EAAE,YAAqB,EAAE,EAAE;IAC3E,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC,IAAA,yBAAO,EAAC,EAAE,OAAO,EAAE,YAAY,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC5E,CAAC,CAAC;AAFW,QAAA,mBAAmB,uBAE9B;AAEF;;GAEG;AACI,MAAM,sBAAsB,GAAG,CAClC,OAKC,EACgB,EAAE;IACnB,MAAM,SAAS,GAAG,IAAA,4BAAoB,EAAC,OAAO,CAAC,CAAC;IAChD,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,GAAG,SAAS,CAAC;IACzG,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC;IAE1E,MAAM,eAAe,GAAG,IAAA,uCAAmB,EAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC,CAAC;IAC3E,MAAM,IAAI,GAAG,eAAe,CAAC,IAAI,IAAI,KAAK,CAAC;IAC3C,MAAM,kBAAkB,GAAY,aAAa,IAAI,KAAK,CAAC;IAE3D,MAAM,UAAU,GAAG;QACf,IAAA,+BAAuB,EAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,cAAc,CAAC;QAChE,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7C,IAAA,4BAAoB,EAAC,QAAQ,EAAE,IAAI,EAAE,kBAAkB,EAAE,eAAe,CAAC;QACzE,GAAG,IAAA,2BAAmB,EAAC,OAAO,EAAE,YAAY,CAAC;QAC7C,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KACrG,CAAC;IAEF,OAAO,IAAA,kCAAe,EAAC,GAAG,UAAU,CAAC,CAAC;AAC1C,CAAC,CAAC;AAzBW,QAAA,sBAAsB,0BAyBjC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SwaggerPropertyOptions } from './swagger.types';
|
|
2
|
+
import { PropertyDecorator } from './common-decorators';
|
|
3
|
+
/**
|
|
4
|
+
* Swagger ApiProperty λλ ApiPropertyOptional λ°μ½λ μ΄ν°λ₯Ό 쑰건λΆλ‘ μ μ©
|
|
5
|
+
* @nestjs/swaggerκ° μ€μΉλμ΄ μμΌλ©΄ μ μ©, μμΌλ©΄ no-op λ°μ½λ μ΄ν° λ°ν
|
|
6
|
+
*/
|
|
7
|
+
export declare function getSwaggerDecorator(optional: boolean, options: SwaggerPropertyOptions): PropertyDecorator;
|
|
8
|
+
//# sourceMappingURL=swagger.decorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swagger.decorator.d.ts","sourceRoot":"","sources":["../../../../src/decorators/validators/utils/swagger.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAcxD;;;GAGG;AACH,wBAAgB,mBAAmB,CAC/B,QAAQ,EAAE,OAAO,EACjB,OAAO,EAAE,sBAAsB,GAChC,iBAAiB,CAmBnB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSwaggerDecorator = getSwaggerDecorator;
|
|
4
|
+
/**
|
|
5
|
+
* @nestjs/swagger ν¨ν€μ§ μ‘΄μ¬ μ¬λΆ νμΈ
|
|
6
|
+
*/
|
|
7
|
+
function hasSwaggerPackage() {
|
|
8
|
+
try {
|
|
9
|
+
require.resolve('@nestjs/swagger');
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Swagger ApiProperty λλ ApiPropertyOptional λ°μ½λ μ΄ν°λ₯Ό 쑰건λΆλ‘ μ μ©
|
|
18
|
+
* @nestjs/swaggerκ° μ€μΉλμ΄ μμΌλ©΄ μ μ©, μμΌλ©΄ no-op λ°μ½λ μ΄ν° λ°ν
|
|
19
|
+
*/
|
|
20
|
+
function getSwaggerDecorator(optional, options) {
|
|
21
|
+
if (!hasSwaggerPackage()) {
|
|
22
|
+
// Swagger ν¨ν€μ§κ° μμΌλ©΄ no-op λ°μ½λ μ΄ν° λ°ν
|
|
23
|
+
return () => { };
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
// λμ importλ‘ @nestjs/swagger λ‘λ
|
|
27
|
+
const { ApiProperty, ApiPropertyOptional } = require('@nestjs/swagger');
|
|
28
|
+
// ApiPropertyOptions νμ
κ³Ό νΈνλλλ‘ λ³ν
|
|
29
|
+
const apiOptions = options;
|
|
30
|
+
return optional ? ApiPropertyOptional(apiOptions) : ApiProperty(apiOptions);
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
// λ‘λ μ€ν¨ μ no-op λ°μ½λ μ΄ν° λ°ν
|
|
34
|
+
console.warn('[ts-deco] @nestjs/swaggerλ₯Ό λ‘λν μ μμ΅λλ€. Swagger λ°μ½λ μ΄ν°λ 건λλλλ€.');
|
|
35
|
+
return () => { };
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=swagger.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swagger.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/validators/utils/swagger.decorator.ts"],"names":[],"mappings":";;AAmBA,kDAsBC;AAtCD;;GAEG;AACH,SAAS,iBAAiB;IACtB,IAAI,CAAC;QACD,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;QACnC,OAAO,IAAI,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,KAAK,CAAC;IACjB,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,SAAgB,mBAAmB,CAC/B,QAAiB,EACjB,OAA+B;IAE/B,IAAI,CAAC,iBAAiB,EAAE,EAAE,CAAC;QACvB,kCAAkC;QAClC,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;IACpB,CAAC;IAED,IAAI,CAAC;QACD,gCAAgC;QAChC,MAAM,EAAE,WAAW,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;QAExE,kCAAkC;QAClC,MAAM,UAAU,GAAG,OAAc,CAAC;QAElC,OAAO,QAAQ,CAAC,CAAC,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAChF,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,yBAAyB;QACzB,OAAO,CAAC,IAAI,CAAC,8DAA8D,CAAC,CAAC;QAC7E,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;IACpB,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Swagger Property Options νμ
μ μ
|
|
3
|
+
* @nestjs/swaggerμ ApiPropertyOptionsμ νΈνλμ§λ§ λ
립μ μΌλ‘ μ¬μ© κ°λ₯
|
|
4
|
+
*/
|
|
5
|
+
export interface SwaggerPropertyOptions {
|
|
6
|
+
type?: any;
|
|
7
|
+
isArray?: boolean;
|
|
8
|
+
enum?: any[] | {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
};
|
|
11
|
+
description?: string;
|
|
12
|
+
example?: any;
|
|
13
|
+
examples?: any;
|
|
14
|
+
required?: boolean | string[];
|
|
15
|
+
default?: any;
|
|
16
|
+
format?: string;
|
|
17
|
+
minimum?: number;
|
|
18
|
+
maximum?: number;
|
|
19
|
+
exclusiveMinimum?: number | boolean;
|
|
20
|
+
exclusiveMaximum?: number | boolean;
|
|
21
|
+
minLength?: number;
|
|
22
|
+
maxLength?: number;
|
|
23
|
+
pattern?: string;
|
|
24
|
+
multipleOf?: number;
|
|
25
|
+
minItems?: number;
|
|
26
|
+
maxItems?: number;
|
|
27
|
+
uniqueItems?: boolean;
|
|
28
|
+
minProperties?: number;
|
|
29
|
+
maxProperties?: number;
|
|
30
|
+
additionalProperties?: boolean | object;
|
|
31
|
+
nullable?: boolean;
|
|
32
|
+
readOnly?: boolean;
|
|
33
|
+
writeOnly?: boolean;
|
|
34
|
+
xml?: any;
|
|
35
|
+
externalDocs?: any;
|
|
36
|
+
deprecated?: boolean;
|
|
37
|
+
title?: string;
|
|
38
|
+
allOf?: any[];
|
|
39
|
+
oneOf?: any[];
|
|
40
|
+
anyOf?: any[];
|
|
41
|
+
not?: any;
|
|
42
|
+
discriminator?: any;
|
|
43
|
+
[key: string]: any;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=swagger.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swagger.types.d.ts","sourceRoot":"","sources":["../../../../src/decorators/validators/utils/swagger.types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACnC,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAC;IAC9B,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACpC,gBAAgB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,oBAAoB,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,GAAG,CAAC,EAAE,GAAG,CAAC;IACV,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;IACd,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;IACd,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;IACd,GAAG,CAAC,EAAE,GAAG,CAAC;IACV,aAAa,CAAC,EAAE,GAAG,CAAC;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swagger.types.js","sourceRoot":"","sources":["../../../../src/decorators/validators/utils/swagger.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator-options.d.ts","sourceRoot":"","sources":["../../../../src/decorators/validators/utils/validator-options.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,GAAI,gCAGjC;IACC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC7B;;;CAKA,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getValidatorOptions = void 0;
|
|
4
|
+
const getValidatorOptions = ({ isArray, validatorMessage, }) => {
|
|
5
|
+
return {
|
|
6
|
+
...(isArray && { each: true }),
|
|
7
|
+
...(validatorMessage && { message: validatorMessage }),
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
exports.getValidatorOptions = getValidatorOptions;
|
|
11
|
+
//# sourceMappingURL=validator-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator-options.js","sourceRoot":"","sources":["../../../../src/decorators/validators/utils/validator-options.ts"],"names":[],"mappings":";;;AAAO,MAAM,mBAAmB,GAAG,CAAC,EAChC,OAAO,EACP,gBAAgB,GAInB,EAAE,EAAE;IACD,OAAO;QACH,GAAG,CAAC,OAAO,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;QAC9B,GAAG,CAAC,gBAAgB,IAAI,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC;KACzD,CAAC;AACN,CAAC,CAAC;AAXW,QAAA,mBAAmB,uBAW9B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** base validator options */
|
|
2
|
+
export type DtoValidatorOptions = {
|
|
3
|
+
optional?: boolean;
|
|
4
|
+
validatorMessage?: string;
|
|
5
|
+
notEmptyMessage?: string;
|
|
6
|
+
arrayMessage?: string;
|
|
7
|
+
};
|
|
8
|
+
/** number validator options */
|
|
9
|
+
export type DtoNumberValidatorOptions = DtoValidatorOptions & {
|
|
10
|
+
isInt?: boolean;
|
|
11
|
+
min?: number;
|
|
12
|
+
max?: number;
|
|
13
|
+
minMessage?: string;
|
|
14
|
+
maxMessage?: string;
|
|
15
|
+
};
|
|
16
|
+
/** enum validator options */
|
|
17
|
+
export type DtoEnumValidatorOptions = DtoValidatorOptions & {
|
|
18
|
+
exclude?: any[];
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=validator.type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator.type.d.ts","sourceRoot":"","sources":["../../../src/decorators/validators/validator.type.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,MAAM,MAAM,mBAAmB,GAAG;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,+BAA+B;AAC/B,MAAM,MAAM,yBAAyB,GAAG,mBAAmB,GAAG;IAC1D,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,6BAA6B;AAC7B,MAAM,MAAM,uBAAuB,GAAG,mBAAmB,GAAG;IACxD,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;CACnB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator.type.js","sourceRoot":"","sources":["../../../src/decorators/validators/validator.type.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { default as DtoString } from './decorators/validators/string.decorator';
|
|
2
|
+
export { default as DtoNumber } from './decorators/validators/number.decorator';
|
|
3
|
+
export { default as DtoDate } from './decorators/validators/date.decorator';
|
|
4
|
+
export { default as DtoBoolean } from './decorators/validators/boolean.decorator';
|
|
5
|
+
export { default as DtoEnum } from './decorators/validators/enum.decorator';
|
|
6
|
+
export { default as Property } from './decorators/validators/property.decorator';
|
|
7
|
+
export type { DtoValidatorOptions, DtoNumberValidatorOptions, DtoEnumValidatorOptions, } from './decorators/validators/validator.type';
|
|
8
|
+
export { getApiPropertyDecorator, getRequiredValidator, getIsArrayDecorator, createCommonDecorators, extractCommonOptions, } from './decorators/validators/utils/common-decorators';
|
|
9
|
+
export { getValidatorOptions } from './decorators/validators/utils/validator-options';
|
|
10
|
+
export { applyDecorators } from './decorators/utils/apply-decorators';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,2CAA2C,CAAC;AAClF,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,4CAA4C,CAAC;AAGjF,YAAY,EACR,mBAAmB,EACnB,yBAAyB,EACzB,uBAAuB,GAC1B,MAAM,wCAAwC,CAAC;AAGhD,OAAO,EACH,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,GACvB,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AACtF,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.applyDecorators = exports.getValidatorOptions = exports.extractCommonOptions = exports.createCommonDecorators = exports.getIsArrayDecorator = exports.getRequiredValidator = exports.getApiPropertyDecorator = exports.Property = exports.DtoEnum = exports.DtoBoolean = exports.DtoDate = exports.DtoNumber = exports.DtoString = void 0;
|
|
7
|
+
// Validators
|
|
8
|
+
var string_decorator_1 = require("./decorators/validators/string.decorator");
|
|
9
|
+
Object.defineProperty(exports, "DtoString", { enumerable: true, get: function () { return __importDefault(string_decorator_1).default; } });
|
|
10
|
+
var number_decorator_1 = require("./decorators/validators/number.decorator");
|
|
11
|
+
Object.defineProperty(exports, "DtoNumber", { enumerable: true, get: function () { return __importDefault(number_decorator_1).default; } });
|
|
12
|
+
var date_decorator_1 = require("./decorators/validators/date.decorator");
|
|
13
|
+
Object.defineProperty(exports, "DtoDate", { enumerable: true, get: function () { return __importDefault(date_decorator_1).default; } });
|
|
14
|
+
var boolean_decorator_1 = require("./decorators/validators/boolean.decorator");
|
|
15
|
+
Object.defineProperty(exports, "DtoBoolean", { enumerable: true, get: function () { return __importDefault(boolean_decorator_1).default; } });
|
|
16
|
+
var enum_decorator_1 = require("./decorators/validators/enum.decorator");
|
|
17
|
+
Object.defineProperty(exports, "DtoEnum", { enumerable: true, get: function () { return __importDefault(enum_decorator_1).default; } });
|
|
18
|
+
var property_decorator_1 = require("./decorators/validators/property.decorator");
|
|
19
|
+
Object.defineProperty(exports, "Property", { enumerable: true, get: function () { return __importDefault(property_decorator_1).default; } });
|
|
20
|
+
// Utils
|
|
21
|
+
var common_decorators_1 = require("./decorators/validators/utils/common-decorators");
|
|
22
|
+
Object.defineProperty(exports, "getApiPropertyDecorator", { enumerable: true, get: function () { return common_decorators_1.getApiPropertyDecorator; } });
|
|
23
|
+
Object.defineProperty(exports, "getRequiredValidator", { enumerable: true, get: function () { return common_decorators_1.getRequiredValidator; } });
|
|
24
|
+
Object.defineProperty(exports, "getIsArrayDecorator", { enumerable: true, get: function () { return common_decorators_1.getIsArrayDecorator; } });
|
|
25
|
+
Object.defineProperty(exports, "createCommonDecorators", { enumerable: true, get: function () { return common_decorators_1.createCommonDecorators; } });
|
|
26
|
+
Object.defineProperty(exports, "extractCommonOptions", { enumerable: true, get: function () { return common_decorators_1.extractCommonOptions; } });
|
|
27
|
+
var validator_options_1 = require("./decorators/validators/utils/validator-options");
|
|
28
|
+
Object.defineProperty(exports, "getValidatorOptions", { enumerable: true, get: function () { return validator_options_1.getValidatorOptions; } });
|
|
29
|
+
var apply_decorators_1 = require("./decorators/utils/apply-decorators");
|
|
30
|
+
Object.defineProperty(exports, "applyDecorators", { enumerable: true, get: function () { return apply_decorators_1.applyDecorators; } });
|
|
31
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,aAAa;AACb,6EAAgF;AAAvE,8HAAA,OAAO,OAAa;AAC7B,6EAAgF;AAAvE,8HAAA,OAAO,OAAa;AAC7B,yEAA4E;AAAnE,0HAAA,OAAO,OAAW;AAC3B,+EAAkF;AAAzE,gIAAA,OAAO,OAAc;AAC9B,yEAA4E;AAAnE,0HAAA,OAAO,OAAW;AAC3B,iFAAiF;AAAxE,+HAAA,OAAO,OAAY;AAS5B,QAAQ;AACR,qFAMyD;AALrD,4HAAA,uBAAuB,OAAA;AACvB,yHAAA,oBAAoB,OAAA;AACpB,wHAAA,mBAAmB,OAAA;AACnB,2HAAA,sBAAsB,OAAA;AACtB,yHAAA,oBAAoB,OAAA;AAExB,qFAAsF;AAA7E,wHAAA,mBAAmB,OAAA;AAC5B,wEAAsE;AAA7D,mHAAA,eAAe,OAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ts-deco",
|
|
3
|
+
"version": "1.0.3",
|
|
4
|
+
"description": "TypeScript decorator utilities for NestJS",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"README.md"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsc",
|
|
13
|
+
"prepublishOnly": "npm run build",
|
|
14
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
15
|
+
"publish:patch": "npm version patch --no-git-tag-version && npm publish",
|
|
16
|
+
"publish:minor": "npm version minor --no-git-tag-version && npm publish",
|
|
17
|
+
"publish:major": "npm version major --no-git-tag-version && npm publish",
|
|
18
|
+
"publish:dry-run": "npm publish --dry-run"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"typescript",
|
|
22
|
+
"decorator",
|
|
23
|
+
"nestjs",
|
|
24
|
+
"validation",
|
|
25
|
+
"dto"
|
|
26
|
+
],
|
|
27
|
+
"author": "",
|
|
28
|
+
"license": "ISC",
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"@nestjs/swagger": "^7.0.0",
|
|
31
|
+
"class-transformer": "^0.5.0",
|
|
32
|
+
"class-validator": "^0.14.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@nestjs/swagger": "^7.0.0",
|
|
36
|
+
"class-transformer": "^0.5.0",
|
|
37
|
+
"class-validator": "^0.14.0",
|
|
38
|
+
"typescript": "^5.0.0"
|
|
39
|
+
}
|
|
40
|
+
}
|