@venturialstd/user 0.0.3 β†’ 0.0.5

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.
Files changed (39) hide show
  1. package/README.md +43 -2
  2. package/dist/constants/notification.constant.d.ts +28 -0
  3. package/dist/constants/notification.constant.d.ts.map +1 -0
  4. package/dist/constants/notification.constant.js +35 -0
  5. package/dist/constants/notification.constant.js.map +1 -0
  6. package/dist/dtos/create-notification.dto.d.ts +14 -0
  7. package/dist/dtos/create-notification.dto.d.ts.map +1 -0
  8. package/dist/dtos/create-notification.dto.js +3 -0
  9. package/dist/dtos/create-notification.dto.js.map +1 -0
  10. package/dist/entities/permission.entity.d.ts.map +1 -1
  11. package/dist/entities/permission.entity.js +0 -1
  12. package/dist/entities/permission.entity.js.map +1 -1
  13. package/dist/entities/role-permission.entity.d.ts.map +1 -1
  14. package/dist/entities/role-permission.entity.js +0 -2
  15. package/dist/entities/role-permission.entity.js.map +1 -1
  16. package/dist/entities/user-notification-preferences.entity.d.ts +13 -0
  17. package/dist/entities/user-notification-preferences.entity.d.ts.map +1 -0
  18. package/dist/entities/user-notification-preferences.entity.js +65 -0
  19. package/dist/entities/user-notification-preferences.entity.js.map +1 -0
  20. package/dist/entities/user-notification.entity.d.ts +21 -0
  21. package/dist/entities/user-notification.entity.d.ts.map +1 -0
  22. package/dist/entities/user-notification.entity.js +109 -0
  23. package/dist/entities/user-notification.entity.js.map +1 -0
  24. package/dist/entities/user-role.entity.d.ts.map +1 -1
  25. package/dist/entities/user-role.entity.js +0 -2
  26. package/dist/entities/user-role.entity.js.map +1 -1
  27. package/dist/index.d.ts +5 -0
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +5 -0
  30. package/dist/index.js.map +1 -1
  31. package/dist/services/user-notification.service.d.ts +54 -0
  32. package/dist/services/user-notification.service.d.ts.map +1 -0
  33. package/dist/services/user-notification.service.js +217 -0
  34. package/dist/services/user-notification.service.js.map +1 -0
  35. package/dist/user.module.d.ts +4 -0
  36. package/dist/user.module.d.ts.map +1 -1
  37. package/dist/user.module.js +17 -2
  38. package/dist/user.module.js.map +1 -1
  39. package/package.json +3 -2
