@flusys/nestjs-shared 1.1.0 → 1.2.0-rc.1
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 +139 -1103
- package/cjs/classes/api-controller.class.js +320 -29
- package/cjs/classes/api-service.class.js +219 -64
- package/cjs/classes/handle-custome-db.js +37 -0
- package/cjs/classes/index.js +1 -2
- package/cjs/classes/winston.logger.class.js +103 -70
- package/cjs/constants/index.js +1 -4
- package/cjs/constants/message-keys.js +68 -0
- package/cjs/constants/permissions.js +114 -11
- package/cjs/decorators/api-response.decorator.js +1 -2
- package/cjs/decorators/index.js +1 -1
- package/cjs/decorators/log-action.decorator.js +149 -0
- package/cjs/decorators/require-permission.decorator.js +5 -5
- package/cjs/dtos/get-by-ids.dto.js +65 -0
- package/cjs/dtos/identity-response.dto.js +4 -8
- package/cjs/dtos/index.js +1 -0
- package/cjs/dtos/response-payload.dto.js +72 -0
- package/cjs/entities/identity.js +8 -2
- package/cjs/entities/index.js +1 -0
- package/cjs/entities/raw-type.js +4 -0
- package/cjs/entities/user-root.js +2 -1
- package/cjs/enums/index.js +20 -0
- package/cjs/enums/notification-type.enum.js +17 -0
- package/cjs/enums/participant-status.enum.js +17 -0
- package/cjs/enums/recurrence-type.enum.js +18 -0
- package/cjs/exceptions/base-app.exception.js +151 -0
- package/cjs/exceptions/index.js +1 -0
- package/cjs/exceptions/permission.exception.js +13 -9
- package/cjs/filters/global-exception.filter.js +279 -0
- package/cjs/filters/index.js +18 -0
- package/cjs/guards/jwt-auth.guard.js +4 -1
- package/cjs/guards/permission.guard.js +71 -77
- package/cjs/index.js +2 -0
- package/cjs/interceptors/idempotency.interceptor.js +1 -1
- package/cjs/interceptors/index.js +0 -1
- package/cjs/interfaces/event-manager-adapter.interface.js +11 -0
- package/cjs/interfaces/index.js +2 -1
- package/cjs/interfaces/notification-adapter.interface.js +11 -0
- package/cjs/interfaces/permission.interface.js +1 -1
- package/cjs/middlewares/logger.middleware.js +83 -26
- package/cjs/modules/datasource/index.js +0 -1
- package/cjs/modules/datasource/multi-tenant-datasource.service.js +46 -85
- package/cjs/modules/utils/utils.service.js +4 -20
- package/cjs/utils/date-time.util.js +94 -0
- package/cjs/utils/index.js +1 -1
- package/cjs/utils/query-helpers.util.js +8 -1
- package/cjs/utils/request.util.js +25 -0
- package/classes/api-controller.class.d.ts +14 -6
- package/classes/api-service.class.d.ts +25 -22
- package/classes/handle-custome-db.d.ts +3 -0
- package/classes/index.d.ts +1 -2
- package/classes/winston.logger.class.d.ts +1 -0
- package/constants/index.d.ts +1 -1
- package/constants/message-keys.d.ts +45 -0
- package/constants/permissions.d.ts +127 -0
- package/decorators/api-response.decorator.d.ts +1 -1
- package/decorators/current-user.decorator.d.ts +1 -1
- package/decorators/index.d.ts +1 -1
- package/decorators/log-action.decorator.d.ts +8 -0
- package/decorators/require-permission.decorator.d.ts +2 -2
- package/dtos/get-by-ids.dto.d.ts +4 -0
- package/dtos/index.d.ts +1 -0
- package/dtos/response-payload.dto.d.ts +8 -0
- package/entities/index.d.ts +1 -0
- package/entities/raw-type.d.ts +1 -0
- package/enums/index.d.ts +3 -0
- package/enums/notification-type.enum.d.ts +6 -0
- package/enums/participant-status.enum.d.ts +6 -0
- package/enums/recurrence-type.enum.d.ts +7 -0
- package/exceptions/base-app.exception.d.ts +41 -0
- package/exceptions/index.d.ts +1 -0
- package/exceptions/permission.exception.d.ts +2 -2
- package/fesm/classes/api-controller.class.js +321 -30
- package/fesm/classes/api-service.class.js +222 -67
- package/fesm/classes/handle-custome-db.js +19 -0
- package/fesm/classes/index.js +1 -2
- package/fesm/classes/winston.logger.class.js +100 -68
- package/fesm/constants/index.js +2 -1
- package/fesm/constants/message-keys.js +49 -0
- package/fesm/constants/permissions.js +86 -14
- package/fesm/decorators/api-response.decorator.js +2 -20
- package/fesm/decorators/index.js +1 -1
- package/fesm/decorators/log-action.decorator.js +139 -0
- package/fesm/decorators/require-permission.decorator.js +17 -65
- package/fesm/dtos/get-by-ids.dto.js +55 -0
- package/fesm/dtos/identity-response.dto.js +4 -8
- package/fesm/dtos/index.js +1 -0
- package/fesm/dtos/response-payload.dto.js +72 -0
- package/fesm/entities/identity.js +8 -2
- package/fesm/entities/index.js +1 -0
- package/fesm/entities/raw-type.js +1 -0
- package/fesm/entities/user-root.js +2 -1
- package/fesm/enums/index.js +3 -0
- package/fesm/enums/notification-type.enum.js +7 -0
- package/fesm/enums/participant-status.enum.js +7 -0
- package/fesm/enums/recurrence-type.enum.js +8 -0
- package/fesm/exceptions/base-app.exception.js +115 -0
- package/fesm/exceptions/index.js +1 -0
- package/fesm/exceptions/permission.exception.js +16 -18
- package/fesm/filters/global-exception.filter.js +269 -0
- package/fesm/filters/index.js +1 -0
- package/fesm/guards/jwt-auth.guard.js +5 -2
- package/fesm/guards/permission.guard.js +73 -79
- package/fesm/index.js +2 -0
- package/fesm/interceptors/idempotency.interceptor.js +2 -2
- package/fesm/interceptors/index.js +0 -1
- package/fesm/interfaces/datasource.interface.js +1 -20
- package/fesm/interfaces/event-manager-adapter.interface.js +1 -0
- package/fesm/interfaces/index.js +2 -1
- package/fesm/interfaces/notification-adapter.interface.js +1 -0
- package/fesm/interfaces/permission.interface.js +1 -3
- package/fesm/middlewares/logger.middleware.js +83 -26
- package/fesm/modules/datasource/index.js +0 -1
- package/fesm/modules/datasource/multi-tenant-datasource.service.js +47 -86
- package/fesm/modules/utils/utils.service.js +5 -21
- package/fesm/utils/date-time.util.js +70 -0
- package/fesm/utils/index.js +1 -1
- package/fesm/utils/query-helpers.util.js +8 -1
- package/fesm/utils/request.util.js +22 -0
- package/filters/global-exception.filter.d.ts +9 -0
- package/filters/index.d.ts +1 -0
- package/guards/permission.guard.d.ts +3 -7
- package/index.d.ts +2 -0
- package/interceptors/idempotency.interceptor.d.ts +1 -1
- package/interceptors/index.d.ts +0 -1
- package/interfaces/api.interface.d.ts +2 -0
- package/interfaces/event-manager-adapter.interface.d.ts +43 -0
- package/interfaces/index.d.ts +2 -1
- package/interfaces/notification-adapter.interface.d.ts +21 -0
- package/interfaces/permission.interface.d.ts +13 -8
- package/modules/datasource/index.d.ts +0 -1
- package/modules/datasource/multi-tenant-datasource.service.d.ts +5 -15
- package/modules/utils/utils.service.d.ts +0 -1
- package/package.json +21 -14
- package/utils/date-time.util.d.ts +8 -0
- package/utils/index.d.ts +1 -1
- package/utils/request.util.d.ts +2 -0
- package/cjs/classes/request-scoped-api.service.js +0 -61
- package/cjs/classes/winston-logger-adapter.class.js +0 -104
- package/cjs/decorators/sanitize-html.decorator.js +0 -36
- package/cjs/interceptors/query-performance.interceptor.js +0 -66
- package/cjs/interfaces/logger.interface.js +0 -7
- package/cjs/modules/datasource/datasource.module.js +0 -117
- package/cjs/utils/error-handler.util.js +0 -90
- package/classes/request-scoped-api.service.d.ts +0 -14
- package/classes/winston-logger-adapter.class.d.ts +0 -22
- package/decorators/sanitize-html.decorator.d.ts +0 -2
- package/fesm/classes/request-scoped-api.service.js +0 -51
- package/fesm/classes/winston-logger-adapter.class.js +0 -107
- package/fesm/decorators/sanitize-html.decorator.js +0 -45
- package/fesm/interceptors/query-performance.interceptor.js +0 -56
- package/fesm/interfaces/logger.interface.js +0 -4
- package/fesm/modules/datasource/datasource.module.js +0 -107
- package/fesm/utils/error-handler.util.js +0 -82
- package/interceptors/query-performance.interceptor.d.ts +0 -8
- package/interfaces/logger.interface.d.ts +0 -7
- package/modules/datasource/datasource.module.d.ts +0 -19
- package/utils/error-handler.util.d.ts +0 -19
|
@@ -15,18 +15,18 @@ _export(exports, {
|
|
|
15
15
|
get RequirePermission () {
|
|
16
16
|
return RequirePermission;
|
|
17
17
|
},
|
|
18
|
-
get
|
|
19
|
-
return
|
|
18
|
+
get RequirePermissionLogic () {
|
|
19
|
+
return RequirePermissionLogic;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
const _common = require("@nestjs/common");
|
|
23
23
|
const _constants = require("../constants");
|
|
24
24
|
const RequirePermission = (...permissions)=>(0, _common.SetMetadata)(_constants.PERMISSIONS_KEY, {
|
|
25
25
|
permissions,
|
|
26
|
-
operator: '
|
|
26
|
+
operator: 'AND'
|
|
27
27
|
});
|
|
28
28
|
const RequireAnyPermission = (...permissions)=>(0, _common.SetMetadata)(_constants.PERMISSIONS_KEY, {
|
|
29
29
|
permissions,
|
|
30
|
-
operator: '
|
|
30
|
+
operator: 'OR'
|
|
31
31
|
});
|
|
32
|
-
const
|
|
32
|
+
const RequirePermissionLogic = (logic)=>(0, _common.SetMetadata)(_constants.PERMISSIONS_KEY, logic);
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "GetByIdsDto", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return GetByIdsDto;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _swagger = require("@nestjs/swagger");
|
|
12
|
+
const _classvalidator = require("class-validator");
|
|
13
|
+
function _define_property(obj, key, value) {
|
|
14
|
+
if (key in obj) {
|
|
15
|
+
Object.defineProperty(obj, key, {
|
|
16
|
+
value: value,
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
writable: true
|
|
20
|
+
});
|
|
21
|
+
} else {
|
|
22
|
+
obj[key] = value;
|
|
23
|
+
}
|
|
24
|
+
return obj;
|
|
25
|
+
}
|
|
26
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
27
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
28
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
29
|
+
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;
|
|
30
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
31
|
+
}
|
|
32
|
+
function _ts_metadata(k, v) {
|
|
33
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
34
|
+
}
|
|
35
|
+
let GetByIdsDto = class GetByIdsDto {
|
|
36
|
+
constructor(){
|
|
37
|
+
_define_property(this, "ids", void 0);
|
|
38
|
+
_define_property(this, "select", void 0);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
_ts_decorate([
|
|
42
|
+
(0, _swagger.ApiProperty)({
|
|
43
|
+
description: 'Array of IDs to retrieve',
|
|
44
|
+
type: [
|
|
45
|
+
String
|
|
46
|
+
],
|
|
47
|
+
example: [
|
|
48
|
+
'uuid-1',
|
|
49
|
+
'uuid-2'
|
|
50
|
+
]
|
|
51
|
+
}),
|
|
52
|
+
(0, _classvalidator.IsNotEmpty)(),
|
|
53
|
+
(0, _classvalidator.IsArray)(),
|
|
54
|
+
(0, _classvalidator.IsUUID)('all', {
|
|
55
|
+
each: true
|
|
56
|
+
}),
|
|
57
|
+
_ts_metadata("design:type", Array)
|
|
58
|
+
], GetByIdsDto.prototype, "ids", void 0);
|
|
59
|
+
_ts_decorate([
|
|
60
|
+
(0, _swagger.ApiPropertyOptional)({
|
|
61
|
+
description: 'Select specific fields to return (comma-separated or array)'
|
|
62
|
+
}),
|
|
63
|
+
(0, _classvalidator.IsOptional)(),
|
|
64
|
+
_ts_metadata("design:type", Object)
|
|
65
|
+
], GetByIdsDto.prototype, "select", void 0);
|
|
@@ -8,8 +8,8 @@ Object.defineProperty(exports, "IdentityResponseDto", {
|
|
|
8
8
|
return IdentityResponseDto;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _classtransformer = require("class-transformer");
|
|
12
11
|
const _swagger = require("@nestjs/swagger");
|
|
12
|
+
const _classtransformer = require("class-transformer");
|
|
13
13
|
function _define_property(obj, key, value) {
|
|
14
14
|
if (key in obj) {
|
|
15
15
|
Object.defineProperty(obj, key, {
|
|
@@ -44,28 +44,28 @@ let IdentityResponseDto = class IdentityResponseDto {
|
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
46
|
_ts_decorate([
|
|
47
|
+
(0, _classtransformer.Expose)(),
|
|
47
48
|
(0, _swagger.ApiProperty)({
|
|
48
49
|
type: String,
|
|
49
50
|
format: 'uuid'
|
|
50
51
|
}),
|
|
51
|
-
(0, _classtransformer.Expose)(),
|
|
52
52
|
_ts_metadata("design:type", String)
|
|
53
53
|
], IdentityResponseDto.prototype, "id", void 0);
|
|
54
54
|
_ts_decorate([
|
|
55
|
+
(0, _classtransformer.Expose)(),
|
|
55
56
|
(0, _swagger.ApiProperty)({
|
|
56
57
|
type: String,
|
|
57
58
|
format: 'date-time'
|
|
58
59
|
}),
|
|
59
|
-
(0, _classtransformer.Expose)(),
|
|
60
60
|
(0, _classtransformer.Type)(()=>Date),
|
|
61
61
|
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
62
62
|
], IdentityResponseDto.prototype, "createdAt", void 0);
|
|
63
63
|
_ts_decorate([
|
|
64
|
+
(0, _classtransformer.Expose)(),
|
|
64
65
|
(0, _swagger.ApiProperty)({
|
|
65
66
|
type: String,
|
|
66
67
|
format: 'date-time'
|
|
67
68
|
}),
|
|
68
|
-
(0, _classtransformer.Expose)(),
|
|
69
69
|
(0, _classtransformer.Type)(()=>Date),
|
|
70
70
|
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
71
71
|
], IdentityResponseDto.prototype, "updatedAt", void 0);
|
|
@@ -76,7 +76,6 @@ _ts_decorate([
|
|
|
76
76
|
nullable: true,
|
|
77
77
|
required: false
|
|
78
78
|
}),
|
|
79
|
-
(0, _classtransformer.Expose)(),
|
|
80
79
|
(0, _classtransformer.Type)(()=>Date),
|
|
81
80
|
_ts_metadata("design:type", Object)
|
|
82
81
|
], IdentityResponseDto.prototype, "deletedAt", void 0);
|
|
@@ -87,7 +86,6 @@ _ts_decorate([
|
|
|
87
86
|
nullable: true,
|
|
88
87
|
required: false
|
|
89
88
|
}),
|
|
90
|
-
(0, _classtransformer.Expose)(),
|
|
91
89
|
_ts_metadata("design:type", Object)
|
|
92
90
|
], IdentityResponseDto.prototype, "createdById", void 0);
|
|
93
91
|
_ts_decorate([
|
|
@@ -97,7 +95,6 @@ _ts_decorate([
|
|
|
97
95
|
nullable: true,
|
|
98
96
|
required: false
|
|
99
97
|
}),
|
|
100
|
-
(0, _classtransformer.Expose)(),
|
|
101
98
|
_ts_metadata("design:type", Object)
|
|
102
99
|
], IdentityResponseDto.prototype, "updatedById", void 0);
|
|
103
100
|
_ts_decorate([
|
|
@@ -107,6 +104,5 @@ _ts_decorate([
|
|
|
107
104
|
nullable: true,
|
|
108
105
|
required: false
|
|
109
106
|
}),
|
|
110
|
-
(0, _classtransformer.Expose)(),
|
|
111
107
|
_ts_metadata("design:type", Object)
|
|
112
108
|
], IdentityResponseDto.prototype, "deletedById", void 0);
|
package/cjs/dtos/index.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
_export_star(require("./delete.dto"), exports);
|
|
6
6
|
_export_star(require("./filter-and-pagination.dto"), exports);
|
|
7
|
+
_export_star(require("./get-by-ids.dto"), exports);
|
|
7
8
|
_export_star(require("./identity-response.dto"), exports);
|
|
8
9
|
_export_star(require("./pagination.dto"), exports);
|
|
9
10
|
_export_star(require("./response-payload.dto"), exports);
|
|
@@ -83,6 +83,8 @@ let SingleResponseDto = class SingleResponseDto {
|
|
|
83
83
|
constructor(){
|
|
84
84
|
_define_property(this, "success", void 0);
|
|
85
85
|
_define_property(this, "message", void 0);
|
|
86
|
+
_define_property(this, "messageKey", void 0);
|
|
87
|
+
_define_property(this, "messageVariables", void 0);
|
|
86
88
|
_define_property(this, "data", void 0);
|
|
87
89
|
_define_property(this, "_meta", void 0);
|
|
88
90
|
}
|
|
@@ -99,6 +101,22 @@ _ts_decorate([
|
|
|
99
101
|
}),
|
|
100
102
|
_ts_metadata("design:type", String)
|
|
101
103
|
], SingleResponseDto.prototype, "message", void 0);
|
|
104
|
+
_ts_decorate([
|
|
105
|
+
(0, _swagger.ApiPropertyOptional)({
|
|
106
|
+
example: 'user.create.success',
|
|
107
|
+
description: 'Translation key for localization'
|
|
108
|
+
}),
|
|
109
|
+
_ts_metadata("design:type", String)
|
|
110
|
+
], SingleResponseDto.prototype, "messageKey", void 0);
|
|
111
|
+
_ts_decorate([
|
|
112
|
+
(0, _swagger.ApiPropertyOptional)({
|
|
113
|
+
example: {
|
|
114
|
+
name: 'John'
|
|
115
|
+
},
|
|
116
|
+
description: 'Variables for message interpolation'
|
|
117
|
+
}),
|
|
118
|
+
_ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
|
|
119
|
+
], SingleResponseDto.prototype, "messageVariables", void 0);
|
|
102
120
|
_ts_decorate([
|
|
103
121
|
(0, _swagger.ApiPropertyOptional)(),
|
|
104
122
|
_ts_metadata("design:type", typeof T === "undefined" ? Object : T)
|
|
@@ -162,6 +180,8 @@ let ListResponseDto = class ListResponseDto {
|
|
|
162
180
|
constructor(){
|
|
163
181
|
_define_property(this, "success", void 0);
|
|
164
182
|
_define_property(this, "message", void 0);
|
|
183
|
+
_define_property(this, "messageKey", void 0);
|
|
184
|
+
_define_property(this, "messageVariables", void 0);
|
|
165
185
|
_define_property(this, "data", void 0);
|
|
166
186
|
_define_property(this, "meta", void 0);
|
|
167
187
|
_define_property(this, "_meta", void 0);
|
|
@@ -179,6 +199,22 @@ _ts_decorate([
|
|
|
179
199
|
}),
|
|
180
200
|
_ts_metadata("design:type", String)
|
|
181
201
|
], ListResponseDto.prototype, "message", void 0);
|
|
202
|
+
_ts_decorate([
|
|
203
|
+
(0, _swagger.ApiPropertyOptional)({
|
|
204
|
+
example: 'user.list.success',
|
|
205
|
+
description: 'Translation key for localization'
|
|
206
|
+
}),
|
|
207
|
+
_ts_metadata("design:type", String)
|
|
208
|
+
], ListResponseDto.prototype, "messageKey", void 0);
|
|
209
|
+
_ts_decorate([
|
|
210
|
+
(0, _swagger.ApiPropertyOptional)({
|
|
211
|
+
example: {
|
|
212
|
+
count: 10
|
|
213
|
+
},
|
|
214
|
+
description: 'Variables for message interpolation'
|
|
215
|
+
}),
|
|
216
|
+
_ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
|
|
217
|
+
], ListResponseDto.prototype, "messageVariables", void 0);
|
|
182
218
|
_ts_decorate([
|
|
183
219
|
(0, _swagger.ApiPropertyOptional)({
|
|
184
220
|
isArray: true
|
|
@@ -229,6 +265,8 @@ let BulkResponseDto = class BulkResponseDto {
|
|
|
229
265
|
constructor(){
|
|
230
266
|
_define_property(this, "success", void 0);
|
|
231
267
|
_define_property(this, "message", void 0);
|
|
268
|
+
_define_property(this, "messageKey", void 0);
|
|
269
|
+
_define_property(this, "messageVariables", void 0);
|
|
232
270
|
_define_property(this, "data", void 0);
|
|
233
271
|
_define_property(this, "meta", void 0);
|
|
234
272
|
_define_property(this, "_meta", void 0);
|
|
@@ -246,6 +284,22 @@ _ts_decorate([
|
|
|
246
284
|
}),
|
|
247
285
|
_ts_metadata("design:type", String)
|
|
248
286
|
], BulkResponseDto.prototype, "message", void 0);
|
|
287
|
+
_ts_decorate([
|
|
288
|
+
(0, _swagger.ApiPropertyOptional)({
|
|
289
|
+
example: 'user.bulk.success',
|
|
290
|
+
description: 'Translation key for localization'
|
|
291
|
+
}),
|
|
292
|
+
_ts_metadata("design:type", String)
|
|
293
|
+
], BulkResponseDto.prototype, "messageKey", void 0);
|
|
294
|
+
_ts_decorate([
|
|
295
|
+
(0, _swagger.ApiPropertyOptional)({
|
|
296
|
+
example: {
|
|
297
|
+
count: 5
|
|
298
|
+
},
|
|
299
|
+
description: 'Variables for message interpolation'
|
|
300
|
+
}),
|
|
301
|
+
_ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
|
|
302
|
+
], BulkResponseDto.prototype, "messageVariables", void 0);
|
|
249
303
|
_ts_decorate([
|
|
250
304
|
(0, _swagger.ApiPropertyOptional)({
|
|
251
305
|
isArray: true
|
|
@@ -271,6 +325,8 @@ let MessageResponseDto = class MessageResponseDto {
|
|
|
271
325
|
constructor(){
|
|
272
326
|
_define_property(this, "success", void 0);
|
|
273
327
|
_define_property(this, "message", void 0);
|
|
328
|
+
_define_property(this, "messageKey", void 0);
|
|
329
|
+
_define_property(this, "messageVariables", void 0);
|
|
274
330
|
_define_property(this, "_meta", void 0);
|
|
275
331
|
}
|
|
276
332
|
};
|
|
@@ -286,6 +342,22 @@ _ts_decorate([
|
|
|
286
342
|
}),
|
|
287
343
|
_ts_metadata("design:type", String)
|
|
288
344
|
], MessageResponseDto.prototype, "message", void 0);
|
|
345
|
+
_ts_decorate([
|
|
346
|
+
(0, _swagger.ApiPropertyOptional)({
|
|
347
|
+
example: 'user.delete.success',
|
|
348
|
+
description: 'Translation key for localization'
|
|
349
|
+
}),
|
|
350
|
+
_ts_metadata("design:type", String)
|
|
351
|
+
], MessageResponseDto.prototype, "messageKey", void 0);
|
|
352
|
+
_ts_decorate([
|
|
353
|
+
(0, _swagger.ApiPropertyOptional)({
|
|
354
|
+
example: {
|
|
355
|
+
count: 3
|
|
356
|
+
},
|
|
357
|
+
description: 'Variables for message interpolation'
|
|
358
|
+
}),
|
|
359
|
+
_ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
|
|
360
|
+
], MessageResponseDto.prototype, "messageVariables", void 0);
|
|
289
361
|
_ts_decorate([
|
|
290
362
|
(0, _swagger.ApiPropertyOptional)({
|
|
291
363
|
type: RequestMetaDto
|
package/cjs/entities/identity.js
CHANGED
|
@@ -49,14 +49,16 @@ _ts_decorate([
|
|
|
49
49
|
_ts_decorate([
|
|
50
50
|
(0, _typeorm.CreateDateColumn)({
|
|
51
51
|
name: 'created_at',
|
|
52
|
-
type: 'timestamp'
|
|
52
|
+
type: 'timestamp',
|
|
53
|
+
select: false
|
|
53
54
|
}),
|
|
54
55
|
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
55
56
|
], Identity.prototype, "createdAt", void 0);
|
|
56
57
|
_ts_decorate([
|
|
57
58
|
(0, _typeorm.UpdateDateColumn)({
|
|
58
59
|
name: 'updated_at',
|
|
59
|
-
type: 'timestamp'
|
|
60
|
+
type: 'timestamp',
|
|
61
|
+
select: false
|
|
60
62
|
}),
|
|
61
63
|
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
62
64
|
], Identity.prototype, "updatedAt", void 0);
|
|
@@ -64,6 +66,7 @@ _ts_decorate([
|
|
|
64
66
|
(0, _typeorm.DeleteDateColumn)({
|
|
65
67
|
name: 'deleted_at',
|
|
66
68
|
type: 'timestamp',
|
|
69
|
+
select: false,
|
|
67
70
|
nullable: true
|
|
68
71
|
}),
|
|
69
72
|
_ts_metadata("design:type", Object)
|
|
@@ -72,6 +75,7 @@ _ts_decorate([
|
|
|
72
75
|
(0, _typeorm.Column)({
|
|
73
76
|
name: 'created_by_id',
|
|
74
77
|
type: 'uuid',
|
|
78
|
+
select: false,
|
|
75
79
|
nullable: true
|
|
76
80
|
}),
|
|
77
81
|
_ts_metadata("design:type", Object)
|
|
@@ -80,6 +84,7 @@ _ts_decorate([
|
|
|
80
84
|
(0, _typeorm.Column)({
|
|
81
85
|
name: 'updated_by_id',
|
|
82
86
|
type: 'uuid',
|
|
87
|
+
select: false,
|
|
83
88
|
nullable: true
|
|
84
89
|
}),
|
|
85
90
|
_ts_metadata("design:type", Object)
|
|
@@ -88,6 +93,7 @@ _ts_decorate([
|
|
|
88
93
|
(0, _typeorm.Column)({
|
|
89
94
|
name: 'deleted_by_id',
|
|
90
95
|
type: 'uuid',
|
|
96
|
+
select: false,
|
|
91
97
|
nullable: true
|
|
92
98
|
}),
|
|
93
99
|
_ts_metadata("design:type", Object)
|
package/cjs/entities/index.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
_export_star(require("./identity"), exports);
|
|
6
|
+
_export_star(require("./raw-type"), exports);
|
|
6
7
|
_export_star(require("./user-root"), exports);
|
|
7
8
|
function _export_star(from, to) {
|
|
8
9
|
Object.keys(from).forEach(function(k) {
|
|
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "UserRoot", {
|
|
|
8
8
|
return UserRoot;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
+
const _nestjsshared = require("@flusys/nestjs-shared");
|
|
11
12
|
const _typeorm = require("typeorm");
|
|
12
13
|
function _define_property(obj, key, value) {
|
|
13
14
|
if (key in obj) {
|
|
@@ -134,7 +135,7 @@ _ts_decorate([
|
|
|
134
135
|
], UserRoot.prototype, "lastLoginAt", void 0);
|
|
135
136
|
_ts_decorate([
|
|
136
137
|
(0, _typeorm.Column)({
|
|
137
|
-
type:
|
|
138
|
+
type: (0, _nestjsshared.getJsonColumnType)(),
|
|
138
139
|
nullable: true,
|
|
139
140
|
name: 'additional_fields'
|
|
140
141
|
}),
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
_export_star(require("./notification-type.enum"), exports);
|
|
6
|
+
_export_star(require("./participant-status.enum"), exports);
|
|
7
|
+
_export_star(require("./recurrence-type.enum"), exports);
|
|
8
|
+
function _export_star(from, to) {
|
|
9
|
+
Object.keys(from).forEach(function(k) {
|
|
10
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
11
|
+
Object.defineProperty(to, k, {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function() {
|
|
14
|
+
return from[k];
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
return from;
|
|
20
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "NotificationType", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return NotificationType;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var NotificationType = /*#__PURE__*/ function(NotificationType) {
|
|
12
|
+
NotificationType["INFO"] = "info";
|
|
13
|
+
NotificationType["WARNING"] = "warning";
|
|
14
|
+
NotificationType["SUCCESS"] = "success";
|
|
15
|
+
NotificationType["ERROR"] = "error";
|
|
16
|
+
return NotificationType;
|
|
17
|
+
}({});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "ParticipantStatus", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return ParticipantStatus;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var ParticipantStatus = /*#__PURE__*/ function(ParticipantStatus) {
|
|
12
|
+
ParticipantStatus["PENDING"] = "pending";
|
|
13
|
+
ParticipantStatus["ACCEPTED"] = "accepted";
|
|
14
|
+
ParticipantStatus["DECLINED"] = "declined";
|
|
15
|
+
ParticipantStatus["TENTATIVE"] = "tentative";
|
|
16
|
+
return ParticipantStatus;
|
|
17
|
+
}({});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "RecurrenceType", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return RecurrenceType;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var RecurrenceType = /*#__PURE__*/ function(RecurrenceType) {
|
|
12
|
+
RecurrenceType["NONE"] = "none";
|
|
13
|
+
RecurrenceType["DAILY"] = "daily";
|
|
14
|
+
RecurrenceType["WEEKLY"] = "weekly";
|
|
15
|
+
RecurrenceType["BIWEEKLY"] = "biweekly";
|
|
16
|
+
RecurrenceType["MONTHLY"] = "monthly";
|
|
17
|
+
return RecurrenceType;
|
|
18
|
+
}({});
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get BaseAppException () {
|
|
13
|
+
return BaseAppException;
|
|
14
|
+
},
|
|
15
|
+
get ConflictException () {
|
|
16
|
+
return ConflictException;
|
|
17
|
+
},
|
|
18
|
+
get ForbiddenException () {
|
|
19
|
+
return ForbiddenException;
|
|
20
|
+
},
|
|
21
|
+
get InternalServerException () {
|
|
22
|
+
return InternalServerException;
|
|
23
|
+
},
|
|
24
|
+
get NotFoundException () {
|
|
25
|
+
return NotFoundException;
|
|
26
|
+
},
|
|
27
|
+
get ServiceUnavailableException () {
|
|
28
|
+
return ServiceUnavailableException;
|
|
29
|
+
},
|
|
30
|
+
get UnauthorizedException () {
|
|
31
|
+
return UnauthorizedException;
|
|
32
|
+
},
|
|
33
|
+
get ValidationException () {
|
|
34
|
+
return ValidationException;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
const _common = require("@nestjs/common");
|
|
38
|
+
const _messagekeys = require("../constants/message-keys");
|
|
39
|
+
function _define_property(obj, key, value) {
|
|
40
|
+
if (key in obj) {
|
|
41
|
+
Object.defineProperty(obj, key, {
|
|
42
|
+
value: value,
|
|
43
|
+
enumerable: true,
|
|
44
|
+
configurable: true,
|
|
45
|
+
writable: true
|
|
46
|
+
});
|
|
47
|
+
} else {
|
|
48
|
+
obj[key] = value;
|
|
49
|
+
}
|
|
50
|
+
return obj;
|
|
51
|
+
}
|
|
52
|
+
let BaseAppException = class BaseAppException extends _common.HttpException {
|
|
53
|
+
constructor(options){
|
|
54
|
+
const status = options.status || _common.HttpStatus.BAD_REQUEST;
|
|
55
|
+
super({
|
|
56
|
+
success: false,
|
|
57
|
+
message: options.message,
|
|
58
|
+
messageKey: options.messageKey || _messagekeys.ERROR_MESSAGES.GENERIC,
|
|
59
|
+
messageVariables: options.messageVariables,
|
|
60
|
+
errors: options.errors
|
|
61
|
+
}, status), _define_property(this, "messageKey", void 0), _define_property(this, "messageVariables", void 0), _define_property(this, "errors", void 0), _define_property(this, "metadata", void 0);
|
|
62
|
+
this.messageKey = options.messageKey || _messagekeys.ERROR_MESSAGES.GENERIC;
|
|
63
|
+
this.messageVariables = options.messageVariables;
|
|
64
|
+
this.errors = options.errors;
|
|
65
|
+
this.metadata = options.metadata;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
let NotFoundException = class NotFoundException extends BaseAppException {
|
|
69
|
+
constructor(entity, id){
|
|
70
|
+
super({
|
|
71
|
+
message: id ? `${entity} with id "${id}" not found` : `${entity} not found`,
|
|
72
|
+
messageKey: _messagekeys.ERROR_MESSAGES.NOT_FOUND,
|
|
73
|
+
status: _common.HttpStatus.NOT_FOUND,
|
|
74
|
+
metadata: {
|
|
75
|
+
entity,
|
|
76
|
+
id
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
let ValidationException = class ValidationException extends BaseAppException {
|
|
82
|
+
constructor(errors){
|
|
83
|
+
super({
|
|
84
|
+
message: 'Validation failed',
|
|
85
|
+
messageKey: _messagekeys.ERROR_MESSAGES.VALIDATION,
|
|
86
|
+
status: _common.HttpStatus.BAD_REQUEST,
|
|
87
|
+
errors
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
let UnauthorizedException = class UnauthorizedException extends BaseAppException {
|
|
92
|
+
constructor(message = 'Unauthorized access'){
|
|
93
|
+
super({
|
|
94
|
+
message,
|
|
95
|
+
messageKey: _messagekeys.ERROR_MESSAGES.UNAUTHORIZED,
|
|
96
|
+
status: _common.HttpStatus.UNAUTHORIZED
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
let ForbiddenException = class ForbiddenException extends BaseAppException {
|
|
101
|
+
constructor(message = 'Access forbidden'){
|
|
102
|
+
super({
|
|
103
|
+
message,
|
|
104
|
+
messageKey: _messagekeys.ERROR_MESSAGES.FORBIDDEN,
|
|
105
|
+
status: _common.HttpStatus.FORBIDDEN
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
let ConflictException = class ConflictException extends BaseAppException {
|
|
110
|
+
constructor(entity, field){
|
|
111
|
+
super({
|
|
112
|
+
message: field ? `${entity} with this ${field} already exists` : `${entity} already exists`,
|
|
113
|
+
messageKey: _messagekeys.ERROR_MESSAGES.CONFLICT,
|
|
114
|
+
messageVariables: {
|
|
115
|
+
entity,
|
|
116
|
+
...field !== undefined && {
|
|
117
|
+
field
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
status: _common.HttpStatus.CONFLICT,
|
|
121
|
+
metadata: {
|
|
122
|
+
entity,
|
|
123
|
+
field
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
let InternalServerException = class InternalServerException extends BaseAppException {
|
|
129
|
+
constructor(message = 'Internal server error'){
|
|
130
|
+
super({
|
|
131
|
+
message,
|
|
132
|
+
messageKey: _messagekeys.ERROR_MESSAGES.INTERNAL,
|
|
133
|
+
status: _common.HttpStatus.INTERNAL_SERVER_ERROR
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
let ServiceUnavailableException = class ServiceUnavailableException extends BaseAppException {
|
|
138
|
+
constructor(service){
|
|
139
|
+
super({
|
|
140
|
+
message: `${service} is temporarily unavailable`,
|
|
141
|
+
messageKey: _messagekeys.ERROR_MESSAGES.SERVICE_UNAVAILABLE,
|
|
142
|
+
messageVariables: {
|
|
143
|
+
service
|
|
144
|
+
},
|
|
145
|
+
status: _common.HttpStatus.SERVICE_UNAVAILABLE,
|
|
146
|
+
metadata: {
|
|
147
|
+
service
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
};
|
package/cjs/exceptions/index.js
CHANGED
|
@@ -20,22 +20,26 @@ _export(exports, {
|
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
const _common = require("@nestjs/common");
|
|
23
|
+
const _messagekeys = require("../constants/message-keys");
|
|
23
24
|
let PermissionSystemUnavailableException = class PermissionSystemUnavailableException extends _common.InternalServerErrorException {
|
|
24
|
-
constructor(
|
|
25
|
+
constructor(){
|
|
25
26
|
super({
|
|
26
27
|
success: false,
|
|
27
|
-
message,
|
|
28
|
-
|
|
28
|
+
message: 'Permission system temporarily unavailable',
|
|
29
|
+
messageKey: _messagekeys.ERROR_MESSAGES.PERMISSION_SYSTEM_UNAVAILABLE
|
|
29
30
|
});
|
|
30
31
|
}
|
|
31
32
|
};
|
|
32
33
|
let InsufficientPermissionsException = class InsufficientPermissionsException extends _common.ForbiddenException {
|
|
33
|
-
constructor(missingPermissions, operator = '
|
|
34
|
-
const
|
|
34
|
+
constructor(missingPermissions, operator = 'AND'){
|
|
35
|
+
const messageKey = operator === 'OR' ? _messagekeys.ERROR_MESSAGES.INSUFFICIENT_PERMISSIONS_OR : _messagekeys.ERROR_MESSAGES.INSUFFICIENT_PERMISSIONS;
|
|
35
36
|
super({
|
|
36
37
|
success: false,
|
|
37
|
-
message,
|
|
38
|
-
|
|
38
|
+
message: 'Insufficient permissions',
|
|
39
|
+
messageKey,
|
|
40
|
+
messageVariables: {
|
|
41
|
+
permissions: missingPermissions.join(', ')
|
|
42
|
+
},
|
|
39
43
|
missingPermissions,
|
|
40
44
|
operator
|
|
41
45
|
});
|
|
@@ -45,8 +49,8 @@ let NoPermissionsFoundException = class NoPermissionsFoundException extends _com
|
|
|
45
49
|
constructor(){
|
|
46
50
|
super({
|
|
47
51
|
success: false,
|
|
48
|
-
message: 'No permissions found
|
|
49
|
-
|
|
52
|
+
message: 'No permissions found',
|
|
53
|
+
messageKey: _messagekeys.ERROR_MESSAGES.NO_PERMISSIONS_FOUND
|
|
50
54
|
});
|
|
51
55
|
}
|
|
52
56
|
};
|