@zola_do/nestjs-shared 0.2.8 → 0.2.12
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 +35 -35
- package/package.json +75 -75
package/README.md
CHANGED
|
@@ -56,11 +56,11 @@ import {
|
|
|
56
56
|
CommonEntity,
|
|
57
57
|
AuditModule,
|
|
58
58
|
EmailService,
|
|
59
|
-
} from
|
|
59
|
+
} from '@zola_do/nestjs-shared';
|
|
60
60
|
|
|
61
61
|
// From individual packages (tree-shaking)
|
|
62
|
-
import { AuthorizationModule } from
|
|
63
|
-
import { EntityCrudController } from
|
|
62
|
+
import { AuthorizationModule } from '@zola_do/authorization';
|
|
63
|
+
import { EntityCrudController } from '@zola_do/crud/controller';
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
## Quick Start
|
|
@@ -91,12 +91,12 @@ JWT_REFRESH_TOKEN_EXPIRES=7d
|
|
|
91
91
|
### 3. Set Up App Module
|
|
92
92
|
|
|
93
93
|
```typescript
|
|
94
|
-
import { Module } from
|
|
95
|
-
import { TypeOrmModule } from
|
|
96
|
-
import { dataSourceOptions } from
|
|
97
|
-
import { AuthorizationModule } from
|
|
98
|
-
import { AuditModule } from
|
|
99
|
-
import { EmailModule } from
|
|
94
|
+
import { Module } from '@nestjs/common';
|
|
95
|
+
import { TypeOrmModule } from '@nestjs/typeorm';
|
|
96
|
+
import { dataSourceOptions } from '@zola_do/nestjs-shared';
|
|
97
|
+
import { AuthorizationModule } from '@zola_do/nestjs-shared';
|
|
98
|
+
import { AuditModule } from '@zola_do/nestjs-shared';
|
|
99
|
+
import { EmailModule } from '@zola_do/nestjs-shared';
|
|
100
100
|
|
|
101
101
|
@Module({
|
|
102
102
|
imports: [
|
|
@@ -112,15 +112,15 @@ export class AppModule {}
|
|
|
112
112
|
### 4. Create CRUD Entity
|
|
113
113
|
|
|
114
114
|
```typescript
|
|
115
|
-
import { CommonEntity } from
|
|
116
|
-
import { Entity, Column } from
|
|
115
|
+
import { CommonEntity } from '@zola_do/nestjs-shared';
|
|
116
|
+
import { Entity, Column } from 'typeorm';
|
|
117
117
|
|
|
118
|
-
@Entity(
|
|
118
|
+
@Entity('products')
|
|
119
119
|
export class Product extends CommonEntity {
|
|
120
120
|
@Column()
|
|
121
121
|
name: string;
|
|
122
122
|
|
|
123
|
-
@Column(
|
|
123
|
+
@Column('decimal', { precision: 10, scale: 2 })
|
|
124
124
|
price: number;
|
|
125
125
|
}
|
|
126
126
|
```
|
|
@@ -128,19 +128,19 @@ export class Product extends CommonEntity {
|
|
|
128
128
|
### 5. Create CRUD Controller
|
|
129
129
|
|
|
130
130
|
```typescript
|
|
131
|
-
import { Controller } from
|
|
131
|
+
import { Controller } from '@nestjs/common';
|
|
132
132
|
import {
|
|
133
133
|
EntityCrudController,
|
|
134
134
|
EntityCrudService,
|
|
135
|
-
} from
|
|
136
|
-
import { Product } from
|
|
135
|
+
} from '@zola_do/nestjs-shared';
|
|
136
|
+
import { Product } from './product.entity';
|
|
137
137
|
|
|
138
|
-
@Controller(
|
|
138
|
+
@Controller('products')
|
|
139
139
|
export class ProductsController extends EntityCrudController<Product>({
|
|
140
|
-
createPermission:
|
|
141
|
-
viewPermission:
|
|
142
|
-
updatePermission:
|
|
143
|
-
deletePermission:
|
|
140
|
+
createPermission: 'product:create',
|
|
141
|
+
viewPermission: 'product:view',
|
|
142
|
+
updatePermission: 'product:update',
|
|
143
|
+
deletePermission: 'product:delete',
|
|
144
144
|
}) {
|
|
145
145
|
constructor(service: EntityCrudService<Product>) {
|
|
146
146
|
super(service);
|
|
@@ -190,7 +190,7 @@ export class ProductsModule {}
|
|
|
190
190
|
### Using Email Service
|
|
191
191
|
|
|
192
192
|
```typescript
|
|
193
|
-
import { EmailService } from
|
|
193
|
+
import { EmailService } from '@zola_do/nestjs-shared';
|
|
194
194
|
|
|
195
195
|
@Injectable()
|
|
196
196
|
class OrderService {
|
|
@@ -212,12 +212,12 @@ class OrderService {
|
|
|
212
212
|
import {
|
|
213
213
|
decodeCollectionQuery,
|
|
214
214
|
QueryConstructor,
|
|
215
|
-
} from
|
|
215
|
+
} from '@zola_do/nestjs-shared';
|
|
216
216
|
|
|
217
|
-
@Controller(
|
|
217
|
+
@Controller('products')
|
|
218
218
|
export class ProductsController {
|
|
219
219
|
@Get()
|
|
220
|
-
async findAll(@Query(
|
|
220
|
+
async findAll(@Query('q') q: string) {
|
|
221
221
|
const query = decodeCollectionQuery(q);
|
|
222
222
|
const dataQuery = QueryConstructor.constructQuery<Product>(
|
|
223
223
|
this.productRepo,
|
|
@@ -238,14 +238,14 @@ import {
|
|
|
238
238
|
CollectionQuery,
|
|
239
239
|
QueryConstructor,
|
|
240
240
|
FilterOperators,
|
|
241
|
-
} from
|
|
241
|
+
} from '@zola_do/nestjs-shared';
|
|
242
242
|
|
|
243
243
|
// TypeORM
|
|
244
244
|
import {
|
|
245
245
|
dataSourceOptions,
|
|
246
246
|
TypeOrmConfigHelper,
|
|
247
247
|
CommonEntity,
|
|
248
|
-
} from
|
|
248
|
+
} from '@zola_do/nestjs-shared';
|
|
249
249
|
|
|
250
250
|
// Authorization
|
|
251
251
|
import {
|
|
@@ -255,7 +255,7 @@ import {
|
|
|
255
255
|
AllowAnonymous,
|
|
256
256
|
CurrentUser,
|
|
257
257
|
AuthHelper,
|
|
258
|
-
} from
|
|
258
|
+
} from '@zola_do/nestjs-shared';
|
|
259
259
|
|
|
260
260
|
// CRUD
|
|
261
261
|
import {
|
|
@@ -263,17 +263,17 @@ import {
|
|
|
263
263
|
EntityCrudService,
|
|
264
264
|
EntityCrudOptions,
|
|
265
265
|
CRUD_REQUEST_CONTEXT_RESOLVER,
|
|
266
|
-
} from
|
|
266
|
+
} from '@zola_do/nestjs-shared';
|
|
267
267
|
|
|
268
268
|
// Audit
|
|
269
269
|
import {
|
|
270
270
|
AuditModule,
|
|
271
271
|
AuditRmqEvent,
|
|
272
272
|
AuditLoggerInterceptor,
|
|
273
|
-
} from
|
|
273
|
+
} from '@zola_do/nestjs-shared';
|
|
274
274
|
|
|
275
275
|
// Email
|
|
276
|
-
import { EmailModule, EmailService } from
|
|
276
|
+
import { EmailModule, EmailService } from '@zola_do/nestjs-shared';
|
|
277
277
|
|
|
278
278
|
// Storage
|
|
279
279
|
import {
|
|
@@ -281,17 +281,17 @@ import {
|
|
|
281
281
|
MinIOService,
|
|
282
282
|
StorageModule,
|
|
283
283
|
StorageService,
|
|
284
|
-
} from
|
|
284
|
+
} from '@zola_do/nestjs-shared';
|
|
285
285
|
|
|
286
286
|
// Documents
|
|
287
|
-
import { DocxModule, DocxService } from
|
|
287
|
+
import { DocxModule, DocxService } from '@zola_do/nestjs-shared';
|
|
288
288
|
import {
|
|
289
289
|
DocumentManipulatorModule,
|
|
290
290
|
DocumentManipulatorService,
|
|
291
|
-
} from
|
|
291
|
+
} from '@zola_do/nestjs-shared';
|
|
292
292
|
|
|
293
293
|
// Workflow
|
|
294
|
-
import { WorkflowEngineService } from
|
|
294
|
+
import { WorkflowEngineService } from '@zola_do/nestjs-shared';
|
|
295
295
|
```
|
|
296
296
|
|
|
297
297
|
## Peer Dependencies
|
package/package.json
CHANGED
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@zola_do/nestjs-shared",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "Shared package for NestJS applications - re-exports all @zola_do packages",
|
|
5
|
-
"author": "zolaDO",
|
|
6
|
-
"license": "ISC",
|
|
7
|
-
"sideEffects": false,
|
|
8
|
-
"engines": {
|
|
9
|
-
"node": ">=20.0.0"
|
|
10
|
-
},
|
|
11
|
-
"publishConfig": {
|
|
12
|
-
"access": "public"
|
|
13
|
-
},
|
|
14
|
-
"main": "./dist/index.js",
|
|
15
|
-
"types": "./dist/index.d.ts",
|
|
16
|
-
"exports": {
|
|
17
|
-
".": {
|
|
18
|
-
"types": "./dist/index.d.ts",
|
|
19
|
-
"require": "./dist/index.js",
|
|
20
|
-
"default": "./dist/index.js"
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
"files": [
|
|
24
|
-
"dist",
|
|
25
|
-
"README.md"
|
|
26
|
-
],
|
|
27
|
-
"scripts": {
|
|
28
|
-
"clean": "rimraf dist",
|
|
29
|
-
"typecheck": "tsc --noEmit",
|
|
30
|
-
"build": "npm run clean && tsc",
|
|
31
|
-
"prepublishOnly": "npm run build"
|
|
32
|
-
},
|
|
33
|
-
"dependencies": {
|
|
34
|
-
"@zola_do/collection-query": "^0.2.7",
|
|
35
|
-
"@zola_do/typeorm": "^0.2.7",
|
|
36
|
-
"@zola_do/authorization": "^0.2.7",
|
|
37
|
-
"@zola_do/crud": "^0.2.7",
|
|
38
|
-
"@zola_do/audit": "^0.2.7",
|
|
39
|
-
"@zola_do/email": "^0.2.7",
|
|
40
|
-
"@zola_do/minio": "^0.2.7",
|
|
41
|
-
"@zola_do/seaweed": "^0.2.7",
|
|
42
|
-
"@zola_do/docx": "^0.2.7",
|
|
43
|
-
"@zola_do/document-manipulator": "^0.2.7",
|
|
44
|
-
"@zola_do/workflow-engine": "^0.2.7",
|
|
45
|
-
"@zola_do/health": "^0.2.7"
|
|
46
|
-
},
|
|
47
|
-
"devDependencies": {
|
|
48
|
-
"rimraf": "^6.1.3",
|
|
49
|
-
"typescript": "^5.9.3"
|
|
50
|
-
},
|
|
51
|
-
"repository": {
|
|
52
|
-
"directory": "packages/zola-nestjs-shared",
|
|
53
|
-
"type": "git",
|
|
54
|
-
"url": "https://github.com/zola0031/zola-nestjs-shared.git"
|
|
55
|
-
},
|
|
56
|
-
"homepage": "https://github.com/zola0031/zola-nestjs-shared#readme",
|
|
57
|
-
"bugs": {
|
|
58
|
-
"url": "https://github.com/zola0031/zola-nestjs-shared/issues"
|
|
59
|
-
},
|
|
60
|
-
"funding": {
|
|
61
|
-
"type": "github",
|
|
62
|
-
"url": "https://github.com/sponsors/zola0031"
|
|
63
|
-
},
|
|
64
|
-
"keywords": [
|
|
65
|
-
"nestjs",
|
|
66
|
-
"typescript",
|
|
67
|
-
"library",
|
|
68
|
-
"shared",
|
|
69
|
-
"monorepo",
|
|
70
|
-
"zola_do",
|
|
71
|
-
"meta",
|
|
72
|
-
"bundle",
|
|
73
|
-
"nestjs-shared"
|
|
74
|
-
]
|
|
75
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@zola_do/nestjs-shared",
|
|
3
|
+
"version": "0.2.12",
|
|
4
|
+
"description": "Shared package for NestJS applications - re-exports all @zola_do packages",
|
|
5
|
+
"author": "zolaDO",
|
|
6
|
+
"license": "ISC",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"engines": {
|
|
9
|
+
"node": ">=20.0.0"
|
|
10
|
+
},
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
14
|
+
"main": "./dist/index.js",
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"require": "./dist/index.js",
|
|
20
|
+
"default": "./dist/index.js"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"README.md"
|
|
26
|
+
],
|
|
27
|
+
"scripts": {
|
|
28
|
+
"clean": "rimraf dist",
|
|
29
|
+
"typecheck": "tsc --noEmit",
|
|
30
|
+
"build": "npm run clean && tsc",
|
|
31
|
+
"prepublishOnly": "npm run build"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@zola_do/collection-query": "^0.2.7",
|
|
35
|
+
"@zola_do/typeorm": "^0.2.7",
|
|
36
|
+
"@zola_do/authorization": "^0.2.7",
|
|
37
|
+
"@zola_do/crud": "^0.2.7",
|
|
38
|
+
"@zola_do/audit": "^0.2.7",
|
|
39
|
+
"@zola_do/email": "^0.2.7",
|
|
40
|
+
"@zola_do/minio": "^0.2.7",
|
|
41
|
+
"@zola_do/seaweed": "^0.2.7",
|
|
42
|
+
"@zola_do/docx": "^0.2.7",
|
|
43
|
+
"@zola_do/document-manipulator": "^0.2.7",
|
|
44
|
+
"@zola_do/workflow-engine": "^0.2.7",
|
|
45
|
+
"@zola_do/health": "^0.2.7"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"rimraf": "^6.1.3",
|
|
49
|
+
"typescript": "^5.9.3"
|
|
50
|
+
},
|
|
51
|
+
"repository": {
|
|
52
|
+
"directory": "packages/zola-nestjs-shared",
|
|
53
|
+
"type": "git",
|
|
54
|
+
"url": "https://github.com/zola0031/zola-nestjs-shared.git"
|
|
55
|
+
},
|
|
56
|
+
"homepage": "https://github.com/zola0031/zola-nestjs-shared#readme",
|
|
57
|
+
"bugs": {
|
|
58
|
+
"url": "https://github.com/zola0031/zola-nestjs-shared/issues"
|
|
59
|
+
},
|
|
60
|
+
"funding": {
|
|
61
|
+
"type": "github",
|
|
62
|
+
"url": "https://github.com/sponsors/zola0031"
|
|
63
|
+
},
|
|
64
|
+
"keywords": [
|
|
65
|
+
"nestjs",
|
|
66
|
+
"typescript",
|
|
67
|
+
"library",
|
|
68
|
+
"shared",
|
|
69
|
+
"monorepo",
|
|
70
|
+
"zola_do",
|
|
71
|
+
"meta",
|
|
72
|
+
"bundle",
|
|
73
|
+
"nestjs-shared"
|
|
74
|
+
]
|
|
75
|
+
}
|