dev4fun-utils 0.0.2 → 0.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 +340 -0
- package/package.json +2 -2
- package/dist/common/base/base.exception.d.ts +0 -16
- package/dist/common/base/base.exception.js +0 -24
- package/dist/common/base/base.exception.js.map +0 -1
- package/dist/common/base/base.typeorm.d.ts +0 -9
- package/dist/common/base/base.typeorm.js +0 -75
- package/dist/common/base/base.typeorm.js.map +0 -1
- package/dist/common/common.module.d.ts +0 -2
- package/dist/common/common.module.js +0 -21
- package/dist/common/common.module.js.map +0 -1
- package/dist/common/decorators/common.decorator.d.ts +0 -7
- package/dist/common/decorators/common.decorator.js +0 -94
- package/dist/common/decorators/common.decorator.js.map +0 -1
- package/dist/common/dto/id.dto.d.ts +0 -3
- package/dist/common/dto/id.dto.js +0 -31
- package/dist/common/dto/id.dto.js.map +0 -1
- package/dist/common/dto/page.dto.d.ts +0 -6
- package/dist/common/dto/page.dto.js +0 -69
- package/dist/common/dto/page.dto.js.map +0 -1
- package/dist/common/dto/time.dto.d.ts +0 -4
- package/dist/common/dto/time.dto.js +0 -43
- package/dist/common/dto/time.dto.js.map +0 -1
- package/dist/common/struct/batch.struct.d.ts +0 -7
- package/dist/common/struct/batch.struct.js +0 -37
- package/dist/common/struct/batch.struct.js.map +0 -1
- package/dist/common/struct/list/batch.struct.d.ts +0 -7
- package/dist/common/struct/list/batch.struct.js +0 -41
- package/dist/common/struct/list/batch.struct.js.map +0 -1
- package/dist/common/struct/list/queue.struct.d.ts +0 -10
- package/dist/common/struct/list/queue.struct.js +0 -39
- package/dist/common/struct/list/queue.struct.js.map +0 -1
- package/dist/common/struct/list/stack.struct.d.ts +0 -9
- package/dist/common/struct/list/stack.struct.js +0 -36
- package/dist/common/struct/list/stack.struct.js.map +0 -1
- package/dist/common/struct/list/tree.struct.d.ts +0 -15
- package/dist/common/struct/list/tree.struct.js +0 -39
- package/dist/common/struct/list/tree.struct.js.map +0 -1
- package/dist/common/struct/page.struct.d.ts +0 -17
- package/dist/common/struct/page.struct.js +0 -96
- package/dist/common/struct/page.struct.js.map +0 -1
- package/dist/common/struct/queue.struct.d.ts +0 -10
- package/dist/common/struct/queue.struct.js +0 -33
- package/dist/common/struct/queue.struct.js.map +0 -1
- package/dist/common/struct/stack.struct.d.ts +0 -9
- package/dist/common/struct/stack.struct.js +0 -32
- package/dist/common/struct/stack.struct.js.map +0 -1
- package/dist/common/utils/method.util.d.ts +0 -6
- package/dist/common/utils/method.util.js +0 -38
- package/dist/common/utils/method.util.js.map +0 -1
- package/dist/common/utils/number.util.d.ts +0 -5
- package/dist/common/utils/number.util.js +0 -16
- package/dist/common/utils/number.util.js.map +0 -1
- package/dist/common/utils/string.util.d.ts +0 -5
- package/dist/common/utils/string.util.js +0 -17
- package/dist/common/utils/string.util.js.map +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -19
- package/dist/index.js.map +0 -1
- package/dist/tsconfig.build.tsbuildinfo +0 -1
package/README.md
CHANGED
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
# dev4fun-utils
|
|
2
|
+
|
|
3
|
+
Thư viện tiện ích cho NestJS với TypeORM base entities, decorators và các công cụ hỗ trợ phổ biến.
|
|
4
|
+
|
|
5
|
+
## Cài đặt
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bun add dev4fun-utils
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
hoặc
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install dev4fun-utils
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Tính năng
|
|
18
|
+
|
|
19
|
+
### Base Entities
|
|
20
|
+
|
|
21
|
+
#### BaseTypeormEntity
|
|
22
|
+
|
|
23
|
+
Base entity cho TypeORM với các trường tự động:
|
|
24
|
+
- `id`: Primary key tự động tăng
|
|
25
|
+
- `createdAt`: Thời gian tạo (timestamp)
|
|
26
|
+
- `updatedAt`: Thời gian cập nhật (timestamp)
|
|
27
|
+
- `deletedAt`: Thời gian xóa (soft delete, timestamp)
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import { BaseTypeormEntity } from 'dev4fun-utils';
|
|
31
|
+
import { Entity } from 'typeorm';
|
|
32
|
+
|
|
33
|
+
@Entity()
|
|
34
|
+
export class User extends BaseTypeormEntity {
|
|
35
|
+
// Các trường của bạn
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Base Exception
|
|
40
|
+
|
|
41
|
+
#### BaseException
|
|
42
|
+
|
|
43
|
+
Class exception mở rộng từ HttpException với mã lỗi tùy chỉnh:
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
import { BaseException } from 'dev4fun-utils';
|
|
47
|
+
|
|
48
|
+
// Sử dụng các exception có sẵn
|
|
49
|
+
throw BaseException.NOT_FOUND;
|
|
50
|
+
throw BaseException.BAD_REQUEST;
|
|
51
|
+
throw BaseException.UNAUTHORIZED;
|
|
52
|
+
throw BaseException.FORBIDDEN;
|
|
53
|
+
throw BaseException.INTERNAL_SERVER_ERROR;
|
|
54
|
+
throw BaseException.SERVICE_UNAVAILABLE;
|
|
55
|
+
throw BaseException.GATEWAY_TIMEOUT;
|
|
56
|
+
throw BaseException.PRECONDITION_FAILED;
|
|
57
|
+
throw BaseException.PAYLOAD_TOO_LARGE;
|
|
58
|
+
throw BaseException.UNPROCESSABLE_ENTITY;
|
|
59
|
+
throw BaseException.TOO_MANY_REQUESTS;
|
|
60
|
+
|
|
61
|
+
// Hoặc tạo exception tùy chỉnh
|
|
62
|
+
throw new BaseException('Custom message', 400, 'CUSTOM_ERROR');
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Decorators
|
|
66
|
+
|
|
67
|
+
#### @Retry
|
|
68
|
+
|
|
69
|
+
Thử lại method khi gặp lỗi:
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
import { Retry } from 'dev4fun-utils';
|
|
73
|
+
|
|
74
|
+
class MyService {
|
|
75
|
+
@Retry(3, 1000) // Thử lại 3 lần, mỗi lần cách nhau 1 giây
|
|
76
|
+
async fetchData() {
|
|
77
|
+
// Code của bạn
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
#### @Timeout
|
|
83
|
+
|
|
84
|
+
Thiết lập timeout cho method:
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
import { Timeout } from 'dev4fun-utils';
|
|
88
|
+
|
|
89
|
+
class MyService {
|
|
90
|
+
@Timeout(5000) // Timeout sau 5 giây
|
|
91
|
+
async fetchData() {
|
|
92
|
+
// Code của bạn
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
#### @Cache
|
|
98
|
+
|
|
99
|
+
Cache kết quả của method:
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
import { Cache } from 'dev4fun-utils';
|
|
103
|
+
|
|
104
|
+
class MyService {
|
|
105
|
+
@Cache(60000) // Cache trong 60 giây
|
|
106
|
+
async getData() {
|
|
107
|
+
// Code của bạn
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
#### @Watch
|
|
113
|
+
|
|
114
|
+
Log thông tin khi method được gọi:
|
|
115
|
+
|
|
116
|
+
```typescript
|
|
117
|
+
import { Watch } from 'dev4fun-utils';
|
|
118
|
+
|
|
119
|
+
class MyService {
|
|
120
|
+
@Watch()
|
|
121
|
+
async processData(data: any) {
|
|
122
|
+
// Code của bạn
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
#### @Validate và @NonNull
|
|
128
|
+
|
|
129
|
+
Validate tham số không được null:
|
|
130
|
+
|
|
131
|
+
```typescript
|
|
132
|
+
import { Validate, NonNull } from 'dev4fun-utils';
|
|
133
|
+
|
|
134
|
+
class MyService {
|
|
135
|
+
@Validate()
|
|
136
|
+
async processData(@NonNull data: string) {
|
|
137
|
+
// Code của bạn
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### DTOs
|
|
143
|
+
|
|
144
|
+
#### IdDto
|
|
145
|
+
|
|
146
|
+
DTO cho ID:
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
import { IdDto } from 'dev4fun-utils';
|
|
150
|
+
|
|
151
|
+
class MyController {
|
|
152
|
+
@Get(':id')
|
|
153
|
+
async getById(@Param() params: IdDto) {
|
|
154
|
+
// params.id là number
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
#### PageDto
|
|
160
|
+
|
|
161
|
+
DTO cho phân trang:
|
|
162
|
+
|
|
163
|
+
```typescript
|
|
164
|
+
import { PageDto } from 'dev4fun-utils';
|
|
165
|
+
|
|
166
|
+
class MyController {
|
|
167
|
+
@Get()
|
|
168
|
+
async getList(@Query() query: PageDto) {
|
|
169
|
+
// query.page, query.size, query.search, query.sort
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
#### TimeDto
|
|
175
|
+
|
|
176
|
+
DTO cho khoảng thời gian:
|
|
177
|
+
|
|
178
|
+
```typescript
|
|
179
|
+
import { TimeDto } from 'dev4fun-utils';
|
|
180
|
+
|
|
181
|
+
class MyController {
|
|
182
|
+
@Get()
|
|
183
|
+
async getByTime(@Query() query: TimeDto) {
|
|
184
|
+
// query.startDate, query.endDate
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Structs
|
|
190
|
+
|
|
191
|
+
#### Page
|
|
192
|
+
|
|
193
|
+
Struct cho phân trang với TypeORM:
|
|
194
|
+
|
|
195
|
+
```typescript
|
|
196
|
+
import { Page, PageDto } from 'dev4fun-utils';
|
|
197
|
+
import { SelectQueryBuilder } from 'typeorm';
|
|
198
|
+
|
|
199
|
+
async function getUsers(dto: PageDto) {
|
|
200
|
+
const page = new Page(dto, 0);
|
|
201
|
+
page.queryBuilder = userRepository.createQueryBuilder('user');
|
|
202
|
+
await page.execute();
|
|
203
|
+
return page; // page.data, page.total, page.totalPages, etc.
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
#### Batch
|
|
208
|
+
|
|
209
|
+
Xử lý dữ liệu theo batch:
|
|
210
|
+
|
|
211
|
+
```typescript
|
|
212
|
+
import { Batch } from 'dev4fun-utils';
|
|
213
|
+
|
|
214
|
+
const batch = Batch.fromArray([1, 2, 3, 4, 5], 2); // Chia thành batch 2 phần tử
|
|
215
|
+
|
|
216
|
+
await batch.runAsync(async (items, index) => {
|
|
217
|
+
console.log(`Batch ${index}:`, items);
|
|
218
|
+
}, false, 1000); // Chạy tuần tự, delay 1 giây giữa các batch
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
#### Queue
|
|
222
|
+
|
|
223
|
+
Hàng đợi (FIFO):
|
|
224
|
+
|
|
225
|
+
```typescript
|
|
226
|
+
import { Queue } from 'dev4fun-utils';
|
|
227
|
+
|
|
228
|
+
const queue = Queue.fromArray([1, 2, 3]);
|
|
229
|
+
|
|
230
|
+
queue.enqueue(4); // Thêm vào cuối
|
|
231
|
+
const item = queue.dequeue(); // Lấy phần tử đầu tiên
|
|
232
|
+
const peek = queue.peek(); // Xem phần tử đầu tiên không xóa
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
#### Stack
|
|
236
|
+
|
|
237
|
+
Ngăn xếp (LIFO):
|
|
238
|
+
|
|
239
|
+
```typescript
|
|
240
|
+
import { Stack } from 'dev4fun-utils';
|
|
241
|
+
|
|
242
|
+
const stack = Stack.fromArray([1, 2, 3]);
|
|
243
|
+
|
|
244
|
+
stack.push(4); // Thêm vào đầu
|
|
245
|
+
const item = stack.pop(); // Lấy phần tử đầu tiên
|
|
246
|
+
const top = stack.top(); // Xem phần tử đầu tiên không xóa
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
#### Tree
|
|
250
|
+
|
|
251
|
+
Cấu trúc cây:
|
|
252
|
+
|
|
253
|
+
```typescript
|
|
254
|
+
import { Tree, TreeNode } from 'dev4fun-utils';
|
|
255
|
+
|
|
256
|
+
const tree = new Tree('root');
|
|
257
|
+
const node1 = tree.addNode('node1');
|
|
258
|
+
const node2 = tree.addNode('node2');
|
|
259
|
+
|
|
260
|
+
node1.addChild(new TreeNode('child1', node1));
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### Utils
|
|
264
|
+
|
|
265
|
+
#### MethodUtil
|
|
266
|
+
|
|
267
|
+
Các tiện ích cho method:
|
|
268
|
+
|
|
269
|
+
```typescript
|
|
270
|
+
import { MethodUtil } from 'dev4fun-utils';
|
|
271
|
+
|
|
272
|
+
// Delay
|
|
273
|
+
await MethodUtil.delay(1000); // Delay 1 giây
|
|
274
|
+
|
|
275
|
+
// Execute với timeout
|
|
276
|
+
await MethodUtil.executeWithTimeout(promise, 5000);
|
|
277
|
+
|
|
278
|
+
// Execute với retry
|
|
279
|
+
await MethodUtil.executeWithRetry(promise, 3, 1000);
|
|
280
|
+
|
|
281
|
+
// Execute command
|
|
282
|
+
const output = await MethodUtil.cmdExecute('ls -la');
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
#### NumberUtil
|
|
286
|
+
|
|
287
|
+
Các tiện ích cho số:
|
|
288
|
+
|
|
289
|
+
```typescript
|
|
290
|
+
import { NumberUtil } from 'dev4fun-utils';
|
|
291
|
+
|
|
292
|
+
// Random integer
|
|
293
|
+
const num = NumberUtil.nextInt(1, 100);
|
|
294
|
+
|
|
295
|
+
// Random float
|
|
296
|
+
const float = NumberUtil.nextFloat(0, 1);
|
|
297
|
+
|
|
298
|
+
// Format VND
|
|
299
|
+
const formatted = NumberUtil.formatVND(1000000); // "1,000,000"
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
#### StringUtil
|
|
303
|
+
|
|
304
|
+
Các tiện ích cho chuỗi:
|
|
305
|
+
|
|
306
|
+
```typescript
|
|
307
|
+
import { StringUtil } from 'dev4fun-utils';
|
|
308
|
+
|
|
309
|
+
// Hash password
|
|
310
|
+
const hash = await StringUtil.hashValue('password', 16);
|
|
311
|
+
|
|
312
|
+
// Verify hash
|
|
313
|
+
const isValid = await StringUtil.verifyHash('password', hash);
|
|
314
|
+
|
|
315
|
+
// Random string
|
|
316
|
+
const random = StringUtil.randomString(10);
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
## Module
|
|
320
|
+
|
|
321
|
+
Import CommonModule vào ứng dụng NestJS của bạn:
|
|
322
|
+
|
|
323
|
+
```typescript
|
|
324
|
+
import { CommonModule } from 'dev4fun-utils';
|
|
325
|
+
import { Module } from '@nestjs/common';
|
|
326
|
+
|
|
327
|
+
@Module({
|
|
328
|
+
imports: [CommonModule],
|
|
329
|
+
})
|
|
330
|
+
export class AppModule {}
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
## License
|
|
334
|
+
|
|
335
|
+
MIT
|
|
336
|
+
|
|
337
|
+
## Author
|
|
338
|
+
|
|
339
|
+
Nguyen Chau Tuan
|
|
340
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dev4fun-utils",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Utility package for NestJS with TypeORM base entities and common decorators",
|
|
5
5
|
"author": "Nguyen Chau Tuan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
25
|
"build": "nest build",
|
|
26
|
-
"publish": "npm run build && npm version patch && bun publish",
|
|
26
|
+
"publish": "npm run build && npm version patch && bun publish --access public",
|
|
27
27
|
"version": "node updateversion.js"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { HttpException } from "@nestjs/common";
|
|
2
|
-
export declare class BaseException extends HttpException {
|
|
3
|
-
constructor(message: string, statusCode: number, code: string);
|
|
4
|
-
code: string;
|
|
5
|
-
static NOT_FOUND: BaseException;
|
|
6
|
-
static BAD_REQUEST: BaseException;
|
|
7
|
-
static UNAUTHORIZED: BaseException;
|
|
8
|
-
static FORBIDDEN: BaseException;
|
|
9
|
-
static INTERNAL_SERVER_ERROR: BaseException;
|
|
10
|
-
static SERVICE_UNAVAILABLE: BaseException;
|
|
11
|
-
static GATEWAY_TIMEOUT: BaseException;
|
|
12
|
-
static PRECONDITION_FAILED: BaseException;
|
|
13
|
-
static PAYLOAD_TOO_LARGE: BaseException;
|
|
14
|
-
static UNPROCESSABLE_ENTITY: BaseException;
|
|
15
|
-
static TOO_MANY_REQUESTS: BaseException;
|
|
16
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BaseException = void 0;
|
|
4
|
-
const common_1 = require("@nestjs/common");
|
|
5
|
-
class BaseException extends common_1.HttpException {
|
|
6
|
-
constructor(message, statusCode, code) {
|
|
7
|
-
super(message, statusCode);
|
|
8
|
-
this.code = code;
|
|
9
|
-
}
|
|
10
|
-
code;
|
|
11
|
-
static NOT_FOUND = new BaseException('Not found', 404, 'NOT_FOUND');
|
|
12
|
-
static BAD_REQUEST = new BaseException('Bad request', 400, 'BAD_REQUEST');
|
|
13
|
-
static UNAUTHORIZED = new BaseException('Unauthorized', 401, 'UNAUTHORIZED');
|
|
14
|
-
static FORBIDDEN = new BaseException('Forbidden', 403, 'FORBIDDEN');
|
|
15
|
-
static INTERNAL_SERVER_ERROR = new BaseException('Internal server error', 500, 'INTERNAL_SERVER_ERROR');
|
|
16
|
-
static SERVICE_UNAVAILABLE = new BaseException('Service unavailable', 503, 'SERVICE_UNAVAILABLE');
|
|
17
|
-
static GATEWAY_TIMEOUT = new BaseException('Gateway timeout', 504, 'GATEWAY_TIMEOUT');
|
|
18
|
-
static PRECONDITION_FAILED = new BaseException('Precondition failed', 412, 'PRECONDITION_FAILED');
|
|
19
|
-
static PAYLOAD_TOO_LARGE = new BaseException('Payload too large', 413, 'PAYLOAD_TOO_LARGE');
|
|
20
|
-
static UNPROCESSABLE_ENTITY = new BaseException('Unprocessable entity', 422, 'UNPROCESSABLE_ENTITY');
|
|
21
|
-
static TOO_MANY_REQUESTS = new BaseException('Too many requests', 429, 'TOO_MANY_REQUESTS');
|
|
22
|
-
}
|
|
23
|
-
exports.BaseException = BaseException;
|
|
24
|
-
//# sourceMappingURL=base.exception.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base.exception.js","sourceRoot":"","sources":["../../../src/common/base/base.exception.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;AAE/C,MAAa,aAAc,SAAQ,sBAAa;IAC5C,YAAY,OAAe,EAAE,UAAkB,EAAE,IAAY;QACzD,KAAK,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;IACD,IAAI,CAAS;IACb,MAAM,CAAC,SAAS,GAAG,IAAI,aAAa,CAAC,WAAW,EAAE,GAAG,EAAE,WAAW,CAAC,CAAC;IACpE,MAAM,CAAC,WAAW,GAAG,IAAI,aAAa,CAAC,aAAa,EAAE,GAAG,EAAE,aAAa,CAAC,CAAC;IAC1E,MAAM,CAAC,YAAY,GAAG,IAAI,aAAa,CAAC,cAAc,EAAE,GAAG,EAAE,cAAc,CAAC,CAAC;IAC7E,MAAM,CAAC,SAAS,GAAG,IAAI,aAAa,CAAC,WAAW,EAAE,GAAG,EAAE,WAAW,CAAC,CAAC;IACpE,MAAM,CAAC,qBAAqB,GAAG,IAAI,aAAa,CAAC,uBAAuB,EAAE,GAAG,EAAE,uBAAuB,CAAC,CAAC;IACxG,MAAM,CAAC,mBAAmB,GAAG,IAAI,aAAa,CAAC,qBAAqB,EAAE,GAAG,EAAE,qBAAqB,CAAC,CAAC;IAClG,MAAM,CAAC,eAAe,GAAG,IAAI,aAAa,CAAC,iBAAiB,EAAE,GAAG,EAAE,iBAAiB,CAAC,CAAC;IACtF,MAAM,CAAC,mBAAmB,GAAG,IAAI,aAAa,CAAC,qBAAqB,EAAE,GAAG,EAAE,qBAAqB,CAAC,CAAC;IAClG,MAAM,CAAC,iBAAiB,GAAG,IAAI,aAAa,CAAC,mBAAmB,EAAE,GAAG,EAAE,mBAAmB,CAAC,CAAC;IAC5F,MAAM,CAAC,oBAAoB,GAAG,IAAI,aAAa,CAAC,sBAAsB,EAAE,GAAG,EAAE,sBAAsB,CAAC,CAAC;IACrG,MAAM,CAAC,iBAAiB,GAAG,IAAI,aAAa,CAAC,mBAAmB,EAAE,GAAG,EAAE,mBAAmB,CAAC,CAAC;;AAhBhG,sCAiBC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare abstract class BaseTypeormEntity {
|
|
2
|
-
readonly id: number;
|
|
3
|
-
readonly createdAt: number;
|
|
4
|
-
readonly updatedAt: number;
|
|
5
|
-
readonly deletedAt?: number;
|
|
6
|
-
static IsEntity(): boolean;
|
|
7
|
-
constructor(data?: Partial<BaseTypeormEntity>);
|
|
8
|
-
addJson(data: Partial<this>): void;
|
|
9
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.BaseTypeormEntity = void 0;
|
|
13
|
-
const typeorm_1 = require("typeorm");
|
|
14
|
-
const class_validator_1 = require("class-validator");
|
|
15
|
-
const swagger_1 = require("@nestjs/swagger");
|
|
16
|
-
const class_transformer_1 = require("class-transformer");
|
|
17
|
-
class BaseTypeormEntity {
|
|
18
|
-
id;
|
|
19
|
-
createdAt;
|
|
20
|
-
updatedAt;
|
|
21
|
-
deletedAt;
|
|
22
|
-
static IsEntity() {
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
25
|
-
constructor(data) {
|
|
26
|
-
if (data) {
|
|
27
|
-
Object.assign(this, data);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
addJson(data) {
|
|
31
|
-
Object.assign(this, data);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
exports.BaseTypeormEntity = BaseTypeormEntity;
|
|
35
|
-
__decorate([
|
|
36
|
-
(0, typeorm_1.PrimaryGeneratedColumn)(),
|
|
37
|
-
(0, class_validator_1.IsNumber)(),
|
|
38
|
-
(0, class_validator_1.Min)(0),
|
|
39
|
-
(0, swagger_1.ApiProperty)({
|
|
40
|
-
description: 'The id of the entity',
|
|
41
|
-
example: 1,
|
|
42
|
-
}),
|
|
43
|
-
__metadata("design:type", Number)
|
|
44
|
-
], BaseTypeormEntity.prototype, "id", void 0);
|
|
45
|
-
__decorate([
|
|
46
|
-
(0, typeorm_1.CreateDateColumn)({ type: 'timestamp' }),
|
|
47
|
-
(0, swagger_1.ApiProperty)({
|
|
48
|
-
description: 'The creation date of the entity',
|
|
49
|
-
example: Date.now(),
|
|
50
|
-
type: Number,
|
|
51
|
-
}),
|
|
52
|
-
(0, class_transformer_1.Transform)(({ value }) => value ? new Date(value).getTime() : null),
|
|
53
|
-
__metadata("design:type", Number)
|
|
54
|
-
], BaseTypeormEntity.prototype, "createdAt", void 0);
|
|
55
|
-
__decorate([
|
|
56
|
-
(0, typeorm_1.UpdateDateColumn)({ type: 'timestamp' }),
|
|
57
|
-
(0, swagger_1.ApiProperty)({
|
|
58
|
-
description: 'The update date of the entity',
|
|
59
|
-
example: Date.now(),
|
|
60
|
-
type: Number,
|
|
61
|
-
}),
|
|
62
|
-
(0, class_transformer_1.Transform)(({ value }) => value ? new Date(value).getTime() : null),
|
|
63
|
-
__metadata("design:type", Number)
|
|
64
|
-
], BaseTypeormEntity.prototype, "updatedAt", void 0);
|
|
65
|
-
__decorate([
|
|
66
|
-
(0, typeorm_1.DeleteDateColumn)({ type: 'timestamp' }),
|
|
67
|
-
(0, swagger_1.ApiProperty)({
|
|
68
|
-
description: 'The deletion date of the entity',
|
|
69
|
-
example: Date.now(),
|
|
70
|
-
type: Number,
|
|
71
|
-
}),
|
|
72
|
-
(0, class_transformer_1.Transform)(({ value }) => value ? new Date(value).getTime() : null),
|
|
73
|
-
__metadata("design:type", Number)
|
|
74
|
-
], BaseTypeormEntity.prototype, "deletedAt", void 0);
|
|
75
|
-
//# sourceMappingURL=base.typeorm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base.typeorm.js","sourceRoot":"","sources":["../../../src/common/base/base.typeorm.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAuH;AACvH,qDAA4D;AAC5D,6CAA8C;AAC9C,yDAA8C;AAE9C,MAAsB,iBAAiB;IAQ1B,EAAE,CAAS;IASX,SAAS,CAAS;IASlB,SAAS,CAAS;IASlB,SAAS,CAAU;IAE5B,MAAM,CAAC,QAAQ;QACX,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,YAAY,IAAiC;QACzC,IAAI,IAAI,EAAE,CAAC;YACP,MAAM,CAAC,MAAM,CAAC,IAAI,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AO,EAAE,IAAI,CAAC,GAAG,EAAE;QACnB,IAAI,EAAE,MAAM;KACf,CAAC;IACD,IAAA,6BAAS,EAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;;oDACvC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.CommonModule = void 0;
|
|
10
|
-
const common_1 = require("@nestjs/common");
|
|
11
|
-
let CommonModule = class CommonModule {
|
|
12
|
-
};
|
|
13
|
-
exports.CommonModule = CommonModule;
|
|
14
|
-
exports.CommonModule = CommonModule = __decorate([
|
|
15
|
-
(0, common_1.Module)({
|
|
16
|
-
imports: [],
|
|
17
|
-
exports: [],
|
|
18
|
-
providers: [],
|
|
19
|
-
})
|
|
20
|
-
], CommonModule);
|
|
21
|
-
//# sourceMappingURL=common.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common.module.js","sourceRoot":"","sources":["../../src/common/common.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AAOjC,IAAM,YAAY,GAAlB,MAAM,YAAY;CAAG,CAAA;AAAf,oCAAY;uBAAZ,YAAY;IALxB,IAAA,eAAM,EAAC;QACJ,OAAO,EAAE,EAAE;QACX,OAAO,EAAE,EAAE;QACX,SAAS,EAAE,EAAE;KAChB,CAAC;GACW,YAAY,CAAG"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import 'reflect-metadata';
|
|
2
|
-
export declare function Retry(retries?: number, delay?: number): MethodDecorator;
|
|
3
|
-
export declare function Timeout(timeout?: number): MethodDecorator;
|
|
4
|
-
export declare function Cache(ttl?: number): MethodDecorator;
|
|
5
|
-
export declare function Watch(): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
|
|
6
|
-
export declare function NonNull(target: any, propertyKey: string | symbol, index: number): void;
|
|
7
|
-
export declare function Validate(): MethodDecorator;
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Retry = Retry;
|
|
4
|
-
exports.Timeout = Timeout;
|
|
5
|
-
exports.Cache = Cache;
|
|
6
|
-
exports.Watch = Watch;
|
|
7
|
-
exports.NonNull = NonNull;
|
|
8
|
-
exports.Validate = Validate;
|
|
9
|
-
const method_util_1 = require("../utils/method.util");
|
|
10
|
-
require("reflect-metadata");
|
|
11
|
-
function Retry(retries = 3, delay = 1000) {
|
|
12
|
-
return function (target, propertyKey, descriptor) {
|
|
13
|
-
const originalMethod = descriptor.value;
|
|
14
|
-
descriptor.value = async function (...args) {
|
|
15
|
-
let lastError = null;
|
|
16
|
-
for (let i = 0; i < retries; i++) {
|
|
17
|
-
try {
|
|
18
|
-
return originalMethod.apply(this, args);
|
|
19
|
-
}
|
|
20
|
-
catch (error) {
|
|
21
|
-
lastError = error;
|
|
22
|
-
if (target['logger'] && target['logger'].error) {
|
|
23
|
-
target['logger'].error(`Error in ${propertyKey}: ${error.message} on attempt ${i + 1} of ${retries}`);
|
|
24
|
-
}
|
|
25
|
-
if (delay > 0) {
|
|
26
|
-
await method_util_1.MethodUtil.delay(delay);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
throw lastError;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
function Timeout(timeout = 10000) {
|
|
35
|
-
return function (target, propertyKey, descriptor) {
|
|
36
|
-
const originalMethod = descriptor.value;
|
|
37
|
-
descriptor.value = async function (...args) {
|
|
38
|
-
return await method_util_1.MethodUtil.executeWithTimeout(originalMethod.apply(this, args), timeout);
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
function Cache(ttl = 60000) {
|
|
43
|
-
return function (target, propertyKey, descriptor) {
|
|
44
|
-
const cache = new Map();
|
|
45
|
-
descriptor.value = async function (...args) {
|
|
46
|
-
const key = JSON.stringify(args);
|
|
47
|
-
if (cache.has(key)) {
|
|
48
|
-
return cache.get(key);
|
|
49
|
-
}
|
|
50
|
-
const result = await descriptor.value.apply(this, args);
|
|
51
|
-
cache.set(key, result);
|
|
52
|
-
if (ttl > 0) {
|
|
53
|
-
setTimeout(() => {
|
|
54
|
-
cache.delete(key);
|
|
55
|
-
}, ttl);
|
|
56
|
-
}
|
|
57
|
-
return result;
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
function Watch() {
|
|
62
|
-
return function (target, propertyKey, descriptor) {
|
|
63
|
-
const originalMethod = descriptor.value;
|
|
64
|
-
descriptor.value = async function (...args) {
|
|
65
|
-
const result = await originalMethod.apply(this, args);
|
|
66
|
-
if (target['logger'] && target['logger'].info) {
|
|
67
|
-
target['logger'].info(`${propertyKey} called with args: ${JSON.stringify(args)} and result: ${JSON.stringify(result)}`);
|
|
68
|
-
}
|
|
69
|
-
return result;
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
function NonNull(target, propertyKey, index) {
|
|
74
|
-
Reflect.defineMetadata('nonNull', {
|
|
75
|
-
index: index,
|
|
76
|
-
type: 'nonNull',
|
|
77
|
-
}, target, propertyKey);
|
|
78
|
-
}
|
|
79
|
-
function Validate() {
|
|
80
|
-
return function (target, propertyKey, descriptor) {
|
|
81
|
-
const originalMethod = descriptor.value;
|
|
82
|
-
descriptor.value = async function (...args) {
|
|
83
|
-
const result = await originalMethod.apply(this, args);
|
|
84
|
-
const nonNulls = Reflect.getMetadata('nonNull', target, propertyKey);
|
|
85
|
-
for (const nonNull of nonNulls) {
|
|
86
|
-
if (result[nonNull.index] === null || result[nonNull.index] === undefined) {
|
|
87
|
-
throw new Error('Parameter is null or undefined of type ' + nonNull.type + ' at index ' + nonNull.index);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
return result;
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
//# sourceMappingURL=common.decorator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common.decorator.js","sourceRoot":"","sources":["../../../src/common/decorators/common.decorator.ts"],"names":[],"mappings":";;AAGA,sBAqBC;AAED,0BAOC;AAED,sBAkBC;AACD,sBAWC;AAED,0BAMC;AAED,4BAcC;AAxFD,sDAAkD;AAClD,4BAA0B;AAC1B,SAAgB,KAAK,CAAC,UAAkB,CAAC,EAAE,QAAgB,IAAI;IAC3D,OAAO,UAAU,MAAW,EAAE,WAAmB,EAAE,UAA8B;QAC7E,MAAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC;QACxC,UAAU,CAAC,KAAK,GAAG,KAAK,WAAW,GAAG,IAAW;YAC7C,IAAI,SAAS,GAAiB,IAAI,CAAC;YACnC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC/B,IAAI,CAAC;oBACD,OAAO,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;gBAC5C,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACb,SAAS,GAAG,KAAc,CAAC;oBAC3B,IAAG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AAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC;QACxC,UAAU,CAAC,KAAK,GAAG,KAAK,WAAW,GAAG,IAAW;YAC7C,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YACtD,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,CAAsC,CAAC;YAC1G,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;gBAC7B,IAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,IAAI,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,SAAS,EAAE,CAAC;oBACvE,MAAM,IAAI,KAAK,CAAC,yCAAyC,GAAG,OAAO,CAAC,IAAI,GAAG,YAAY,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;gBAC7G,CAAC;YACL,CAAC;YACD,OAAO,MAAM,CAAC;QAClB,CAAC,CAAC;IACN,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.IdDto = void 0;
|
|
13
|
-
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
-
const class_transformer_1 = require("class-transformer");
|
|
15
|
-
const class_validator_1 = require("class-validator");
|
|
16
|
-
const class_validator_2 = require("class-validator");
|
|
17
|
-
class IdDto {
|
|
18
|
-
id;
|
|
19
|
-
}
|
|
20
|
-
exports.IdDto = IdDto;
|
|
21
|
-
__decorate([
|
|
22
|
-
(0, class_validator_1.IsNumber)(),
|
|
23
|
-
(0, class_validator_2.Min)(0),
|
|
24
|
-
(0, swagger_1.ApiProperty)({
|
|
25
|
-
description: 'The id',
|
|
26
|
-
example: 1,
|
|
27
|
-
}),
|
|
28
|
-
(0, class_transformer_1.Transform)(({ value }) => Number(value)),
|
|
29
|
-
__metadata("design:type", Number)
|
|
30
|
-
], IdDto.prototype, "id", void 0);
|
|
31
|
-
//# sourceMappingURL=id.dto.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"id.dto.js","sourceRoot":"","sources":["../../../src/common/dto/id.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA8C;AAC9C,yDAA8C;AAC9C,qDAA2C;AAC3C,qDAAsC;AAEtC,MAAa,KAAK;IAQd,EAAE,CAAS;CACd;AATD,sBASC;AADG;IAPC,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAG,EAAC,CAAC,CAAC;IACN,IAAA,qBAAW,EAAC;QACT,WAAW,EAAE,QAAQ;QACrB,OAAO,EAAE,CAAC;KACb,CAAC;IACD,IAAA,6BAAS,EAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;;iCAC7B"}
|