@flusys/nestjs-notification 7.1.0 → 8.0.0
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/adapters/index.d.ts +1 -1
- package/adapters/notification.adapter.d.ts +2 -2
- package/config/index.d.ts +3 -3
- package/controllers/index.d.ts +1 -1
- package/controllers/notification.controller.d.ts +4 -4
- package/docs/index.d.ts +1 -1
- package/docs/notification-swagger.config.d.ts +2 -2
- package/dtos/index.d.ts +1 -1
- package/entities/index.d.ts +5 -5
- package/entities/notification-with-company.entity.d.ts +1 -1
- package/fesm/244.js +816 -0
- package/fesm/446.js +939 -0
- package/fesm/adapters/index.js +79 -1
- package/fesm/config/index.js +84 -3
- package/fesm/controllers/index.js +13 -1
- package/fesm/docs/index.js +112 -1
- package/fesm/dtos/index.js +311 -1
- package/fesm/entities/index.js +211 -8
- package/fesm/gateways/index.js +286 -1
- package/fesm/index.js +467 -10
- package/fesm/interfaces/index.js +16 -2
- package/fesm/modules/index.js +269 -1
- package/fesm/runtime.js +85 -0
- package/fesm/services/index.js +357 -4
- package/gateways/index.d.ts +1 -1
- package/gateways/notification.gateway.d.ts +2 -2
- package/index.d.ts +10 -10
- package/interfaces/index.d.ts +2 -2
- package/interfaces/notification-module.interface.d.ts +3 -3
- package/interfaces/notification.interface.d.ts +1 -1
- package/modules/index.d.ts +1 -1
- package/modules/notification.module.d.ts +2 -2
- package/package.json +33 -44
- package/services/index.d.ts +4 -4
- package/services/notification-config.service.d.ts +3 -3
- package/services/notification-datasource.provider.d.ts +3 -3
- package/services/notification-helper.service.d.ts +5 -5
- package/services/notification.service.d.ts +8 -8
- package/cjs/adapters/index.js +0 -18
- package/cjs/adapters/notification.adapter.js +0 -62
- package/cjs/adapters/notification.adapter.spec.js +0 -73
- package/cjs/config/event-actions.js +0 -33
- package/cjs/config/index.js +0 -20
- package/cjs/config/message-keys.js +0 -19
- package/cjs/config/notification.constants.js +0 -11
- package/cjs/controllers/index.js +0 -18
- package/cjs/controllers/notification.controller.js +0 -299
- package/cjs/controllers/notification.controller.spec.js +0 -214
- package/cjs/docs/index.js +0 -18
- package/cjs/docs/notification-swagger.config.js +0 -97
- package/cjs/docs/notification-swagger.config.spec.js +0 -68
- package/cjs/dtos/index.js +0 -18
- package/cjs/dtos/notification.dto.js +0 -295
- package/cjs/entities/index.js +0 -48
- package/cjs/entities/index.spec.js +0 -13
- package/cjs/entities/notification-with-company.entity.js +0 -57
- package/cjs/entities/notification.entity.js +0 -112
- package/cjs/gateways/index.js +0 -18
- package/cjs/gateways/notification.gateway.js +0 -172
- package/cjs/gateways/notification.gateway.spec.js +0 -359
- package/cjs/index.js +0 -28
- package/cjs/interfaces/index.js +0 -19
- package/cjs/interfaces/notification-module.interface.js +0 -4
- package/cjs/interfaces/notification.interface.js +0 -4
- package/cjs/modules/index.js +0 -18
- package/cjs/modules/notification.module.js +0 -139
- package/cjs/modules/notification.module.spec.js +0 -152
- package/cjs/services/index.js +0 -21
- package/cjs/services/notification-config.service.js +0 -69
- package/cjs/services/notification-config.service.spec.js +0 -113
- package/cjs/services/notification-datasource.provider.js +0 -133
- package/cjs/services/notification-datasource.provider.spec.js +0 -136
- package/cjs/services/notification-helper.service.js +0 -197
- package/cjs/services/notification-helper.service.spec.js +0 -392
- package/cjs/services/notification.service.js +0 -281
- package/cjs/services/notification.service.spec.js +0 -560
- package/fesm/adapters/notification.adapter.js +0 -52
- package/fesm/adapters/notification.adapter.spec.js +0 -69
- package/fesm/config/event-actions.js +0 -12
- package/fesm/config/message-keys.js +0 -9
- package/fesm/config/notification.constants.js +0 -1
- package/fesm/controllers/notification.controller.js +0 -289
- package/fesm/controllers/notification.controller.spec.js +0 -210
- package/fesm/docs/notification-swagger.config.js +0 -87
- package/fesm/docs/notification-swagger.config.spec.js +0 -64
- package/fesm/dtos/notification.dto.js +0 -262
- package/fesm/entities/index.spec.js +0 -9
- package/fesm/entities/notification-with-company.entity.js +0 -47
- package/fesm/entities/notification.entity.js +0 -102
- package/fesm/gateways/notification.gateway.js +0 -162
- package/fesm/gateways/notification.gateway.spec.js +0 -355
- package/fesm/interfaces/notification-module.interface.js +0 -1
- package/fesm/interfaces/notification.interface.js +0 -1
- package/fesm/modules/notification.module.js +0 -129
- package/fesm/modules/notification.module.spec.js +0 -148
- package/fesm/services/notification-config.service.js +0 -59
- package/fesm/services/notification-config.service.spec.js +0 -109
- package/fesm/services/notification-datasource.provider.js +0 -82
- package/fesm/services/notification-datasource.provider.spec.js +0 -132
- package/fesm/services/notification-helper.service.js +0 -187
- package/fesm/services/notification-helper.service.spec.js +0 -388
- package/fesm/services/notification.service.js +0 -271
- package/fesm/services/notification.service.spec.js +0 -556
package/fesm/services/index.js
CHANGED
|
@@ -1,4 +1,357 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
1
|
+
import { applyCompanyFilter } from "@flusys/nestjs-shared/utils";
|
|
2
|
+
export const __rspack_esm_id = 995;
|
|
3
|
+
export const __rspack_esm_ids = [995];
|
|
4
|
+
export const __webpack_modules__ = {
|
|
5
|
+
158(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
6
|
+
// ==================== NOTIFICATION MODULE MESSAGE KEYS ====================
|
|
7
|
+
const NOTIFICATION_MESSAGES = {
|
|
8
|
+
NOT_FOUND: 'notification.not.found',
|
|
9
|
+
MARK_READ_SUCCESS: 'notification.mark.read.success',
|
|
10
|
+
MARK_ALL_READ_SUCCESS: 'notification.mark.all.read.success',
|
|
11
|
+
UNREAD_COUNT_SUCCESS: 'notification.unread.count.success',
|
|
12
|
+
SEND_SUCCESS: 'notification.send.success',
|
|
13
|
+
BROADCAST_SUCCESS: 'notification.broadcast.success'
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
17
|
+
}, {
|
|
18
|
+
x: NOTIFICATION_MESSAGES
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
},
|
|
23
|
+
816(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
24
|
+
/* import */ var _notification_config_service_js__rspack_import_0 = __webpack_require__(53);
|
|
25
|
+
/* import */ var _notification_datasource_provider_js__rspack_import_1 = __webpack_require__(335);
|
|
26
|
+
/* import */ var _notification_service_js__rspack_import_2 = __webpack_require__(305);
|
|
27
|
+
/* import */ var _notification_helper_service_js__rspack_import_3 = __webpack_require__(487);
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
34
|
+
JE: () => (/* reexport safe */ _notification_service_js__rspack_import_2.J),
|
|
35
|
+
MK: () => (/* reexport safe */ _notification_datasource_provider_js__rspack_import_1.M),
|
|
36
|
+
Tf: () => (/* reexport safe */ _notification_helper_service_js__rspack_import_3.T),
|
|
37
|
+
vM: () => (/* reexport safe */ _notification_config_service_js__rspack_import_0.v)
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
},
|
|
42
|
+
305(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
43
|
+
|
|
44
|
+
// EXPORTS
|
|
45
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
46
|
+
J: () => (/* binding */ NotificationService)
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// EXTERNAL MODULE: external "@flusys/nestjs-shared"
|
|
50
|
+
var nestjs_shared_ = __webpack_require__(422);
|
|
51
|
+
// EXTERNAL MODULE: external "@flusys/nestjs-shared/classes"
|
|
52
|
+
var classes_ = __webpack_require__(937);
|
|
53
|
+
// EXTERNAL MODULE: external "@flusys/nestjs-shared/modules"
|
|
54
|
+
var modules_ = __webpack_require__(236);
|
|
55
|
+
;// CONCATENATED MODULE: external "@flusys/nestjs-shared/utils"
|
|
56
|
+
|
|
57
|
+
// EXTERNAL MODULE: external "@nestjs/common"
|
|
58
|
+
var common_ = __webpack_require__(157);
|
|
59
|
+
// EXTERNAL MODULE: ./projects/nestjs-notification/src/config/event-actions.ts
|
|
60
|
+
var event_actions = __webpack_require__(360);
|
|
61
|
+
// EXTERNAL MODULE: ./projects/nestjs-notification/src/config/message-keys.ts
|
|
62
|
+
var message_keys = __webpack_require__(158);
|
|
63
|
+
// EXTERNAL MODULE: ./projects/nestjs-notification/src/entities/index.ts + 4 modules
|
|
64
|
+
var src_entities = __webpack_require__(240);
|
|
65
|
+
// EXTERNAL MODULE: ./projects/nestjs-notification/src/gateways/index.ts + 4 modules
|
|
66
|
+
var gateways = __webpack_require__(31);
|
|
67
|
+
// EXTERNAL MODULE: ./projects/nestjs-notification/src/services/notification-config.service.ts
|
|
68
|
+
var notification_config_service = __webpack_require__(53);
|
|
69
|
+
// EXTERNAL MODULE: ./projects/nestjs-notification/src/services/notification-datasource.provider.ts + 1 modules
|
|
70
|
+
var notification_datasource_provider = __webpack_require__(335);
|
|
71
|
+
;// CONCATENATED MODULE: ./projects/nestjs-notification/src/services/notification.service.ts
|
|
72
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
73
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
74
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
75
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
76
|
+
} else {
|
|
77
|
+
for(var i = decorators.length - 1; i >= 0; i--){
|
|
78
|
+
if (d = decorators[i]) {
|
|
79
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
84
|
+
}
|
|
85
|
+
function _ts_metadata(metadataKey, metadataValue) {
|
|
86
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
87
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function _ts_param(paramIndex, decorator) {
|
|
91
|
+
return function(target, key) {
|
|
92
|
+
decorator(target, key, paramIndex);
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
class NotificationService extends classes_.ApiService {
|
|
106
|
+
cacheManager;
|
|
107
|
+
utilsService;
|
|
108
|
+
notificationConfig;
|
|
109
|
+
gateway;
|
|
110
|
+
constructor(cacheManager, utilsService, notificationConfig, dataSourceProvider, gateway){
|
|
111
|
+
super(event_actions/* .NOTIFICATION_EVENT_ENTITIES.NOTIFICATION */.BA.NOTIFICATION, cacheManager, utilsService, NotificationService.name, false, event_actions/* .NOTIFICATION_EVENT_MODULE */.Wx, dataSourceProvider, notificationConfig.isCompanyFeatureEnabled() ? src_entities.NotificationWithCompany : src_entities.Notification), this.cacheManager = cacheManager, this.utilsService = utilsService, this.notificationConfig = notificationConfig, this.gateway = gateway;
|
|
112
|
+
}
|
|
113
|
+
async convertSingleDtoToEntity(dto, user) {
|
|
114
|
+
let entity = {};
|
|
115
|
+
if ('id' in dto && dto.id) {
|
|
116
|
+
const existing = await this.repository.findOne({
|
|
117
|
+
where: {
|
|
118
|
+
id: dto.id
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
if (!existing) {
|
|
122
|
+
throw new common_.NotFoundException({
|
|
123
|
+
message: 'Notification not found',
|
|
124
|
+
messageKey: message_keys/* .NOTIFICATION_MESSAGES.NOT_FOUND */.x.NOT_FOUND
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
entity = existing;
|
|
128
|
+
}
|
|
129
|
+
const merged = {
|
|
130
|
+
...entity,
|
|
131
|
+
userId: user?.id ?? entity.userId,
|
|
132
|
+
type: dto.type ?? entity.type ?? 'info',
|
|
133
|
+
title: dto.title ?? entity.title,
|
|
134
|
+
message: dto.message ?? entity.message,
|
|
135
|
+
data: dto.data ?? entity.data,
|
|
136
|
+
isRead: entity.isRead ?? false,
|
|
137
|
+
readAt: entity.readAt
|
|
138
|
+
};
|
|
139
|
+
if (this.notificationConfig.isCompanyFeatureEnabled()) {
|
|
140
|
+
merged.companyId = dto.companyId ?? user?.companyId ?? entity.companyId ?? null;
|
|
141
|
+
}
|
|
142
|
+
return merged;
|
|
143
|
+
}
|
|
144
|
+
async getSelectQuery(query, _user, select) {
|
|
145
|
+
const fields = select && select.length ? select : [];
|
|
146
|
+
const always = [
|
|
147
|
+
'createdAt',
|
|
148
|
+
'updatedAt'
|
|
149
|
+
];
|
|
150
|
+
const merged = [
|
|
151
|
+
...new Set([
|
|
152
|
+
...fields,
|
|
153
|
+
...always
|
|
154
|
+
])
|
|
155
|
+
];
|
|
156
|
+
query.addSelect(merged.map((f)=>`${this.entityName}.${f}`));
|
|
157
|
+
return {
|
|
158
|
+
query,
|
|
159
|
+
isRaw: false
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
async getFilterQuery(query, filter, _user) {
|
|
163
|
+
for (const [key, value] of Object.entries(filter)){
|
|
164
|
+
if (key === 'isRead' && typeof value === 'boolean') {
|
|
165
|
+
query.andWhere(`${this.entityName}.isRead = :isRead`, {
|
|
166
|
+
isRead: value
|
|
167
|
+
});
|
|
168
|
+
} else if (key === 'type' && value) {
|
|
169
|
+
query.andWhere(`${this.entityName}.type = :type`, {
|
|
170
|
+
type: value
|
|
171
|
+
});
|
|
172
|
+
} else if (key === 'userId' && value) {
|
|
173
|
+
query.andWhere(`${this.entityName}.userId = :userId`, {
|
|
174
|
+
userId: value
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return {
|
|
179
|
+
query,
|
|
180
|
+
isRaw: false
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
async getExtraManipulateQuery(query, filterDto, user) {
|
|
184
|
+
const result = await super.getExtraManipulateQuery(query, filterDto, user);
|
|
185
|
+
if (user?.id) {
|
|
186
|
+
query.andWhere(`${this.entityName}.userId = :currentUserId`, {
|
|
187
|
+
currentUserId: user.id
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
applyCompanyFilter(query, {
|
|
191
|
+
isCompanyFeatureEnabled: this.notificationConfig.isCompanyFeatureEnabled(),
|
|
192
|
+
entityAlias: this.entityName
|
|
193
|
+
}, user);
|
|
194
|
+
const filterSort = filterDto?.sort;
|
|
195
|
+
if (!filterSort || Object.keys(filterSort).length === 0) {
|
|
196
|
+
query.orderBy(`${this.entityName}.createdAt`, 'DESC');
|
|
197
|
+
}
|
|
198
|
+
return result;
|
|
199
|
+
}
|
|
200
|
+
async afterInsertOperation(entities, _dto, _user, _qr) {
|
|
201
|
+
for (const entity of entities){
|
|
202
|
+
const ext = entity;
|
|
203
|
+
this.emitToUser(entity.userId, ext.companyId, 'notification:new', this.toPayload(entity));
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
async markAsRead(id, user) {
|
|
207
|
+
await this.ensureDataSourceRepository();
|
|
208
|
+
const notification = await this.repository.findOne({
|
|
209
|
+
where: {
|
|
210
|
+
id,
|
|
211
|
+
userId: user.id
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
if (!notification) {
|
|
215
|
+
throw new common_.NotFoundException({
|
|
216
|
+
message: 'Notification not found',
|
|
217
|
+
messageKey: message_keys/* .NOTIFICATION_MESSAGES.NOT_FOUND */.x.NOT_FOUND
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
notification.isRead = true;
|
|
221
|
+
notification.readAt = new Date();
|
|
222
|
+
await this.repository.save(notification);
|
|
223
|
+
await Promise.all([
|
|
224
|
+
this.clearCacheForAll(),
|
|
225
|
+
this.clearCacheForId([
|
|
226
|
+
notification
|
|
227
|
+
])
|
|
228
|
+
]);
|
|
229
|
+
// Emit to user's sockets in the same company context
|
|
230
|
+
const ext = notification;
|
|
231
|
+
this.emitToUser(user.id, ext.companyId ?? user.companyId, 'notification:read', {
|
|
232
|
+
id
|
|
233
|
+
});
|
|
234
|
+
await this.publishDomainAction(event_actions/* .NOTIFICATION_EVENT_ACTIONS.READ */.R.READ, {
|
|
235
|
+
ids: [
|
|
236
|
+
notification.id
|
|
237
|
+
],
|
|
238
|
+
user
|
|
239
|
+
});
|
|
240
|
+
return notification;
|
|
241
|
+
}
|
|
242
|
+
async markAllAsRead(user) {
|
|
243
|
+
await this.ensureDataSourceRepository();
|
|
244
|
+
const where = {
|
|
245
|
+
userId: user.id,
|
|
246
|
+
isRead: false
|
|
247
|
+
};
|
|
248
|
+
if (this.notificationConfig.isCompanyFeatureEnabled() && user.companyId) {
|
|
249
|
+
where.companyId = user.companyId;
|
|
250
|
+
}
|
|
251
|
+
const result = await this.repository.update(where, {
|
|
252
|
+
isRead: true,
|
|
253
|
+
readAt: new Date()
|
|
254
|
+
});
|
|
255
|
+
await this.clearCacheForAll();
|
|
256
|
+
// Emit to user's sockets in the current company context
|
|
257
|
+
this.emitToUser(user.id, user.companyId, 'notification:read-all', {});
|
|
258
|
+
await this.publishDomainAction(event_actions/* .NOTIFICATION_EVENT_ACTIONS.ALL_READ */.R.ALL_READ, {
|
|
259
|
+
metadata: {
|
|
260
|
+
count: result.affected ?? 0
|
|
261
|
+
},
|
|
262
|
+
user
|
|
263
|
+
});
|
|
264
|
+
return result.affected ?? 0;
|
|
265
|
+
}
|
|
266
|
+
async getUnreadCount(user) {
|
|
267
|
+
await this.ensureDataSourceRepository();
|
|
268
|
+
const where = {
|
|
269
|
+
userId: user.id,
|
|
270
|
+
isRead: false
|
|
271
|
+
};
|
|
272
|
+
if (this.notificationConfig.isCompanyFeatureEnabled() && user.companyId) {
|
|
273
|
+
where.companyId = user.companyId;
|
|
274
|
+
}
|
|
275
|
+
return this.repository.count({
|
|
276
|
+
where
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
toPayload(entity) {
|
|
280
|
+
return {
|
|
281
|
+
id: entity.id,
|
|
282
|
+
type: entity.type,
|
|
283
|
+
title: entity.title,
|
|
284
|
+
message: entity.message,
|
|
285
|
+
data: entity.data,
|
|
286
|
+
createdAt: entity.createdAt
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
emitToUser(userId, companyId, event, payload) {
|
|
290
|
+
if (!this.gateway) {
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
if (this.notificationConfig.isCompanyFeatureEnabled() && companyId) {
|
|
294
|
+
this.gateway.emitToUserInCompany(userId, companyId, event, payload);
|
|
295
|
+
} else {
|
|
296
|
+
this.gateway.emitToUser(userId, event, payload);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
_ts_decorate([
|
|
301
|
+
(0,nestjs_shared_.LogAction)({
|
|
302
|
+
action: 'notification.markAsRead',
|
|
303
|
+
module: 'notification'
|
|
304
|
+
}),
|
|
305
|
+
_ts_metadata("design:type", Function),
|
|
306
|
+
_ts_metadata("design:paramtypes", [
|
|
307
|
+
String,
|
|
308
|
+
typeof ILoggedUserInfo === "undefined" ? Object : ILoggedUserInfo
|
|
309
|
+
]),
|
|
310
|
+
_ts_metadata("design:returntype", Promise)
|
|
311
|
+
], NotificationService.prototype, "markAsRead", null);
|
|
312
|
+
_ts_decorate([
|
|
313
|
+
(0,nestjs_shared_.LogAction)({
|
|
314
|
+
action: 'notification.markAllAsRead',
|
|
315
|
+
module: 'notification'
|
|
316
|
+
}),
|
|
317
|
+
_ts_metadata("design:type", Function),
|
|
318
|
+
_ts_metadata("design:paramtypes", [
|
|
319
|
+
typeof ILoggedUserInfo === "undefined" ? Object : ILoggedUserInfo
|
|
320
|
+
]),
|
|
321
|
+
_ts_metadata("design:returntype", Promise)
|
|
322
|
+
], NotificationService.prototype, "markAllAsRead", null);
|
|
323
|
+
NotificationService = _ts_decorate([
|
|
324
|
+
(0,common_.Injectable)({
|
|
325
|
+
scope: common_.Scope.REQUEST
|
|
326
|
+
}),
|
|
327
|
+
_ts_param(0, (0,common_.Inject)('CACHE_INSTANCE')),
|
|
328
|
+
_ts_param(1, (0,common_.Inject)(modules_.UtilsService)),
|
|
329
|
+
_ts_param(2, (0,common_.Inject)(notification_config_service/* .NotificationConfigService */.v)),
|
|
330
|
+
_ts_param(3, (0,common_.Inject)(notification_datasource_provider/* .NotificationDataSourceProvider */.M)),
|
|
331
|
+
_ts_param(4, (0,common_.Optional)()),
|
|
332
|
+
_ts_param(4, (0,common_.Inject)(gateways/* .NotificationGateway */.g)),
|
|
333
|
+
_ts_metadata("design:type", Function),
|
|
334
|
+
_ts_metadata("design:paramtypes", [
|
|
335
|
+
typeof classes_.HybridCache === "undefined" ? Object : classes_.HybridCache,
|
|
336
|
+
typeof modules_.UtilsService === "undefined" ? Object : modules_.UtilsService,
|
|
337
|
+
typeof notification_config_service/* .NotificationConfigService */.v === "undefined" ? Object : notification_config_service/* .NotificationConfigService */.v,
|
|
338
|
+
typeof notification_datasource_provider/* .NotificationDataSourceProvider */.M === "undefined" ? Object : notification_datasource_provider/* .NotificationDataSourceProvider */.M,
|
|
339
|
+
typeof gateways/* .NotificationGateway */.g === "undefined" ? Object : gateways/* .NotificationGateway */.g
|
|
340
|
+
])
|
|
341
|
+
], NotificationService);
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
},
|
|
345
|
+
|
|
346
|
+
};
|
|
347
|
+
import { __webpack_require__ } from '../runtime.js';
|
|
348
|
+
var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); }
|
|
349
|
+
import * as __rspack_chunk_1 from '../244.js';
|
|
350
|
+
__webpack_require__.C(__rspack_chunk_1);
|
|
351
|
+
import * as __rspack_chunk_2 from './index.js';
|
|
352
|
+
__webpack_require__.C(__rspack_chunk_2);
|
|
353
|
+
var __webpack_exports__ = __webpack_exec__(816);var __webpack_exports__NotificationConfigService = __webpack_exports__.vM;
|
|
354
|
+
var __webpack_exports__NotificationDataSourceProvider = __webpack_exports__.MK;
|
|
355
|
+
var __webpack_exports__NotificationHelperService = __webpack_exports__.Tf;
|
|
356
|
+
var __webpack_exports__NotificationService = __webpack_exports__.JE;
|
|
357
|
+
export { __webpack_exports__NotificationConfigService as NotificationConfigService, __webpack_exports__NotificationDataSourceProvider as NotificationDataSourceProvider, __webpack_exports__NotificationHelperService as NotificationHelperService, __webpack_exports__NotificationService as NotificationService };
|
package/gateways/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './notification.gateway';
|
|
1
|
+
export * from './notification.gateway.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { JwtService } from '@nestjs/jwt';
|
|
2
|
-
import { OnGatewayConnection, OnGatewayDisconnect, OnGatewayInit } from '@nestjs/websockets';
|
|
2
|
+
import { type OnGatewayConnection, type OnGatewayDisconnect, type OnGatewayInit } from '@nestjs/websockets';
|
|
3
3
|
import { Server, Socket } from 'socket.io';
|
|
4
|
-
import { NotificationConfigService } from '../services/notification-config.service';
|
|
4
|
+
import { NotificationConfigService } from '../services/notification-config.service.js';
|
|
5
5
|
export declare class NotificationGateway implements OnGatewayInit, OnGatewayConnection, OnGatewayDisconnect {
|
|
6
6
|
private readonly configService;
|
|
7
7
|
private readonly jwtService;
|
package/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export * from './adapters';
|
|
2
|
-
export * from './config';
|
|
3
|
-
export * from './controllers';
|
|
4
|
-
export * from './docs';
|
|
5
|
-
export * from './dtos';
|
|
6
|
-
export * from './entities';
|
|
7
|
-
export * from './gateways';
|
|
8
|
-
export * from './interfaces';
|
|
9
|
-
export * from './modules';
|
|
10
|
-
export * from './services';
|
|
1
|
+
export * from './adapters/index.js';
|
|
2
|
+
export * from './config/index.js';
|
|
3
|
+
export * from './controllers/index.js';
|
|
4
|
+
export * from './docs/index.js';
|
|
5
|
+
export * from './dtos/index.js';
|
|
6
|
+
export * from './entities/index.js';
|
|
7
|
+
export * from './gateways/index.js';
|
|
8
|
+
export * from './interfaces/index.js';
|
|
9
|
+
export * from './modules/index.js';
|
|
10
|
+
export * from './services/index.js';
|
package/interfaces/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './notification.interface';
|
|
2
|
-
export * from './notification-module.interface';
|
|
1
|
+
export * from './notification.interface.js';
|
|
2
|
+
export * from './notification-module.interface.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IBootstrapAppConfig, IDataSourceServiceOptions, IDynamicModuleConfig } from '@flusys/nestjs-core';
|
|
2
|
-
import { IModuleEventsConfig } from '@flusys/nestjs-shared/interfaces';
|
|
3
|
-
import { ModuleMetadata, Type } from '@nestjs/common';
|
|
1
|
+
import { type IBootstrapAppConfig, type IDataSourceServiceOptions, type IDynamicModuleConfig } from '@flusys/nestjs-core';
|
|
2
|
+
import { type IModuleEventsConfig } from '@flusys/nestjs-shared/interfaces';
|
|
3
|
+
import { type ModuleMetadata, type Type } from '@nestjs/common';
|
|
4
4
|
export interface INotificationModuleConfig extends IDataSourceServiceOptions {
|
|
5
5
|
jwtSecret?: string;
|
|
6
6
|
events?: IModuleEventsConfig;
|
package/modules/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './notification.module';
|
|
1
|
+
export * from './notification.module.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DynamicModule } from '@nestjs/common';
|
|
2
|
-
import { NotificationModuleAsyncOptions, NotificationModuleOptions } from '../interfaces';
|
|
1
|
+
import { type DynamicModule } from '@nestjs/common';
|
|
2
|
+
import { type NotificationModuleAsyncOptions, type NotificationModuleOptions } from '../interfaces/index.js';
|
|
3
3
|
export declare class NotificationModule {
|
|
4
4
|
static forRoot(options: NotificationModuleOptions): DynamicModule;
|
|
5
5
|
static forRootAsync(options: NotificationModuleAsyncOptions): DynamicModule;
|
package/package.json
CHANGED
|
@@ -1,91 +1,80 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flusys/nestjs-notification",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"description": "Notification module with real-time Socket.IO support",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./fesm/index.js",
|
|
7
|
+
"module": "./fesm/index.js",
|
|
8
|
+
"types": "./index.d.ts",
|
|
8
9
|
"sideEffects": false,
|
|
9
10
|
"keywords": [
|
|
10
11
|
"nestjs",
|
|
12
|
+
"@flusys",
|
|
11
13
|
"notification",
|
|
12
14
|
"socket.io",
|
|
13
|
-
"real-time"
|
|
14
|
-
"@flusys"
|
|
15
|
+
"real-time"
|
|
15
16
|
],
|
|
16
17
|
"license": "UNLICENSED",
|
|
17
18
|
"exports": {
|
|
18
19
|
".": {
|
|
19
20
|
"types": "./index.d.ts",
|
|
20
|
-
"import": "./fesm/index.js"
|
|
21
|
-
|
|
21
|
+
"import": "./fesm/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./adapters": {
|
|
24
|
+
"types": "./adapters/index.d.ts",
|
|
25
|
+
"import": "./fesm/adapters/index.js"
|
|
22
26
|
},
|
|
23
27
|
"./config": {
|
|
24
28
|
"types": "./config/index.d.ts",
|
|
25
|
-
"import": "./fesm/config/index.js"
|
|
26
|
-
"require": "./cjs/config/index.js"
|
|
29
|
+
"import": "./fesm/config/index.js"
|
|
27
30
|
},
|
|
28
31
|
"./controllers": {
|
|
29
32
|
"types": "./controllers/index.d.ts",
|
|
30
|
-
"import": "./fesm/controllers/index.js"
|
|
31
|
-
"require": "./cjs/controllers/index.js"
|
|
33
|
+
"import": "./fesm/controllers/index.js"
|
|
32
34
|
},
|
|
33
35
|
"./docs": {
|
|
34
36
|
"types": "./docs/index.d.ts",
|
|
35
|
-
"import": "./fesm/docs/index.js"
|
|
36
|
-
"require": "./cjs/docs/index.js"
|
|
37
|
+
"import": "./fesm/docs/index.js"
|
|
37
38
|
},
|
|
38
39
|
"./dtos": {
|
|
39
40
|
"types": "./dtos/index.d.ts",
|
|
40
|
-
"import": "./fesm/dtos/index.js"
|
|
41
|
-
"require": "./cjs/dtos/index.js"
|
|
41
|
+
"import": "./fesm/dtos/index.js"
|
|
42
42
|
},
|
|
43
43
|
"./entities": {
|
|
44
44
|
"types": "./entities/index.d.ts",
|
|
45
|
-
"import": "./fesm/entities/index.js"
|
|
46
|
-
"require": "./cjs/entities/index.js"
|
|
47
|
-
},
|
|
48
|
-
"./enums": {
|
|
49
|
-
"types": "./enums/index.d.ts",
|
|
50
|
-
"import": "./fesm/enums/index.js",
|
|
51
|
-
"require": "./cjs/enums/index.js"
|
|
45
|
+
"import": "./fesm/entities/index.js"
|
|
52
46
|
},
|
|
53
47
|
"./gateways": {
|
|
54
48
|
"types": "./gateways/index.d.ts",
|
|
55
|
-
"import": "./fesm/gateways/index.js"
|
|
56
|
-
"require": "./cjs/gateways/index.js"
|
|
49
|
+
"import": "./fesm/gateways/index.js"
|
|
57
50
|
},
|
|
58
51
|
"./interfaces": {
|
|
59
52
|
"types": "./interfaces/index.d.ts",
|
|
60
|
-
"import": "./fesm/interfaces/index.js"
|
|
61
|
-
"require": "./cjs/interfaces/index.js"
|
|
53
|
+
"import": "./fesm/interfaces/index.js"
|
|
62
54
|
},
|
|
63
55
|
"./modules": {
|
|
64
56
|
"types": "./modules/index.d.ts",
|
|
65
|
-
"import": "./fesm/modules/index.js"
|
|
66
|
-
"require": "./cjs/modules/index.js"
|
|
57
|
+
"import": "./fesm/modules/index.js"
|
|
67
58
|
},
|
|
68
59
|
"./services": {
|
|
69
60
|
"types": "./services/index.d.ts",
|
|
70
|
-
"import": "./fesm/services/index.js"
|
|
71
|
-
"require": "./cjs/services/index.js"
|
|
61
|
+
"import": "./fesm/services/index.js"
|
|
72
62
|
},
|
|
73
63
|
"./*": {
|
|
74
64
|
"types": "./*.d.ts",
|
|
75
|
-
"import": "
|
|
76
|
-
"require": "./*.js"
|
|
65
|
+
"import": "./fesm/*.js"
|
|
77
66
|
}
|
|
78
67
|
},
|
|
79
68
|
"peerDependencies": {
|
|
80
|
-
"@nestjs/common": "^
|
|
81
|
-
"@nestjs/config": "^
|
|
82
|
-
"@nestjs/core": "^
|
|
83
|
-
"@nestjs/jwt": "^
|
|
84
|
-
"@nestjs/platform-express": "^
|
|
85
|
-
"@nestjs/swagger": "^
|
|
86
|
-
"@nestjs/typeorm": "^
|
|
87
|
-
"@nestjs/websockets": "^
|
|
88
|
-
"@nestjs/platform-socket.io": "^
|
|
69
|
+
"@nestjs/common": "^12.0.0",
|
|
70
|
+
"@nestjs/config": "^12.0.0",
|
|
71
|
+
"@nestjs/core": "^12.0.0",
|
|
72
|
+
"@nestjs/jwt": "^12.0.0",
|
|
73
|
+
"@nestjs/platform-express": "^12.0.0",
|
|
74
|
+
"@nestjs/swagger": "^12.0.0",
|
|
75
|
+
"@nestjs/typeorm": "^12.0.0",
|
|
76
|
+
"@nestjs/websockets": "^12.0.0",
|
|
77
|
+
"@nestjs/platform-socket.io": "^12.0.0",
|
|
89
78
|
"class-transformer": "^0.5.1",
|
|
90
79
|
"class-validator": "^0.15.0",
|
|
91
80
|
"socket.io": "^4.8.0",
|
|
@@ -93,7 +82,7 @@
|
|
|
93
82
|
"express": "^5.0.0"
|
|
94
83
|
},
|
|
95
84
|
"dependencies": {
|
|
96
|
-
"@flusys/nestjs-core": "
|
|
97
|
-
"@flusys/nestjs-shared": "
|
|
85
|
+
"@flusys/nestjs-core": "8.0.0",
|
|
86
|
+
"@flusys/nestjs-shared": "8.0.0"
|
|
98
87
|
}
|
|
99
88
|
}
|
package/services/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './notification-config.service';
|
|
2
|
-
export * from './notification-datasource.provider';
|
|
3
|
-
export * from './notification.service';
|
|
4
|
-
export * from './notification-helper.service';
|
|
1
|
+
export * from './notification-config.service.js';
|
|
2
|
+
export * from './notification-datasource.provider.js';
|
|
3
|
+
export * from './notification.service.js';
|
|
4
|
+
export * from './notification-helper.service.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DatabaseMode } from '@flusys/nestjs-core';
|
|
2
|
-
import { IModuleConfigService } from '@flusys/nestjs-shared/interfaces';
|
|
3
|
-
import { NotificationModuleOptions } from '../interfaces';
|
|
1
|
+
import { type DatabaseMode } from '@flusys/nestjs-core';
|
|
2
|
+
import { type IModuleConfigService } from '@flusys/nestjs-shared/interfaces';
|
|
3
|
+
import { type NotificationModuleOptions } from '../interfaces/index.js';
|
|
4
4
|
export declare class NotificationConfigService implements IModuleConfigService {
|
|
5
5
|
private readonly options;
|
|
6
6
|
constructor(options: NotificationModuleOptions);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { MultiTenantDataSourceService } from '@flusys/nestjs-shared/modules';
|
|
2
|
-
import { IDatabaseConfig, ITenantDatabaseConfig } from '@flusys/nestjs-core';
|
|
3
|
-
import { Request } from 'express';
|
|
2
|
+
import { type IDatabaseConfig, type ITenantDatabaseConfig } from '@flusys/nestjs-core';
|
|
3
|
+
import { type Request } from 'express';
|
|
4
4
|
import { DataSource } from 'typeorm';
|
|
5
|
-
import { NotificationConfigService } from './notification-config.service';
|
|
5
|
+
import { NotificationConfigService } from './notification-config.service.js';
|
|
6
6
|
export declare class NotificationDataSourceProvider extends MultiTenantDataSourceService {
|
|
7
7
|
private readonly configService;
|
|
8
8
|
protected static readonly tenantConnections: Map<string, DataSource>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { INotificationBulkSendOptions, INotificationSendOptions } from '@flusys/nestjs-shared';
|
|
1
|
+
import { type INotificationBulkSendOptions, type INotificationSendOptions } from '@flusys/nestjs-shared';
|
|
2
2
|
import { HybridCache } from '@flusys/nestjs-shared/classes';
|
|
3
3
|
import { UtilsService } from '@flusys/nestjs-shared/modules';
|
|
4
|
-
import { NotificationBase } from '../entities';
|
|
5
|
-
import { NotificationGateway } from '../gateways';
|
|
6
|
-
import { NotificationConfigService } from './notification-config.service';
|
|
7
|
-
import { NotificationDataSourceProvider } from './notification-datasource.provider';
|
|
4
|
+
import { NotificationBase } from '../entities/index.js';
|
|
5
|
+
import { NotificationGateway } from '../gateways/index.js';
|
|
6
|
+
import { NotificationConfigService } from './notification-config.service.js';
|
|
7
|
+
import { NotificationDataSourceProvider } from './notification-datasource.provider.js';
|
|
8
8
|
export declare class NotificationHelperService {
|
|
9
9
|
private readonly cacheManager;
|
|
10
10
|
private readonly utilsService;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ApiService, HybridCache } from '@flusys/nestjs-shared/classes';
|
|
2
|
-
import { ILoggedUserInfo } from '@flusys/nestjs-shared/interfaces';
|
|
2
|
+
import { type ILoggedUserInfo } from '@flusys/nestjs-shared/interfaces';
|
|
3
3
|
import { UtilsService } from '@flusys/nestjs-shared/modules';
|
|
4
|
-
import { QueryRunner, SelectQueryBuilder } from 'typeorm';
|
|
5
|
-
import { CreateNotificationDto, UpdateNotificationDto } from '../dtos';
|
|
6
|
-
import { NotificationBase } from '../entities';
|
|
7
|
-
import { NotificationGateway } from '../gateways';
|
|
8
|
-
import { INotification } from '../interfaces';
|
|
9
|
-
import { NotificationConfigService } from './notification-config.service';
|
|
10
|
-
import { NotificationDataSourceProvider } from './notification-datasource.provider';
|
|
4
|
+
import { type QueryRunner, SelectQueryBuilder } from 'typeorm';
|
|
5
|
+
import { CreateNotificationDto, UpdateNotificationDto } from '../dtos/index.js';
|
|
6
|
+
import { NotificationBase } from '../entities/index.js';
|
|
7
|
+
import { NotificationGateway } from '../gateways/index.js';
|
|
8
|
+
import { type INotification } from '../interfaces/index.js';
|
|
9
|
+
import { NotificationConfigService } from './notification-config.service.js';
|
|
10
|
+
import { NotificationDataSourceProvider } from './notification-datasource.provider.js';
|
|
11
11
|
export declare class NotificationService extends ApiService<CreateNotificationDto, UpdateNotificationDto, INotification, NotificationBase> {
|
|
12
12
|
protected cacheManager: HybridCache;
|
|
13
13
|
protected utilsService: UtilsService;
|