package/README.md CHANGED
@@ -11,6 +11,7 @@ User Management Module for Venturial - A NestJS module for managing users with c
11
11
  - [Module Structure](#module-structure)
12
12
  - [Quick Start](#quick-start)
13
13
  - [ACL System](#acl-system)
14
+ - [Notification System](#notification-system)
14
15
  - [Extending User Statuses](#extending-user-statuses)
15
16
  - [Extending the Module](#extending-the-module)
16
17
  - [Performance Considerations](#performance-considerations)
@@ -37,6 +38,7 @@ User Management Module for Venturial - A NestJS module for managing users with c
37
38
  - πŸ“§ **Email Verification**: Email verification system
38
39
  - βš™οΈ **User Settings**: Configurable user preferences
39
40
  - 🎭 **Extensible Statuses**: Define custom user statuses for your application
41
+ - πŸ”” **Notification System**: Business-agnostic user notifications with configurable types, categories, and priorities
40
42
  - πŸ” **ACL System**: Complete database-driven role and permission management
41
43
  - πŸ›‘οΈ **Guards & Decorators**: Request-level access control
42
44
  - πŸ”„ **TypeORM Integration**: Full database support with migrations
@@ -213,9 +215,48 @@ const canDelete = await aclService.userHasPermission(userId, 'users.delete');
213
215
 
214
216
  ---
215
217
 
216
- ## 🎭 Extending User Statuses
218
+ ## πŸ”” Notification System
217
219
 
218
- The module provides a flexible system for defining custom user statuses.
220
+ The module includes a **business-agnostic** user notification system. Notification types, categories, and priorities are **configurable per application** (similar to user statuses). No business logic lives in the core packageβ€”each project defines its own types.
221
+
222
+ See **[NOTIFICATIONS_SYSTEM.md](./NOTIFICATIONS_SYSTEM.md)** for full documentation.
223
+
224
+ ### Configuration
225
+
226
+ ```typescript
227
+ // examples
228
+ UserModule.forRoot({
229
+ allowedNotificationTypes: [
230
+ 'system', 'transaction', 'security', 'compliance', 'marketing', 'account',
231
+ ],
232
+ allowedNotificationCategories: ['info', 'success', 'warning', 'error', 'announcement'],
233
+ allowedNotificationPriorities: ['low', 'medium', 'high', 'urgent'],
234
+ defaultChannels: { inApp: true, email: true, sms: false, push: false },
235
+ })
236
+
237
+ UserModule.forRoot({
238
+ allowedNotificationTypes: [
239
+ 'system', 'task', 'client', 'document', 'deadline', 'team', 'billing',
240
+ ],
241
+ allowedNotificationCategories: ['info', 'success', 'warning', 'error'],
242
+ allowedNotificationPriorities: ['low', 'medium', 'high', 'critical'],
243
+ })
244
+ ```
245
+
246
+ ### Usage (generic, no business logic in core)
247
+
248
+ ```typescript
249
+ await notificationService.createNotification({
250
+ userId: 'user-123',
251
+ type: 'system',
252
+ category: 'success',
253
+ title: 'Action Completed',
254
+ message: 'Your action has been completed successfully.',
255
+ priority: 'medium',
256
+ });
257
+ ```
258
+
259
+ ---
219
260
 
220
261
  ## 🎭 Extending User Statuses
221
262
 
@@ -0,0 +1,28 @@
1
+ export declare enum NotificationType {
2
+ SYSTEM = "system",
3
+ USER = "user",
4
+ ALERT = "alert",
5
+ INFO = "info"
6
+ }
7
+ export declare enum NotificationCategory {
8
+ INFO = "info",
9
+ SUCCESS = "success",
10
+ WARNING = "warning",
11
+ ERROR = "error"
12
+ }
13
+ export declare enum NotificationPriority {
14
+ LOW = "low",
15
+ MEDIUM = "medium",
16
+ HIGH = "high",
17
+ URGENT = "urgent"
18
+ }
19
+ export declare enum NotificationChannel {
20
+ IN_APP = "in_app",
21
+ EMAIL = "email",
22
+ SMS = "sms",
23
+ PUSH = "push"
24
+ }
25
+ export declare const DEFAULT_NOTIFICATION_TYPES: string[];
26
+ export declare const DEFAULT_NOTIFICATION_CATEGORIES: string[];
27
+ export declare const DEFAULT_NOTIFICATION_PRIORITIES: string[];
28
+ //# sourceMappingURL=notification.constant.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification.constant.d.ts","sourceRoot":"","sources":["../../src/constants/notification.constant.ts"],"names":[],"mappings":"AAIA,oBAAY,gBAAgB;IAC1B,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,KAAK,UAAU;IACf,IAAI,SAAS;CACd;AAKD,oBAAY,oBAAoB;IAC9B,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,KAAK,UAAU;CAChB;AAKD,oBAAY,oBAAoB;IAC9B,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,MAAM,WAAW;CAClB;AAKD,oBAAY,mBAAmB;IAC7B,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,GAAG,QAAQ;IACX,IAAI,SAAS;CACd;AAGD,eAAO,MAAM,0BAA0B,EAAE,MAAM,EAAoC,CAAC;AAGpF,eAAO,MAAM,+BAA+B,EAAE,MAAM,EAAwC,CAAC;AAG7F,eAAO,MAAM,+BAA+B,EAAE,MAAM,EAAwC,CAAC"}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_NOTIFICATION_PRIORITIES = exports.DEFAULT_NOTIFICATION_CATEGORIES = exports.DEFAULT_NOTIFICATION_TYPES = exports.NotificationChannel = exports.NotificationPriority = exports.NotificationCategory = exports.NotificationType = void 0;
4
+ var NotificationType;
5
+ (function (NotificationType) {
6
+ NotificationType["SYSTEM"] = "system";
7
+ NotificationType["USER"] = "user";
8
+ NotificationType["ALERT"] = "alert";
9
+ NotificationType["INFO"] = "info";
10
+ })(NotificationType || (exports.NotificationType = NotificationType = {}));
11
+ var NotificationCategory;
12
+ (function (NotificationCategory) {
13
+ NotificationCategory["INFO"] = "info";
14
+ NotificationCategory["SUCCESS"] = "success";
15
+ NotificationCategory["WARNING"] = "warning";
16
+ NotificationCategory["ERROR"] = "error";
17
+ })(NotificationCategory || (exports.NotificationCategory = NotificationCategory = {}));
18
+ var NotificationPriority;
19
+ (function (NotificationPriority) {
20
+ NotificationPriority["LOW"] = "low";
21
+ NotificationPriority["MEDIUM"] = "medium";
22
+ NotificationPriority["HIGH"] = "high";
23
+ NotificationPriority["URGENT"] = "urgent";
24
+ })(NotificationPriority || (exports.NotificationPriority = NotificationPriority = {}));
25
+ var NotificationChannel;
26
+ (function (NotificationChannel) {
27
+ NotificationChannel["IN_APP"] = "in_app";
28
+ NotificationChannel["EMAIL"] = "email";
29
+ NotificationChannel["SMS"] = "sms";
30
+ NotificationChannel["PUSH"] = "push";
31
+ })(NotificationChannel || (exports.NotificationChannel = NotificationChannel = {}));
32
+ exports.DEFAULT_NOTIFICATION_TYPES = Object.values(NotificationType);
33
+ exports.DEFAULT_NOTIFICATION_CATEGORIES = Object.values(NotificationCategory);
34
+ exports.DEFAULT_NOTIFICATION_PRIORITIES = Object.values(NotificationPriority);
35
+ //# sourceMappingURL=notification.constant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification.constant.js","sourceRoot":"","sources":["../../src/constants/notification.constant.ts"],"names":[],"mappings":";;;AAIA,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACjB,iCAAa,CAAA;IACb,mCAAe,CAAA;IACf,iCAAa,CAAA;AACf,CAAC,EALW,gBAAgB,gCAAhB,gBAAgB,QAK3B;AAKD,IAAY,oBAKX;AALD,WAAY,oBAAoB;IAC9B,qCAAa,CAAA;IACb,2CAAmB,CAAA;IACnB,2CAAmB,CAAA;IACnB,uCAAe,CAAA;AACjB,CAAC,EALW,oBAAoB,oCAApB,oBAAoB,QAK/B;AAKD,IAAY,oBAKX;AALD,WAAY,oBAAoB;IAC9B,mCAAW,CAAA;IACX,yCAAiB,CAAA;IACjB,qCAAa,CAAA;IACb,yCAAiB,CAAA;AACnB,CAAC,EALW,oBAAoB,oCAApB,oBAAoB,QAK/B;AAKD,IAAY,mBAKX;AALD,WAAY,mBAAmB;IAC7B,wCAAiB,CAAA;IACjB,sCAAe,CAAA;IACf,kCAAW,CAAA;IACX,oCAAa,CAAA;AACf,CAAC,EALW,mBAAmB,mCAAnB,mBAAmB,QAK9B;AAGY,QAAA,0BAA0B,GAAa,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAGvE,QAAA,+BAA+B,GAAa,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;AAGhF,QAAA,+BAA+B,GAAa,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { NotificationChannel } from '../constants/notification.constant';
2
+ export interface CreateNotificationDto {
3
+ userId: string;
4
+ type: string;
5
+ category: string;
6
+ title: string;
7
+ message: string;
8
+ metadata?: Record<string, unknown>;
9
+ priority?: string;
10
+ expiresAt?: Date;
11
+ groupKey?: string;
12
+ sentVia?: NotificationChannel[];
13
+ }
14
+ //# sourceMappingURL=create-notification.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-notification.dto.d.ts","sourceRoot":"","sources":["../../src/dtos/create-notification.dto.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAM9E,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,OAAO,CAAC,EAAE,mBAAmB,EAAE,CAAC;CACjC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=create-notification.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-notification.dto.js","sourceRoot":"","sources":["../../src/dtos/create-notification.dto.ts"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"permission.entity.d.ts","sourceRoot":"","sources":["../../src/entities/permission.entity.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAO1D,qBAEa,UAAU;IAErB,EAAE,EAAE,MAAM,CAAC;IAMX,QAAQ,EAAE,MAAM,CAAC;IAKjB,MAAM,EAAE,MAAM,CAAC;IAIf,WAAW,EAAE,MAAM,CAAC;IAMpB,IAAI,EAAE,MAAM,CAAC;IAIb,eAAe,EAAE,cAAc,EAAE,CAAC;IAQlC,SAAS,EAAE,IAAI,CAAC;IAQhB,SAAS,EAAE,IAAI,CAAC;CACjB"}
1
+ {"version":3,"file":"permission.entity.d.ts","sourceRoot":"","sources":["../../src/entities/permission.entity.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAO1D,qBAEa,UAAU;IAErB,EAAE,EAAE,MAAM,CAAC;IAKX,QAAQ,EAAE,MAAM,CAAC;IAKjB,MAAM,EAAE,MAAM,CAAC;IAIf,WAAW,EAAE,MAAM,CAAC;IAMpB,IAAI,EAAE,MAAM,CAAC;IAIb,eAAe,EAAE,cAAc,EAAE,CAAC;IAQlC,SAAS,EAAE,IAAI,CAAC;IAQhB,SAAS,EAAE,IAAI,CAAC;CACjB"}
@@ -32,7 +32,6 @@ __decorate([
32
32
  (0, class_validator_1.IsString)(),
33
33
  (0, class_validator_1.IsNotEmpty)(),
34
34
  (0, typeorm_1.Column)({ length: 100 }),
35
- (0, typeorm_1.Index)(),
36
35
  __metadata("design:type", String)
37
36
  ], Permission.prototype, "resource", void 0);
38
37
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"permission.entity.js","sourceRoot":"","sources":["../../src/entities/permission.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAuD;AACvD,qCAQiB;AAEjB,qEAA0D;AASnD,IAAM,UAAU,GAAhB,MAAM,UAAU;IAErB,EAAE,CAAS;IAMX,QAAQ,CAAS;IAKjB,MAAM,CAAS;IAIf,WAAW,CAAS;IA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aAAa;QACnB,OAAO,EAAE,GAAG,EAAE,CAAC,mBAAmB;KACnC,CAAC;8BACS,IAAI;6CAAC;AAQhB;IANC,IAAA,0BAAgB,EAAC;QAChB,IAAI,EAAE,WAAW;QACjB,QAAQ,EAAE,KAAK;QACf,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,GAAG,EAAE,CAAC,mBAAmB;KACnC,CAAC;8BACS,IAAI;6CAAC;qBA1CL,UAAU;IAFtB,IAAA,gBAAM,EAAC,iBAAiB,CAAC;IACzB,IAAA,eAAK,EAAC,CAAC,UAAU,EAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;GACnC,UAAU,CA2CtB"}
@@ -1 +1 @@
1
- {"version":3,"file":"role-permission.entity.d.ts","sourceRoot":"","sources":["../../src/entities/role-permission.entity.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAMrC,qBAEa,cAAc;IAEzB,EAAE,EAAE,MAAM,CAAC;IAIX,MAAM,EAAE,MAAM,CAAC;IAIf,YAAY,EAAE,MAAM,CAAC;IAKrB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAKpC,IAAI,EAAE,IAAI,CAAC;IAMX,UAAU,EAAE,UAAU,CAAC;IAQvB,SAAS,EAAE,IAAI,CAAC;IAQhB,SAAS,EAAE,IAAI,CAAC;CACjB"}
1
+ {"version":3,"file":"role-permission.entity.d.ts","sourceRoot":"","sources":["../../src/entities/role-permission.entity.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAMrC,qBAEa,cAAc;IAEzB,EAAE,EAAE,MAAM,CAAC;IAGX,MAAM,EAAE,MAAM,CAAC;IAGf,YAAY,EAAE,MAAM,CAAC;IAKrB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAKpC,IAAI,EAAE,IAAI,CAAC;IAMX,UAAU,EAAE,UAAU,CAAC;IAQvB,SAAS,EAAE,IAAI,CAAC;IAQhB,SAAS,EAAE,IAAI,CAAC;CACjB"}
@@ -30,12 +30,10 @@ __decorate([
30
30
  ], RolePermission.prototype, "id", void 0);
31
31
  __decorate([
32
32
  (0, typeorm_1.Column)(),
33
- (0, typeorm_1.Index)(),
34
33
  __metadata("design:type", String)
35
34
  ], RolePermission.prototype, "roleId", void 0);
36
35
  __decorate([
37
36
  (0, typeorm_1.Column)(),
38
- (0, typeorm_1.Index)(),
39
37
  __metadata("design:type", String)
40
38
  ], RolePermission.prototype, "permissionId", void 0);
41
39
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"role-permission.entity.js","sourceRoot":"","sources":["../../src/entities/role-permission.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCASiB;AAEjB,2DAAiD;AACjD,+CAAqC;AAQ9B,IAAM,cAAc,GAApB,MAAM,cAAc;IAEzB,EAAE,CAAS;IAIX,MAAM,CAAS;IAIf,YAAY,CAAS;IAKrB,UAAU,CAA0B;IAKpC,IAAI,CAAO;IAMX,UAAU,CAAa;IAQvB,SAAS,CAAO;IAQhB,SAAS,CAAO;CACjB,CAAA;AA3CY,wCAAc;AAEzB;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;0CACpB;AAIX;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,GAAE;;8CACO;AAIf;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,GAAE;;oDACa;AAKrB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDACN;AAKpC;IAFC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,kBAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,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AAM,EAAE,IAAI,EAAE,CAAC;GACvC,cAAc,CAyC1B"}
@@ -0,0 +1,13 @@
1
+ import { NotificationChannel } from '../constants/notification.constant';
2
+ export declare class UserNotificationPreferences {
3
+ id: string;
4
+ userId: string;
5
+ enabledChannels: NotificationChannel[];
6
+ typePreferences: Record<string, unknown>;
7
+ quietHoursStart: string;
8
+ quietHoursEnd: string;
9
+ timezone: string;
10
+ createdAt: Date;
11
+ updatedAt: Date;
12
+ }
13
+ //# sourceMappingURL=user-notification-preferences.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-notification-preferences.entity.d.ts","sourceRoot":"","sources":["../../src/entities/user-notification-preferences.entity.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAEzE,qBACa,2BAA2B;IAEtC,EAAE,EAAE,MAAM,CAAC;IAGX,MAAM,EAAE,MAAM,CAAC;IAGf,eAAe,EAAE,mBAAmB,EAAE,CAAC;IAGvC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAGzC,eAAe,EAAE,MAAM,CAAC;IAGxB,aAAa,EAAE,MAAM,CAAC;IAGtB,QAAQ,EAAE,MAAM,CAAC;IAGjB,SAAS,EAAE,IAAI,CAAC;IAGhB,SAAS,EAAE,IAAI,CAAC;CACjB"}
@@ -0,0 +1,65 @@
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.UserNotificationPreferences = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ let UserNotificationPreferences = class UserNotificationPreferences {
15
+ id;
16
+ userId;
17
+ enabledChannels;
18
+ typePreferences;
19
+ quietHoursStart;
20
+ quietHoursEnd;
21
+ timezone;
22
+ createdAt;
23
+ updatedAt;
24
+ };
25
+ exports.UserNotificationPreferences = UserNotificationPreferences;
26
+ __decorate([
27
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
28
+ __metadata("design:type", String)
29
+ ], UserNotificationPreferences.prototype, "id", void 0);
30
+ __decorate([
31
+ (0, typeorm_1.Column)({ unique: true }),
32
+ __metadata("design:type", String)
33
+ ], UserNotificationPreferences.prototype, "userId", void 0);
34
+ __decorate([
35
+ (0, typeorm_1.Column)({ type: 'varchar', array: true, length: 20, default: () => "'{}'" }),
36
+ __metadata("design:type", Array)
37
+ ], UserNotificationPreferences.prototype, "enabledChannels", void 0);
38
+ __decorate([
39
+ (0, typeorm_1.Column)({ type: 'jsonb', default: {} }),
40
+ __metadata("design:type", Object)
41
+ ], UserNotificationPreferences.prototype, "typePreferences", void 0);
42
+ __decorate([
43
+ (0, typeorm_1.Column)({ type: 'time', nullable: true }),
44
+ __metadata("design:type", String)
45
+ ], UserNotificationPreferences.prototype, "quietHoursStart", void 0);
46
+ __decorate([
47
+ (0, typeorm_1.Column)({ type: 'time', nullable: true }),
48
+ __metadata("design:type", String)
49
+ ], UserNotificationPreferences.prototype, "quietHoursEnd", void 0);
50
+ __decorate([
51
+ (0, typeorm_1.Column)({ type: 'varchar', length: 50, nullable: true }),
52
+ __metadata("design:type", String)
53
+ ], UserNotificationPreferences.prototype, "timezone", void 0);
54
+ __decorate([
55
+ (0, typeorm_1.CreateDateColumn)({ type: 'timestamptz' }),
56
+ __metadata("design:type", Date)
57
+ ], UserNotificationPreferences.prototype, "createdAt", void 0);
58
+ __decorate([
59
+ (0, typeorm_1.UpdateDateColumn)({ type: 'timestamptz' }),
60
+ __metadata("design:type", Date)
61
+ ], UserNotificationPreferences.prototype, "updatedAt", void 0);
62
+ exports.UserNotificationPreferences = UserNotificationPreferences = __decorate([
63
+ (0, typeorm_1.Entity)('user_notification_preferences')
64
+ ], UserNotificationPreferences);
65
+ //# sourceMappingURL=user-notification-preferences.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-notification-preferences.entity.js","sourceRoot":"","sources":["../../src/entities/user-notification-preferences.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAMiB;AAKV,IAAM,2BAA2B,GAAjC,MAAM,2BAA2B;IAEtC,EAAE,CAAS;IAGX,MAAM,CAAS;IAGf,eAAe,CAAwB;IAGvC,eAAe,CAA0B;IAGzC,eAAe,CAAS;IAGxB,aAAa,CAAS;IAGtB,QAAQ,CAAS;IAGjB,SAAS,CAAO;IAGhB,SAAS,CAAO;CACjB,CAAA;AA3BY,kEAA2B;AAEtC;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;uDACpB;AAGX;IADC,IAAA,gBAAM,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;;2DACV;AAGf;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC;;oEACrC;AAGvC;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;oEACE;AAGzC;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;oEACjB;AAGxB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kEACnB;AAGtB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6DACvC;AAGjB;IADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;8BAC/B,IAAI;8DAAC;AAGhB;IADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;8BAC/B,IAAI;8DAAC;sCA1BL,2BAA2B;IADvC,IAAA,gBAAM,EAAC,+BAA+B,CAAC;GAC3B,2BAA2B,CA2BvC"}
@@ -0,0 +1,21 @@
1
+ import { NotificationChannel } from '../constants/notification.constant';
2
+ export declare class UserNotification {
3
+ id: string;
4
+ userId: string;
5
+ type: string;
6
+ category: string;
7
+ title: string;
8
+ message: string;
9
+ metadata: Record<string, unknown>;
10
+ isRead: boolean;
11
+ readAt: Date;
12
+ isArchived: boolean;
13
+ archivedAt: Date;
14
+ priority: string;
15
+ expiresAt: Date;
16
+ groupKey: string;
17
+ sentVia: NotificationChannel[];
18
+ createdAt: Date;
19
+ updatedAt: Date;
20
+ }
21
+ //# sourceMappingURL=user-notification.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-notification.entity.d.ts","sourceRoot":"","sources":["../../src/entities/user-notification.entity.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAEzE,qBAIa,gBAAgB;IAE3B,EAAE,EAAE,MAAM,CAAC;IAGX,MAAM,EAAE,MAAM,CAAC;IAGf,IAAI,EAAE,MAAM,CAAC;IAIb,QAAQ,EAAE,MAAM,CAAC;IAGjB,KAAK,EAAE,MAAM,CAAC;IAGd,OAAO,EAAE,MAAM,CAAC;IAGhB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAGlC,MAAM,EAAE,OAAO,CAAC;IAGhB,MAAM,EAAE,IAAI,CAAC;IAGb,UAAU,EAAE,OAAO,CAAC;IAGpB,UAAU,EAAE,IAAI,CAAC;IAGjB,QAAQ,EAAE,MAAM,CAAC;IAGjB,SAAS,EAAE,IAAI,CAAC;IAGhB,QAAQ,EAAE,MAAM,CAAC;IAGjB,OAAO,EAAE,mBAAmB,EAAE,CAAC;IAG/B,SAAS,EAAE,IAAI,CAAC;IAGhB,SAAS,EAAE,IAAI,CAAC;CACjB"}
@@ -0,0 +1,109 @@
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.UserNotification = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ let UserNotification = class UserNotification {
15
+ id;
16
+ userId;
17
+ type;
18
+ category;
19
+ title;
20
+ message;
21
+ metadata;
22
+ isRead;
23
+ readAt;
24
+ isArchived;
25
+ archivedAt;
26
+ priority;
27
+ expiresAt;
28
+ groupKey;
29
+ sentVia;
30
+ createdAt;
31
+ updatedAt;
32
+ };
33
+ exports.UserNotification = UserNotification;
34
+ __decorate([
35
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
36
+ __metadata("design:type", String)
37
+ ], UserNotification.prototype, "id", void 0);
38
+ __decorate([
39
+ (0, typeorm_1.Column)(),
40
+ __metadata("design:type", String)
41
+ ], UserNotification.prototype, "userId", void 0);
42
+ __decorate([
43
+ (0, typeorm_1.Column)({ type: 'varchar', length: 50 }),
44
+ __metadata("design:type", String)
45
+ ], UserNotification.prototype, "type", void 0);
46
+ __decorate([
47
+ (0, typeorm_1.Column)({ type: 'varchar', length: 50 }),
48
+ (0, typeorm_1.Index)(),
49
+ __metadata("design:type", String)
50
+ ], UserNotification.prototype, "category", void 0);
51
+ __decorate([
52
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255 }),
53
+ __metadata("design:type", String)
54
+ ], UserNotification.prototype, "title", void 0);
55
+ __decorate([
56
+ (0, typeorm_1.Column)({ type: 'text' }),
57
+ __metadata("design:type", String)
58
+ ], UserNotification.prototype, "message", void 0);
59
+ __decorate([
60
+ (0, typeorm_1.Column)({ type: 'jsonb', nullable: true }),
61
+ __metadata("design:type", Object)
62
+ ], UserNotification.prototype, "metadata", void 0);
63
+ __decorate([
64
+ (0, typeorm_1.Column)({ default: false }),
65
+ __metadata("design:type", Boolean)
66
+ ], UserNotification.prototype, "isRead", void 0);
67
+ __decorate([
68
+ (0, typeorm_1.Column)({ type: 'timestamptz', nullable: true }),
69
+ __metadata("design:type", Date)
70
+ ], UserNotification.prototype, "readAt", void 0);
71
+ __decorate([
72
+ (0, typeorm_1.Column)({ default: false }),
73
+ __metadata("design:type", Boolean)
74
+ ], UserNotification.prototype, "isArchived", void 0);
75
+ __decorate([
76
+ (0, typeorm_1.Column)({ type: 'timestamptz', nullable: true }),
77
+ __metadata("design:type", Date)
78
+ ], UserNotification.prototype, "archivedAt", void 0);
79
+ __decorate([
80
+ (0, typeorm_1.Column)({ type: 'varchar', length: 20, default: 'medium' }),
81
+ __metadata("design:type", String)
82
+ ], UserNotification.prototype, "priority", void 0);
83
+ __decorate([
84
+ (0, typeorm_1.Column)({ type: 'timestamptz', nullable: true }),
85
+ __metadata("design:type", Date)
86
+ ], UserNotification.prototype, "expiresAt", void 0);
87
+ __decorate([
88
+ (0, typeorm_1.Column)({ type: 'varchar', length: 100, nullable: true }),
89
+ __metadata("design:type", String)
90
+ ], UserNotification.prototype, "groupKey", void 0);
91
+ __decorate([
92
+ (0, typeorm_1.Column)({ type: 'varchar', array: true, length: 20, default: () => "'{}'" }),
93
+ __metadata("design:type", Array)
94
+ ], UserNotification.prototype, "sentVia", void 0);
95
+ __decorate([
96
+ (0, typeorm_1.CreateDateColumn)({ type: 'timestamptz' }),
97
+ __metadata("design:type", Date)
98
+ ], UserNotification.prototype, "createdAt", void 0);
99
+ __decorate([
100
+ (0, typeorm_1.UpdateDateColumn)({ type: 'timestamptz' }),
101
+ __metadata("design:type", Date)
102
+ ], UserNotification.prototype, "updatedAt", void 0);
103
+ exports.UserNotification = UserNotification = __decorate([
104
+ (0, typeorm_1.Entity)('user_notification'),
105
+ (0, typeorm_1.Index)(['userId', 'isRead']),
106
+ (0, typeorm_1.Index)(['userId', 'createdAt']),
107
+ (0, typeorm_1.Index)(['type'])
108
+ ], UserNotification);
109
+ //# sourceMappingURL=user-notification.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-notification.entity.js","sourceRoot":"","sources":["../../src/entities/user-notification.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAOiB;AAQV,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAE3B,EAAE,CAAS;IAGX,MAAM,CAAS;IAGf,IAAI,CAAS;IAIb,QAAQ,CAAS;IAGjB,KAAK,CAAS;IAGd,OAAO,CAAS;IAGhB,QAAQ,CAA0B;IAGlC,MAAM,CAAU;IAGhB,MAAM,CAAO;IAGb,UAAU,CAAU;IAGpB,UAAU,CAAO;IAGjB,QAAQ,CAAS;IAGjB,SAAS,CAAO;IAGhB,QAAQ,CAAS;IAGjB,OAAO,CAAwB;IAG/B,SAAS,CAAO;IAGhB,SAAS,CAAO;CACjB,CAAA;AApDY,4CAAgB;AAE3B;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;4CACpB;AAGX;IADC,IAAA,gBAAM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AE,CAAC;;kDACxC;AAGjB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC;;iDAC7C;AAG/B;IADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;8BAC/B,IAAI;mDAAC;AAGhB;IADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;8BAC/B,IAAI;mDAAC;2BAnDL,gBAAgB;IAJ5B,IAAA,gBAAM,EAAC,mBAAmB,CAAC;IAC3B,IAAA,eAAK,EAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC3B,IAAA,eAAK,EAAC,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IAC9B,IAAA,eAAK,EAAC,CAAC,MAAM,CAAC,CAAC;GACH,gBAAgB,CAoD5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"user-role.entity.d.ts","sourceRoot":"","sources":["../../src/entities/user-role.entity.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAOrC,qBAEa,QAAQ;IAEnB,EAAE,EAAE,MAAM,CAAC;IAIX,MAAM,EAAE,MAAM,CAAC;IAIf,MAAM,EAAE,MAAM,CAAC;IAIf,SAAS,EAAE,IAAI,CAAC;IAIhB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAK/B,IAAI,EAAE,IAAI,CAAC;IAIX,IAAI,EAAE,IAAI,CAAC;IAQX,SAAS,EAAE,IAAI,CAAC;IAQhB,SAAS,EAAE,IAAI,CAAC;CACjB"}
1
+ {"version":3,"file":"user-role.entity.d.ts","sourceRoot":"","sources":["../../src/entities/user-role.entity.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAOrC,qBAEa,QAAQ;IAEnB,EAAE,EAAE,MAAM,CAAC;IAGX,MAAM,EAAE,MAAM,CAAC;IAGf,MAAM,EAAE,MAAM,CAAC;IAIf,SAAS,EAAE,IAAI,CAAC;IAIhB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAK/B,IAAI,EAAE,IAAI,CAAC;IAIX,IAAI,EAAE,IAAI,CAAC;IAQX,SAAS,EAAE,IAAI,CAAC;IAQhB,SAAS,EAAE,IAAI,CAAC;CACjB"}
@@ -31,12 +31,10 @@ __decorate([
31
31
  ], UserRole.prototype, "id", void 0);
32
32
  __decorate([
33
33
  (0, typeorm_1.Column)(),
34
- (0, typeorm_1.Index)(),
35
34
  __metadata("design:type", String)
36
35
  ], UserRole.prototype, "userId", void 0);
37
36
  __decorate([
38
37
  (0, typeorm_1.Column)(),
39
- (0, typeorm_1.Index)(),
40
38
  __metadata("design:type", String)
41
39
  ], UserRole.prototype, "roleId", void 0);
42
40
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"user-role.entity.js","sourceRoot":"","sources":["../../src/entities/user-role.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCASiB;AAEjB,+CAAqC;AACrC,+CAAqC;AAS9B,IAAM,QAAQ,GAAd,MAAM,QAAQ;IAEnB,EAAE,CAAS;IAIX,MAAM,CAAS;IAIf,MAAM,CAAS;IAIf,SAAS,CAAO;IAIhB,KAAK,CAA0B;IAK/B,IAAI,CAAO;IAIX,IAAI,CAAO;IAQX,SAAS,CAAO;IAQhB,SAAS,CAAO;CACjB,CAAA;AA5CY,4BAAQ;AAEnB;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;oCACpB;AAIX;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,GAAE;;wCACO;AAIf;I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Aa;QACnB,OAAO,EAAE,GAAG,EAAE,CAAC,mBAAmB;KACnC,CAAC;8BACS,IAAI;2CAAC;AAQhB;IANC,IAAA,0BAAgB,EAAC;QAChB,IAAI,EAAE,WAAW;QACjB,QAAQ,EAAE,KAAK;QACf,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,GAAG,EAAE,CAAC,mBAAmB;KACnC,CAAC;8BACS,IAAI;2CAAC;mBAzCL,QAAQ;IAFpB,IAAA,gBAAM,EAAC,gBAAgB,CAAC;IACxB,IAAA,eAAK,EAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;GACjC,QAAQ,CA0CpB"}
package/dist/index.d.ts CHANGED
@@ -1,16 +1,21 @@
1
+ export * from './constants/notification.constant';
1
2
  export * from './constants/user.constant';
2
3
  export * from './constants/user.settings.constant';
3
4
  export * from './decorators/acl.decorator';
4
5
  export * from './decorators/user.decorator';
6
+ export * from './dtos/create-notification.dto';
5
7
  export * from './entities/permission.entity';
6
8
  export * from './entities/role.entity';
7
9
  export * from './entities/role-permission.entity';
8
10
  export * from './entities/user.entity';
11
+ export * from './entities/user-notification.entity';
12
+ export * from './entities/user-notification-preferences.entity';
9
13
  export * from './entities/user-role.entity';
10
14
  export * from './guards/acl.guard';
11
15
  export * from './guards/user.guard';
12
16
  export * from './services/acl.service';
13
17
  export * from './services/user.service';
18
+ export * from './services/user-notification.service';
14
19
  export * from './settings/user.settings';
15
20
  export * from './user.module';
16
21
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oCAAoC,CAAC;AACnD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,mCAAmC,CAAC;AAClD,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC;AAClD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oCAAoC,CAAC;AACnD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,mCAAmC,CAAC;AAClD,cAAc,wBAAwB,CAAC;AACvC,cAAc,qCAAqC,CAAC;AACpD,cAAc,iDAAiD,CAAC;AAChE,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sCAAsC,CAAC;AACrD,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC"}
package/dist/index.js CHANGED
@@ -14,19 +14,24 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./constants/notification.constant"), exports);
17
18
  __exportStar(require("./constants/user.constant"), exports);
18
19
  __exportStar(require("./constants/user.settings.constant"), exports);
19
20
  __exportStar(require("./decorators/acl.decorator"), exports);
20
21
  __exportStar(require("./decorators/user.decorator"), exports);
22
+ __exportStar(require("./dtos/create-notification.dto"), exports);
21
23
  __exportStar(require("./entities/permission.entity"), exports);
22
24
  __exportStar(require("./entities/role.entity"), exports);
23
25
  __exportStar(require("./entities/role-permission.entity"), exports);
24
26
  __exportStar(require("./entities/user.entity"), exports);
27
+ __exportStar(require("./entities/user-notification.entity"), exports);
28
+ __exportStar(require("./entities/user-notification-preferences.entity"), exports);
25
29
  __exportStar(require("./entities/user-role.entity"), exports);
26
30
  __exportStar(require("./guards/acl.guard"), exports);
27
31
  __exportStar(require("./guards/user.guard"), exports);
28
32
  __exportStar(require("./services/acl.service"), exports);
29
33
  __exportStar(require("./services/user.service"), exports);
34
+ __exportStar(require("./services/user-notification.service"), exports);
30
35
  __exportStar(require("./settings/user.settings"), exports);
31
36
  __exportStar(require("./user.module"), exports);
32
37
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C;AAC1C,qEAAmD;AACnD,6DAA2C;AAC3C,8DAA4C;AAC5C,+DAA6C;AAC7C,yDAAuC;AACvC,oEAAkD;AAClD,yDAAuC;AACvC,8DAA4C;AAC5C,qDAAmC;AACnC,sDAAoC;AACpC,yDAAuC;AACvC,0DAAwC;AACxC,2DAAyC;AACzC,gDAA8B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oEAAkD;AAClD,4DAA0C;AAC1C,qEAAmD;AACnD,6DAA2C;AAC3C,8DAA4C;AAC5C,iEAA+C;AAC/C,+DAA6C;AAC7C,yDAAuC;AACvC,oEAAkD;AAClD,yDAAuC;AACvC,sEAAoD;AACpD,kFAAgE;AAChE,8DAA4C;AAC5C,qDAAmC;AACnC,sDAAoC;AACpC,yDAAuC;AACvC,0DAAwC;AACxC,uEAAqD;AACrD,2DAAyC;AACzC,gDAA8B"}
@@ -0,0 +1,54 @@
1
+ import { Repository } from 'typeorm';
2
+ import { NotificationChannel } from '../constants/notification.constant';
3
+ import type { CreateNotificationDto } from '../dtos/create-notification.dto';
4
+ import { UserNotification } from '../entities/user-notification.entity';
5
+ import { UserNotificationPreferences } from '../entities/user-notification-preferences.entity';
6
+ import type { UserModuleOptions } from '../user.module';
7
+ export declare class UserNotificationService {
8
+ private readonly notificationRepo;
9
+ private readonly preferencesRepo;
10
+ private readonly options;
11
+ private readonly allowedTypes;
12
+ private readonly allowedCategories;
13
+ private readonly allowedPriorities;
14
+ constructor(notificationRepo: Repository<UserNotification>, preferencesRepo: Repository<UserNotificationPreferences>, options: UserModuleOptions);
15
+ getAllowedTypes(): string[];
16
+ getAllowedCategories(): string[];
17
+ getAllowedPriorities(): string[];
18
+ private validateType;
19
+ private validateCategory;
20
+ private validatePriority;
21
+ createNotification(data: CreateNotificationDto): Promise<UserNotification>;
22
+ findById(id: string): Promise<UserNotification>;
23
+ findByUserId(userId: string, options?: {
24
+ isRead?: boolean;
25
+ type?: string;
26
+ limit?: number;
27
+ offset?: number;
28
+ includeExpired?: boolean;
29
+ }): Promise<{
30
+ data: UserNotification[];
31
+ total: number;
32
+ }>;
33
+ markAsRead(id: string, userId: string): Promise<UserNotification>;
34
+ markAllAsRead(userId: string): Promise<{
35
+ count: number;
36
+ }>;
37
+ archive(id: string, userId: string): Promise<UserNotification>;
38
+ getUnreadCount(userId: string): Promise<number>;
39
+ getPreferences(userId: string): Promise<UserNotificationPreferences | null>;
40
+ upsertPreferences(userId: string, data: Partial<{
41
+ enabledChannels: NotificationChannel[];
42
+ typePreferences: Record<string, unknown>;
43
+ quietHoursStart: string;
44
+ quietHoursEnd: string;
45
+ timezone: string;
46
+ }>): Promise<UserNotificationPreferences>;
47
+ delete(id: string, userId: string): Promise<void>;
48
+ deleteExpired(olderThan?: Date): Promise<number>;
49
+ getUsersWithUnreadCount(includeExpired?: boolean): Promise<{
50
+ userId: string;
51
+ count: number;
52
+ }[]>;
53
+ }
54
+ //# sourceMappingURL=user-notification.service.d.ts.map
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AE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAapG"}
@@ -0,0 +1,217 @@
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
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.UserNotificationService = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const typeorm_1 = require("@nestjs/typeorm");
18
+ const typeorm_2 = require("typeorm");
19
+ const notification_constant_1 = require("../constants/notification.constant");
20
+ const user_notification_entity_1 = require("../entities/user-notification.entity");
21
+ const user_notification_preferences_entity_1 = require("../entities/user-notification-preferences.entity");
22
+ let UserNotificationService = class UserNotificationService {
23
+ notificationRepo;
24
+ preferencesRepo;
25
+ options;
26
+ allowedTypes;
27
+ allowedCategories;
28
+ allowedPriorities;
29
+ constructor(notificationRepo, preferencesRepo, options) {
30
+ this.notificationRepo = notificationRepo;
31
+ this.preferencesRepo = preferencesRepo;
32
+ this.options = options;
33
+ this.allowedTypes =
34
+ options.allowedNotificationTypes ?? notification_constant_1.DEFAULT_NOTIFICATION_TYPES;
35
+ this.allowedCategories =
36
+ options.allowedNotificationCategories ?? notification_constant_1.DEFAULT_NOTIFICATION_CATEGORIES;
37
+ this.allowedPriorities =
38
+ options.allowedNotificationPriorities ?? notification_constant_1.DEFAULT_NOTIFICATION_PRIORITIES;
39
+ }
40
+ getAllowedTypes() {
41
+ return [...this.allowedTypes];
42
+ }
43
+ getAllowedCategories() {
44
+ return [...this.allowedCategories];
45
+ }
46
+ getAllowedPriorities() {
47
+ return [...this.allowedPriorities];
48
+ }
49
+ validateType(type) {
50
+ if (!this.allowedTypes.includes(type)) {
51
+ throw new common_1.BadRequestException(`Invalid notification type. Allowed: ${this.allowedTypes.join(', ')}`);
52
+ }
53
+ }
54
+ validateCategory(category) {
55
+ if (!this.allowedCategories.includes(category)) {
56
+ throw new common_1.BadRequestException(`Invalid notification category. Allowed: ${this.allowedCategories.join(', ')}`);
57
+ }
58
+ }
59
+ validatePriority(priority) {
60
+ if (!this.allowedPriorities.includes(priority)) {
61
+ throw new common_1.BadRequestException(`Invalid notification priority. Allowed: ${this.allowedPriorities.join(', ')}`);
62
+ }
63
+ }
64
+ async createNotification(data) {
65
+ this.validateType(data.type);
66
+ this.validateCategory(data.category);
67
+ const priority = data.priority ?? 'medium';
68
+ this.validatePriority(priority);
69
+ const defaultChannels = this.options.defaultChannels ?? [
70
+ notification_constant_1.NotificationChannel.IN_APP,
71
+ notification_constant_1.NotificationChannel.EMAIL,
72
+ ];
73
+ const sentVia = data.sentVia ?? defaultChannels;
74
+ const partial = {
75
+ userId: data.userId,
76
+ type: data.type,
77
+ category: data.category,
78
+ title: data.title,
79
+ message: data.message,
80
+ metadata: data.metadata ?? undefined,
81
+ priority,
82
+ expiresAt: data.expiresAt ?? undefined,
83
+ groupKey: data.groupKey ?? undefined,
84
+ sentVia,
85
+ };
86
+ const notification = this.notificationRepo.create(partial);
87
+ const saved = await this.notificationRepo.save(notification);
88
+ return Array.isArray(saved) ? saved[0] : saved;
89
+ }
90
+ async findById(id) {
91
+ const notification = await this.notificationRepo.findOne({ where: { id } });
92
+ if (!notification) {
93
+ throw new common_1.NotFoundException(`Notification ${id} not found`);
94
+ }
95
+ return notification;
96
+ }
97
+ async findByUserId(userId, options) {
98
+ const qb = this.notificationRepo
99
+ .createQueryBuilder('n')
100
+ .where('n.userId = :userId', { userId });
101
+ if (options?.isRead !== undefined) {
102
+ qb.andWhere('n.isRead = :isRead', { isRead: options.isRead });
103
+ }
104
+ if (options?.type) {
105
+ this.validateType(options.type);
106
+ qb.andWhere('n.type = :type', { type: options.type });
107
+ }
108
+ if (options?.includeExpired === false) {
109
+ qb.andWhere('(n.expiresAt IS NULL OR n.expiresAt > :now)', {
110
+ now: new Date(),
111
+ });
112
+ }
113
+ const total = await qb.getCount();
114
+ qb.orderBy('n.createdAt', 'DESC');
115
+ if (options?.limit != null) {
116
+ qb.take(options.limit);
117
+ }
118
+ if (options?.offset != null) {
119
+ qb.skip(options.offset);
120
+ }
121
+ const data = await qb.getMany();
122
+ return { data, total };
123
+ }
124
+ async markAsRead(id, userId) {
125
+ const notification = await this.findById(id);
126
+ if (notification.userId !== userId) {
127
+ throw new common_1.NotFoundException(`Notification ${id} not found`);
128
+ }
129
+ notification.isRead = true;
130
+ notification.readAt = new Date();
131
+ return this.notificationRepo.save(notification);
132
+ }
133
+ async markAllAsRead(userId) {
134
+ const result = await this.notificationRepo.update({ userId, isRead: false }, { isRead: true, readAt: new Date() });
135
+ return { count: result.affected ?? 0 };
136
+ }
137
+ async archive(id, userId) {
138
+ const notification = await this.findById(id);
139
+ if (notification.userId !== userId) {
140
+ throw new common_1.NotFoundException(`Notification ${id} not found`);
141
+ }
142
+ notification.isArchived = true;
143
+ notification.archivedAt = new Date();
144
+ return this.notificationRepo.save(notification);
145
+ }
146
+ async getUnreadCount(userId) {
147
+ return this.notificationRepo.count({
148
+ where: { userId, isRead: false },
149
+ });
150
+ }
151
+ async getPreferences(userId) {
152
+ return this.preferencesRepo.findOne({ where: { userId } });
153
+ }
154
+ async upsertPreferences(userId, data) {
155
+ let prefs = await this.preferencesRepo.findOne({ where: { userId } });
156
+ if (!prefs) {
157
+ prefs = this.preferencesRepo.create({
158
+ userId,
159
+ enabledChannels: data.enabledChannels ?? [
160
+ notification_constant_1.NotificationChannel.IN_APP,
161
+ notification_constant_1.NotificationChannel.EMAIL,
162
+ ],
163
+ });
164
+ }
165
+ if (data.enabledChannels !== undefined)
166
+ prefs.enabledChannels = data.enabledChannels;
167
+ if (data.typePreferences !== undefined)
168
+ prefs.typePreferences = data.typePreferences;
169
+ if (data.quietHoursStart !== undefined)
170
+ prefs.quietHoursStart = data.quietHoursStart;
171
+ if (data.quietHoursEnd !== undefined)
172
+ prefs.quietHoursEnd = data.quietHoursEnd;
173
+ if (data.timezone !== undefined)
174
+ prefs.timezone = data.timezone;
175
+ return this.preferencesRepo.save(prefs);
176
+ }
177
+ async delete(id, userId) {
178
+ const notification = await this.findById(id);
179
+ if (notification.userId !== userId) {
180
+ throw new common_1.NotFoundException(`Notification ${id} not found`);
181
+ }
182
+ await this.notificationRepo.remove(notification);
183
+ }
184
+ async deleteExpired(olderThan) {
185
+ const cutoff = olderThan ?? new Date();
186
+ const result = await this.notificationRepo
187
+ .createQueryBuilder()
188
+ .delete()
189
+ .where('expiresAt IS NOT NULL')
190
+ .andWhere('expiresAt < :cutoff', { cutoff })
191
+ .execute();
192
+ return result.affected ?? 0;
193
+ }
194
+ async getUsersWithUnreadCount(includeExpired = false) {
195
+ const qb = this.notificationRepo
196
+ .createQueryBuilder('n')
197
+ .select('n.userId', 'userId')
198
+ .addSelect('COUNT(*)', 'count')
199
+ .where('n.isRead = :isRead', { isRead: false })
200
+ .groupBy('n.userId');
201
+ if (!includeExpired) {
202
+ qb.andWhere('(n.expiresAt IS NULL OR n.expiresAt > :now)', { now: new Date() });
203
+ }
204
+ const rows = await qb.getRawMany();
205
+ return rows.map((r) => ({ userId: r.userId, count: parseInt(r.count, 10) }));
206
+ }
207
+ };
208
+ exports.UserNotificationService = UserNotificationService;
209
+ exports.UserNotificationService = UserNotificationService = __decorate([
210
+ (0, common_1.Injectable)(),
211
+ __param(0, (0, typeorm_1.InjectRepository)(user_notification_entity_1.UserNotification)),
212
+ __param(1, (0, typeorm_1.InjectRepository)(user_notification_preferences_entity_1.UserNotificationPreferences)),
213
+ __param(2, (0, common_1.Inject)('USER_MODULE_OPTIONS')),
214
+ __metadata("design:paramtypes", [typeorm_2.Repository,
215
+ typeorm_2.Repository, Object])
216
+ ], UserNotificationService);
217
+ //# sourceMappingURL=user-notification.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-notification.service.js","sourceRoot":"","sources":["../../src/services/user-notification.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA4F;AAC5F,6CAAmD;AACnD,qCAAqC;AAErC,8EAK4C;AAE5C,mFAAwE;AACxE,2GAA+F;AAIxF,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAOf;IAEA;IAEA;IAVF,YAAY,CAAW;IACvB,iBAAiB,CAAW;IAC5B,iBAAiB,CAAW;IAE7C,YAEmB,gBAA8C,EAE9C,eAAwD,EAExD,OAA0B;QAJ1B,qBAAgB,GAAhB,gBAAgB,CAA8B;QAE9C,oBAAe,GAAf,eAAe,CAAyC;QAExD,YAAO,GAAP,OAAO,CAAmB;QAE3C,IAAI,CAAC,YAAY;YACf,OAAO,CAAC,wBAAwB,IAAI,kDAA0B,CAAC;QACjE,IAAI,CAAC,iBAAiB;YACpB,OAAO,CAAC,6BAA6B,IAAI,uDAA+B,CAAC;QAC3E,IAAI,CAAC,iBAAiB;YACpB,OAAO,CAAC,6BAA6B,IAAI,uDAA+B,CAAC;IAC7E,CAAC;IAED,eAAe;QACb,OAAO,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC;IAChC,CAAC;IAED,oBAAoB;QAClB,OAAO,CAAC,GAAG,IAAI,CAAC,iBAAiB,CAAC,CAAC;IACrC,CAAC;IAED,oBAAoB;QAClB,OAAO,CAAC,GAAG,IAAI,CAAC,iBAAiB,CAAC,CAAC;IACrC,CAAC;IAEO,YAAY,CAAC,IAAY;QAC/B,IAAI,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B,EAAC,2CAAgB,CAAC,CAAA;IAElC,WAAA,IAAA,0BAAgB,EAAC,kEAA2B,CAAC,CAAA;IAE7C,WAAA,IAAA,eAAM,EAAC,qBAAqB,CAAC,CAAA;qCAHK,oBAAU;QAEX,oBAAU;GATnC,uBAAuB,CAsPnC"}
@@ -4,6 +4,10 @@ export interface UserModuleOptions {
4
4
  metadataDefaults?: Record<string, unknown>;
5
5
  settingsDefaults?: Record<string, unknown>;
6
6
  allowedStatuses?: string[];
7
+ allowedNotificationTypes?: string[];
8
+ allowedNotificationCategories?: string[];
9
+ allowedNotificationPriorities?: string[];
10
+ defaultChannels?: import('./constants/notification.constant').NotificationChannel[];
7
11
  }
8
12
  export declare class UserModule {
9
13
  static forRoot(options?: UserModuleOptions): DynamicModule;
@@ -1 +1 @@
1
- {"version":3,"file":"user.module.d.ts","sourceRoot":"","sources":["../src/user.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAU,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAY7D,MAAM,WAAW,iBAAiB;IAKhC,kBAAkB,CAAC,EAAE,IAAI,EAAE,CAAC;IAM5B,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAM3C,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAS3C,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED,qBACa,UAAU;IAKrB,MAAM,CAAC,OAAO,CAAC,OAAO,GAAE,iBAAsB,GAAG,aAAa;IAwB9D,MAAM,CAAC,UAAU,IAAI,aAAa;CAGnC"}
1
+ {"version":3,"file":"user.module.d.ts","sourceRoot":"","sources":["../src/user.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAU,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAe7D,MAAM,WAAW,iBAAiB;IAKhC,kBAAkB,CAAC,EAAE,IAAI,EAAE,CAAC;IAM5B,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAM3C,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAS3C,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAM3B,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC;IAKpC,6BAA6B,CAAC,EAAE,MAAM,EAAE,CAAC;IAKzC,6BAA6B,CAAC,EAAE,MAAM,EAAE,CAAC;IAKzC,eAAe,CAAC,EAAE,OAAO,mCAAmC,EAAE,mBAAmB,EAAE,CAAC;CACrF;AAED,qBACa,UAAU;IAKrB,MAAM,CAAC,OAAO,CAAC,OAAO,GAAE,iBAAsB,GAAG,aAAa;IAoC9D,MAAM,CAAC,UAAU,IAAI,aAAa;CAGnC"}
@@ -15,26 +15,41 @@ const permission_entity_1 = require("./entities/permission.entity");
15
15
  const role_entity_1 = require("./entities/role.entity");
16
16
  const role_permission_entity_1 = require("./entities/role-permission.entity");
17
17
  const user_entity_1 = require("./entities/user.entity");
18
+ const user_notification_entity_1 = require("./entities/user-notification.entity");
19
+ const user_notification_preferences_entity_1 = require("./entities/user-notification-preferences.entity");
18
20
  const user_role_entity_1 = require("./entities/user-role.entity");
19
21
  const acl_service_1 = require("./services/acl.service");
22
+ const user_notification_service_1 = require("./services/user-notification.service");
20
23
  const user_service_1 = require("./services/user.service");
21
24
  let UserModule = UserModule_1 = class UserModule {
22
25
  static forRoot(options = {}) {
23
26
  const aclEntities = [role_entity_1.Role, permission_entity_1.Permission, role_permission_entity_1.RolePermission, user_role_entity_1.UserRole];
24
- const entities = [user_entity_1.User, ...aclEntities, ...(options.additionalEntities || [])];
27
+ const notificationEntities = [user_notification_entity_1.UserNotification, user_notification_preferences_entity_1.UserNotificationPreferences];
28
+ const entities = [
29
+ user_entity_1.User,
30
+ ...aclEntities,
31
+ ...notificationEntities,
32
+ ...(options.additionalEntities || []),
33
+ ];
25
34
  return {
26
35
  module: UserModule_1,
27
36
  imports: [core_1.SharedModule, typeorm_1.TypeOrmModule.forFeature(entities)],
28
37
  providers: [
29
38
  user_service_1.UserService,
30
39
  acl_service_1.AclService,
40
+ user_notification_service_1.UserNotificationService,
31
41
  {
32
42
  provide: 'USER_MODULE_OPTIONS',
33
43
  useValue: options,
34
44
  },
35
45
  ],
36
46
  controllers: [],
37
- exports: [user_service_1.UserService, acl_service_1.AclService, 'USER_MODULE_OPTIONS'],
47
+ exports: [
48
+ user_service_1.UserService,
49
+ acl_service_1.AclService,
50
+ user_notification_service_1.UserNotificationService,
51
+ 'USER_MODULE_OPTIONS',
52
+ ],
38
53
  };
39
54
  }
40
55
  static forFeature() {
@@ -1 +1 @@
1
- {"version":3,"file":"user.module.js","sourceRoot":"","sources":["../src/user.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAA6D;AAC7D,6CAAgD;AAChD,6CAAkD;AAElD,oEAA0D;AAC1D,wDAA8C;AAC9C,8EAAmE;AACnE,wDAA8C;AAC9C,kEAAuD;AACvD,wDAAoD;AACpD,0DAAsD;AAgC/C,IAAM,UAAU,kBAAhB,MAAM,UAAU;IAKrB,MAAM,CAAC,OAAO,CAAC,UAA6B,EAAE;QAC5C,MAAM,WAAW,GAAG,CAAC,kBAAI,EAAE,8BAAU,EAAE,uCAAc,EAAE,2BAAQ,CAAC,CAAC;QACjE,MAAM,QAAQ,GAAG,CAAC,kBAAI,EAAE,GAAG,WAAW,EAAE,GAAG,CAAC,OAAO,CAAC,kBAAkB,IAAI,EAAE,CAAC,CAAC,CAAC;QAE/E,OAAO;YACL,MAAM,EAAE,YAAU;YAClB,OAAO,EAAE,CAAC,mBAAY,EAAE,uBAAa,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;YAC3D,SAAS,EAAE;gBACT,0BAAW;gBACX,wBAAU;gBACV;oBACE,OAAO,EAAE,qBAAqB;oBAC9B,QAAQ,EAAE,OAAO;iBAClB;aACF;YACD,WAAW,EAAE,EAAE;YACf,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;gBACX,wBAAU;gBACV,mDAAuB;gBACvB,qBAAqB;aACtB;SACF,CAAC;IACJ,CAAC;IAMD,MAAM,CAAC,UAAU;QACf,OAAO,YAAU,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAChC,CAAC;CACF,CAAA;AA5CY,gCAAU;qBAAV,UAAU;IADtB,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,UAAU,CA4CtB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@venturialstd/user",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "User Management Module for Venturial",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -19,7 +19,8 @@
19
19
  "test:watch": "nodemon --watch src --watch test --ext ts --exec npm run test:dev",
20
20
  "migration:generate": "ts-node node_modules/.bin/typeorm migration:generate -d test/data-source.ts test/migrations/$npm_config_name",
21
21
  "migration:run": "ts-node node_modules/.bin/typeorm migration:run -d test/data-source.ts",
22
- "migration:revert": "ts-node node_modules/.bin/typeorm migration:revert -d test/data-source.ts"
22
+ "migration:revert": "ts-node node_modules/.bin/typeorm migration:revert -d test/data-source.ts",
23
+ "build:pack": "rimraf *.tgz && npm run build && npm pack"
23
24
  },
24
25
  "devDependencies": {
25
26
  "@nestjs/config": "^3.0.0",