@flusys/nestjs-shared 3.0.0 → 3.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  # Shared Package Guide
2
2
 
3
3
  > **Package:** `@flusys/nestjs-shared`
4
- > **Version:** 3.0.0
4
+ > **Version:** 3.0.1
5
5
  > **Type:** Shared NestJS utilities, classes, decorators, guards, and modules
6
6
 
7
7
  This comprehensive guide covers the shared package - the shared NestJS infrastructure layer.
@@ -1,13 +1,4 @@
1
- /**
2
- * Centralized Permission Codes
3
- *
4
- * Single source of truth for all permission codes used across the application.
5
- * Use these constants instead of hardcoded strings to prevent typos and enable easy refactoring.
6
- *
7
- * Naming Convention: <entity>.<action>
8
- * - entity: The resource being accessed (e.g., user, role, company)
9
- * - action: The operation being performed (create, read, update, delete, assign)
10
- */ // ==================== AUTH MODULE ====================
1
+ // ==================== AUTH MODULE ====================
11
2
  "use strict";
12
3
  Object.defineProperty(exports, "__esModule", {
13
4
  value: true
@@ -37,6 +28,12 @@ _export(exports, {
37
28
  get EMAIL_TEMPLATE_PERMISSIONS () {
38
29
  return EMAIL_TEMPLATE_PERMISSIONS;
39
30
  },
31
+ get EVENT_PARTICIPANT_PERMISSIONS () {
32
+ return EVENT_PARTICIPANT_PERMISSIONS;
33
+ },
34
+ get EVENT_PERMISSIONS () {
35
+ return EVENT_PERMISSIONS;
36
+ },
40
37
  get FILE_PERMISSIONS () {
41
38
  return FILE_PERMISSIONS;
42
39
  },
@@ -49,6 +46,9 @@ _export(exports, {
49
46
  get FORM_RESULT_PERMISSIONS () {
50
47
  return FORM_RESULT_PERMISSIONS;
51
48
  },
49
+ get NOTIFICATION_PERMISSIONS () {
50
+ return NOTIFICATION_PERMISSIONS;
51
+ },
52
52
  get PERMISSIONS () {
53
53
  return PERMISSIONS;
54
54
  },
@@ -159,6 +159,24 @@ const FORM_RESULT_PERMISSIONS = {
159
159
  UPDATE: 'form-result.update',
160
160
  DELETE: 'form-result.delete'
161
161
  };
162
+ const EVENT_PERMISSIONS = {
163
+ CREATE: 'event.create',
164
+ READ: 'event.read',
165
+ UPDATE: 'event.update',
166
+ DELETE: 'event.delete'
167
+ };
168
+ const EVENT_PARTICIPANT_PERMISSIONS = {
169
+ CREATE: 'event-participant.create',
170
+ READ: 'event-participant.read',
171
+ UPDATE: 'event-participant.update',
172
+ DELETE: 'event-participant.delete'
173
+ };
174
+ const NOTIFICATION_PERMISSIONS = {
175
+ CREATE: 'notification.create',
176
+ READ: 'notification.read',
177
+ UPDATE: 'notification.update',
178
+ DELETE: 'notification.delete'
179
+ };
162
180
  const PERMISSIONS = {
163
181
  // Auth
164
182
  USER: USER_PERMISSIONS,
@@ -180,5 +198,10 @@ const PERMISSIONS = {
180
198
  EMAIL_TEMPLATE: EMAIL_TEMPLATE_PERMISSIONS,
181
199
  // Form Builder
182
200
  FORM: FORM_PERMISSIONS,
183
- FORM_RESULT: FORM_RESULT_PERMISSIONS
201
+ FORM_RESULT: FORM_RESULT_PERMISSIONS,
202
+ // Event Manager
203
+ EVENT: EVENT_PERMISSIONS,
204
+ EVENT_PARTICIPANT: EVENT_PARTICIPANT_PERMISSIONS,
205
+ // Notification
206
+ NOTIFICATION: NOTIFICATION_PERMISSIONS
184
207
  };
@@ -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
+ }({});
package/cjs/index.js CHANGED
@@ -7,6 +7,7 @@ _export_star(require("./constants"), exports);
7
7
  _export_star(require("./decorators"), exports);
8
8
  _export_star(require("./dtos"), exports);
9
9
  _export_star(require("./entities"), exports);
10
+ _export_star(require("./enums"), exports);
10
11
  _export_star(require("./exceptions"), exports);
11
12
  _export_star(require("./guards"), exports);
12
13
  _export_star(require("./interceptors"), exports);
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "EVENT_MANAGER_ADAPTER", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return EVENT_MANAGER_ADAPTER;
9
+ }
10
+ });
11
+ const EVENT_MANAGER_ADAPTER = 'EVENT_MANAGER_ADAPTER';
@@ -4,10 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  _export_star(require("./api.interface"), exports);
6
6
  _export_star(require("./datasource.interface"), exports);
7
+ _export_star(require("./event-manager-adapter.interface"), exports);
7
8
  _export_star(require("./identity.interface"), exports);
8
9
  _export_star(require("./logged-user-info.interface"), exports);
9
10
  _export_star(require("./logger.interface"), exports);
10
11
  _export_star(require("./module-config.interface"), exports);
12
+ _export_star(require("./notification-adapter.interface"), exports);
11
13
  _export_star(require("./permission.interface"), exports);
12
14
  function _export_star(from, to) {
13
15
  Object.keys(from).forEach(function(k) {
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "NOTIFICATION_ADAPTER", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return NOTIFICATION_ADAPTER;
9
+ }
10
+ });
11
+ const NOTIFICATION_ADAPTER = 'NOTIFICATION_ADAPTER';
@@ -86,6 +86,24 @@ export declare const FORM_RESULT_PERMISSIONS: {
86
86
  readonly UPDATE: "form-result.update";
87
87
  readonly DELETE: "form-result.delete";
88
88
  };
89
+ export declare const EVENT_PERMISSIONS: {
90
+ readonly CREATE: "event.create";
91
+ readonly READ: "event.read";
92
+ readonly UPDATE: "event.update";
93
+ readonly DELETE: "event.delete";
94
+ };
95
+ export declare const EVENT_PARTICIPANT_PERMISSIONS: {
96
+ readonly CREATE: "event-participant.create";
97
+ readonly READ: "event-participant.read";
98
+ readonly UPDATE: "event-participant.update";
99
+ readonly DELETE: "event-participant.delete";
100
+ };
101
+ export declare const NOTIFICATION_PERMISSIONS: {
102
+ readonly CREATE: "notification.create";
103
+ readonly READ: "notification.read";
104
+ readonly UPDATE: "notification.update";
105
+ readonly DELETE: "notification.delete";
106
+ };
89
107
  export declare const PERMISSIONS: {
90
108
  readonly USER: {
91
109
  readonly CREATE: "user.create";
@@ -175,5 +193,23 @@ export declare const PERMISSIONS: {
175
193
  readonly UPDATE: "form-result.update";
176
194
  readonly DELETE: "form-result.delete";
177
195
  };
196
+ readonly EVENT: {
197
+ readonly CREATE: "event.create";
198
+ readonly READ: "event.read";
199
+ readonly UPDATE: "event.update";
200
+ readonly DELETE: "event.delete";
201
+ };
202
+ readonly EVENT_PARTICIPANT: {
203
+ readonly CREATE: "event-participant.create";
204
+ readonly READ: "event-participant.read";
205
+ readonly UPDATE: "event-participant.update";
206
+ readonly DELETE: "event-participant.delete";
207
+ };
208
+ readonly NOTIFICATION: {
209
+ readonly CREATE: "notification.create";
210
+ readonly READ: "notification.read";
211
+ readonly UPDATE: "notification.update";
212
+ readonly DELETE: "notification.delete";
213
+ };
178
214
  };
179
215
  export type PermissionCode = (typeof PERMISSIONS)[keyof typeof PERMISSIONS][keyof (typeof PERMISSIONS)[keyof typeof PERMISSIONS]];
@@ -0,0 +1,3 @@
1
+ export * from './notification-type.enum';
2
+ export * from './participant-status.enum';
3
+ export * from './recurrence-type.enum';
@@ -0,0 +1,6 @@
1
+ export declare enum NotificationType {
2
+ INFO = "info",
3
+ WARNING = "warning",
4
+ SUCCESS = "success",
5
+ ERROR = "error"
6
+ }
@@ -0,0 +1,6 @@
1
+ export declare enum ParticipantStatus {
2
+ PENDING = "pending",
3
+ ACCEPTED = "accepted",
4
+ DECLINED = "declined",
5
+ TENTATIVE = "tentative"
6
+ }
@@ -0,0 +1,7 @@
1
+ export declare enum RecurrenceType {
2
+ NONE = "none",
3
+ DAILY = "daily",
4
+ WEEKLY = "weekly",
5
+ BIWEEKLY = "biweekly",
6
+ MONTHLY = "monthly"
7
+ }
@@ -1,13 +1,4 @@
1
- /**
2
- * Centralized Permission Codes
3
- *
4
- * Single source of truth for all permission codes used across the application.
5
- * Use these constants instead of hardcoded strings to prevent typos and enable easy refactoring.
6
- *
7
- * Naming Convention: <entity>.<action>
8
- * - entity: The resource being accessed (e.g., user, role, company)
9
- * - action: The operation being performed (create, read, update, delete, assign)
10
- */ // ==================== AUTH MODULE ====================
1
+ // ==================== AUTH MODULE ====================
11
2
  export const USER_PERMISSIONS = {
12
3
  CREATE: 'user.create',
13
4
  READ: 'user.read',
@@ -100,10 +91,28 @@ export const FORM_RESULT_PERMISSIONS = {
100
91
  UPDATE: 'form-result.update',
101
92
  DELETE: 'form-result.delete'
102
93
  };
94
+ // ==================== EVENT MANAGER MODULE ====================
95
+ export const EVENT_PERMISSIONS = {
96
+ CREATE: 'event.create',
97
+ READ: 'event.read',
98
+ UPDATE: 'event.update',
99
+ DELETE: 'event.delete'
100
+ };
101
+ export const EVENT_PARTICIPANT_PERMISSIONS = {
102
+ CREATE: 'event-participant.create',
103
+ READ: 'event-participant.read',
104
+ UPDATE: 'event-participant.update',
105
+ DELETE: 'event-participant.delete'
106
+ };
107
+ // ==================== NOTIFICATION MODULE ====================
108
+ export const NOTIFICATION_PERMISSIONS = {
109
+ CREATE: 'notification.create',
110
+ READ: 'notification.read',
111
+ UPDATE: 'notification.update',
112
+ DELETE: 'notification.delete'
113
+ };
103
114
  // ==================== AGGREGATED EXPORTS ====================
104
- /**
105
- * All permission codes grouped by module
106
- */ export const PERMISSIONS = {
115
+ export const PERMISSIONS = {
107
116
  // Auth
108
117
  USER: USER_PERMISSIONS,
109
118
  COMPANY: COMPANY_PERMISSIONS,
@@ -124,5 +133,10 @@ export const FORM_RESULT_PERMISSIONS = {
124
133
  EMAIL_TEMPLATE: EMAIL_TEMPLATE_PERMISSIONS,
125
134
  // Form Builder
126
135
  FORM: FORM_PERMISSIONS,
127
- FORM_RESULT: FORM_RESULT_PERMISSIONS
136
+ FORM_RESULT: FORM_RESULT_PERMISSIONS,
137
+ // Event Manager
138
+ EVENT: EVENT_PERMISSIONS,
139
+ EVENT_PARTICIPANT: EVENT_PARTICIPANT_PERMISSIONS,
140
+ // Notification
141
+ NOTIFICATION: NOTIFICATION_PERMISSIONS
128
142
  };
@@ -0,0 +1,3 @@
1
+ export * from './notification-type.enum';
2
+ export * from './participant-status.enum';
3
+ export * from './recurrence-type.enum';
@@ -0,0 +1,7 @@
1
+ export var NotificationType = /*#__PURE__*/ function(NotificationType) {
2
+ NotificationType["INFO"] = "info";
3
+ NotificationType["WARNING"] = "warning";
4
+ NotificationType["SUCCESS"] = "success";
5
+ NotificationType["ERROR"] = "error";
6
+ return NotificationType;
7
+ }({});
@@ -0,0 +1,7 @@
1
+ export var ParticipantStatus = /*#__PURE__*/ function(ParticipantStatus) {
2
+ ParticipantStatus["PENDING"] = "pending";
3
+ ParticipantStatus["ACCEPTED"] = "accepted";
4
+ ParticipantStatus["DECLINED"] = "declined";
5
+ ParticipantStatus["TENTATIVE"] = "tentative";
6
+ return ParticipantStatus;
7
+ }({});
@@ -0,0 +1,8 @@
1
+ export var RecurrenceType = /*#__PURE__*/ function(RecurrenceType) {
2
+ RecurrenceType["NONE"] = "none";
3
+ RecurrenceType["DAILY"] = "daily";
4
+ RecurrenceType["WEEKLY"] = "weekly";
5
+ RecurrenceType["BIWEEKLY"] = "biweekly";
6
+ RecurrenceType["MONTHLY"] = "monthly";
7
+ return RecurrenceType;
8
+ }({});
package/fesm/index.js CHANGED
@@ -3,6 +3,7 @@ export * from './constants';
3
3
  export * from './decorators';
4
4
  export * from './dtos';
5
5
  export * from './entities';
6
+ export * from './enums';
6
7
  export * from './exceptions';
7
8
  export * from './guards';
8
9
  export * from './interceptors';
@@ -0,0 +1 @@
1
+ export const EVENT_MANAGER_ADAPTER = 'EVENT_MANAGER_ADAPTER';
@@ -1,7 +1,9 @@
1
1
  export * from './api.interface';
2
2
  export * from './datasource.interface';
3
+ export * from './event-manager-adapter.interface';
3
4
  export * from './identity.interface';
4
5
  export * from './logged-user-info.interface';
5
6
  export * from './logger.interface';
6
7
  export * from './module-config.interface';
8
+ export * from './notification-adapter.interface';
7
9
  export * from './permission.interface';
@@ -0,0 +1 @@
1
+ export const NOTIFICATION_ADAPTER = 'NOTIFICATION_ADAPTER';
package/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export * from './constants';
3
3
  export * from './decorators';
4
4
  export * from './dtos';
5
5
  export * from './entities';
6
+ export * from './enums';
6
7
  export * from './exceptions';
7
8
  export * from './guards';
8
9
  export * from './interceptors';
@@ -0,0 +1,43 @@
1
+ import { ParticipantStatus } from '../enums/participant-status.enum';
2
+ import { RecurrenceType } from '../enums/recurrence-type.enum';
3
+ export interface IEventManagerAdapter {
4
+ createEvent(options: CreateEventOptions): Promise<EventResult>;
5
+ addParticipants(eventId: string, userIds: string[], companyId?: string): Promise<void>;
6
+ removeParticipant(eventId: string, userId: string): Promise<void>;
7
+ updateParticipantStatus(participantId: string, status: ParticipantStatus): Promise<void>;
8
+ getEventsForUser?(userId: string, startDate: Date, endDate: Date, companyId?: string): Promise<EventResult[]>;
9
+ getEventById?(eventId: string): Promise<EventResult | null>;
10
+ }
11
+ export interface CreateEventOptions {
12
+ title: string;
13
+ description?: string;
14
+ meetingLink?: string;
15
+ startDateTime: Date;
16
+ endDateTime: Date;
17
+ isAllDay?: boolean;
18
+ recurrenceType?: RecurrenceType;
19
+ recurrenceEndDate?: Date;
20
+ color?: string;
21
+ metadata?: Record<string, unknown>;
22
+ participantIds?: string[];
23
+ organizerId?: string;
24
+ companyId?: string;
25
+ }
26
+ export interface EventResult {
27
+ id: string;
28
+ title: string;
29
+ description?: string | null;
30
+ meetingLink?: string | null;
31
+ startDateTime: Date;
32
+ endDateTime: Date;
33
+ isAllDay: boolean;
34
+ recurrenceType: string;
35
+ recurrenceEndDate?: Date | null;
36
+ color: string;
37
+ isActive: boolean;
38
+ metadata?: Record<string, unknown> | null;
39
+ companyId?: string | null;
40
+ createdAt: Date;
41
+ updatedAt: Date;
42
+ }
43
+ export declare const EVENT_MANAGER_ADAPTER = "EVENT_MANAGER_ADAPTER";
@@ -1,7 +1,9 @@
1
1
  export * from './api.interface';
2
2
  export * from './datasource.interface';
3
+ export * from './event-manager-adapter.interface';
3
4
  export * from './identity.interface';
4
5
  export * from './logged-user-info.interface';
5
6
  export * from './logger.interface';
6
7
  export * from './module-config.interface';
8
+ export * from './notification-adapter.interface';
7
9
  export * from './permission.interface';
@@ -0,0 +1,22 @@
1
+ import { NotificationType } from '../enums/notification-type.enum';
2
+ export interface INotificationAdapter {
3
+ send(options: NotificationSendOptions): Promise<void>;
4
+ sendToMany(options: NotificationBulkSendOptions): Promise<void>;
5
+ broadcastToCompany?(companyId: string, title: string, message?: string, type?: NotificationType, data?: Record<string, unknown>): Promise<void>;
6
+ isUserOnline?(userId: string): boolean;
7
+ }
8
+ interface NotificationBaseOptions {
9
+ title: string;
10
+ message?: string;
11
+ type?: NotificationType;
12
+ data?: Record<string, unknown>;
13
+ companyId?: string;
14
+ }
15
+ export interface NotificationSendOptions extends NotificationBaseOptions {
16
+ userId: string;
17
+ }
18
+ export interface NotificationBulkSendOptions extends NotificationBaseOptions {
19
+ userIds: string[];
20
+ }
21
+ export declare const NOTIFICATION_ADAPTER = "NOTIFICATION_ADAPTER";
22
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flusys/nestjs-shared",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "Common shared utilities for Flusys NestJS applications",
5
5
  "main": "cjs/index.js",
6
6
  "module": "fesm/index.js",
@@ -46,6 +46,11 @@
46
46
  "import": "./fesm/entities/index.js",
47
47
  "require": "./cjs/entities/index.js"
48
48
  },
49
+ "./enums": {
50
+ "types": "./enums/index.d.ts",
51
+ "import": "./fesm/enums/index.js",
52
+ "require": "./cjs/enums/index.js"
53
+ },
49
54
  "./exceptions": {
50
55
  "types": "./exceptions/index.d.ts",
51
56
  "import": "./fesm/exceptions/index.js",
@@ -105,6 +110,6 @@
105
110
  "winston-daily-rotate-file": "^5.0.0"
106
111
  },
107
112
  "dependencies": {
108
- "@flusys/nestjs-core": "3.0.0"
113
+ "@flusys/nestjs-core": "3.0.1"
109
114
  }
110
115
  }