@flusys/nestjs-notification 8.1.4 → 9.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/README.md +6 -4
- package/adapters/notification.adapter.d.ts +6 -3
- package/fesm/244.js +65 -50
- package/fesm/446.js +43 -58
- package/fesm/adapters/index.js +24 -8
- package/fesm/gateways/index.js +13 -6
- package/fesm/index.js +29 -13
- package/fesm/modules/index.js +28 -12
- package/fesm/services/index.js +42 -57
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -33,7 +33,6 @@ import { NotificationModule } from '@flusys/nestjs-notification';
|
|
|
33
33
|
enableCompanyFeature: false,
|
|
34
34
|
},
|
|
35
35
|
config: {
|
|
36
|
-
enableRealtime: true, // false = no Socket.IO gateway registered
|
|
37
36
|
jwtSecret: process.env.JWT_SECRET, // required for WebSocket auth
|
|
38
37
|
defaultDatabaseConfig: {
|
|
39
38
|
type: 'mysql',
|
|
@@ -50,6 +49,8 @@ import { NotificationModule } from '@flusys/nestjs-notification';
|
|
|
50
49
|
export class AppModule {}
|
|
51
50
|
```
|
|
52
51
|
|
|
52
|
+
The Socket.IO gateway is always registered. Real-time delivery is chosen per send: pass `realtime: false` to store a notification without pushing it.
|
|
53
|
+
|
|
53
54
|
#### Mode 2: Multi-Tenant
|
|
54
55
|
|
|
55
56
|
```typescript
|
|
@@ -61,7 +62,6 @@ NotificationModule.forRoot({
|
|
|
61
62
|
enableCompanyFeature: true,
|
|
62
63
|
},
|
|
63
64
|
config: {
|
|
64
|
-
enableRealtime: true,
|
|
65
65
|
jwtSecret: process.env.JWT_SECRET,
|
|
66
66
|
tenantDefaultDatabaseConfig: {
|
|
67
67
|
type: 'mysql',
|
|
@@ -95,7 +95,6 @@ NotificationModule.forRootAsync({
|
|
|
95
95
|
},
|
|
96
96
|
imports: [ConfigModule],
|
|
97
97
|
useFactory: (config: ConfigService) => ({
|
|
98
|
-
enableRealtime: true,
|
|
99
98
|
jwtSecret: config.get('JWT_SECRET'),
|
|
100
99
|
defaultDatabaseConfig: {
|
|
101
100
|
type: 'mysql',
|
|
@@ -119,7 +118,6 @@ NotificationModule.forRootAsync({
|
|
|
119
118
|
},
|
|
120
119
|
imports: [ConfigModule],
|
|
121
120
|
useFactory: (config: ConfigService) => ({
|
|
122
|
-
enableRealtime: true,
|
|
123
121
|
jwtSecret: config.get('JWT_SECRET'),
|
|
124
122
|
tenantDefaultDatabaseConfig: {
|
|
125
123
|
type: 'mysql',
|
|
@@ -199,6 +197,10 @@ export class OrderService {
|
|
|
199
197
|
}
|
|
200
198
|
```
|
|
201
199
|
|
|
200
|
+
### From other packages (`NOTIFICATION_ADAPTER`)
|
|
201
|
+
|
|
202
|
+
`NotificationModule` provides and exports `NOTIFICATION_ADAPTER` (`nestjs-shared`), implemented by `NotificationAdapter`: `send({ userId, ...content })`, `sendToMany({ userIds, ...content })` and `isUserOnline(userId)`. It is a singleton: it resolves the request-scoped `NotificationHelperService` (tenant datasource) per call and asks the gateway who is online, so a singleton that injects the token stays one. A feature package injects it `@Optional()` and never imports this package (auth's login notice and the entity builder's **Send notification** flow step use it).
|
|
203
|
+
|
|
202
204
|
## License
|
|
203
205
|
|
|
204
206
|
MIT © FLUSYS
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { type INotificationAdapter, type INotificationBulkSendOptions, type INotificationSendOptions } from '@flusys/nestjs-shared';
|
|
2
|
-
import {
|
|
2
|
+
import { ModuleRef } from '@nestjs/core';
|
|
3
|
+
import { NotificationGateway } from '../gateways/notification.gateway.js';
|
|
3
4
|
export declare class NotificationAdapter implements INotificationAdapter {
|
|
4
|
-
private readonly
|
|
5
|
-
|
|
5
|
+
private readonly moduleRef;
|
|
6
|
+
private readonly gateway?;
|
|
7
|
+
constructor(moduleRef: ModuleRef, gateway?: NotificationGateway | undefined);
|
|
6
8
|
send(options: INotificationSendOptions): Promise<void>;
|
|
7
9
|
sendToMany(options: INotificationBulkSendOptions): Promise<void>;
|
|
8
10
|
isUserOnline(userId: string): boolean;
|
|
11
|
+
private helper;
|
|
9
12
|
}
|
package/fesm/244.js
CHANGED
|
@@ -7,9 +7,10 @@ import * as __rspack_external__flusys_nestjs_shared_393d2cae from "@flusys/nestj
|
|
|
7
7
|
import * as __rspack_external__flusys_nestjs_shared_classes_6076a329 from "@flusys/nestjs-shared/classes";
|
|
8
8
|
import * as __rspack_external__flusys_nestjs_shared_enums_327421f8 from "@flusys/nestjs-shared/enums";
|
|
9
9
|
import * as __rspack_external__flusys_nestjs_shared_modules_24702bee from "@flusys/nestjs-shared/modules";
|
|
10
|
+
import * as __rspack_external__flusys_nestjs_shared_utils_9125c1f1 from "@flusys/nestjs-shared/utils";
|
|
10
11
|
import * as __rspack_external__nestjs_common_a04939da from "@nestjs/common";
|
|
11
|
-
import * as __rspack_external__nestjs_jwt_50c0e0ae from "@nestjs/jwt";
|
|
12
12
|
import * as __rspack_external__nestjs_core_d7b00a1a from "@nestjs/core";
|
|
13
|
+
import * as __rspack_external__nestjs_jwt_50c0e0ae from "@nestjs/jwt";
|
|
13
14
|
export const __rspack_esm_id = 244;
|
|
14
15
|
export const __rspack_esm_ids = [244];
|
|
15
16
|
export const __webpack_modules__ = {
|
|
@@ -231,11 +232,21 @@ function getNotificationEntitiesByConfig(enableCompanyFeature) {
|
|
|
231
232
|
|
|
232
233
|
|
|
233
234
|
},
|
|
234
|
-
|
|
235
|
+
267(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
236
|
+
/* import */ var _notification_gateway_js__rspack_import_0 = __webpack_require__(864);
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
240
|
+
g: () => (/* reexport safe */ _notification_gateway_js__rspack_import_0.g)
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
},
|
|
245
|
+
864(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
235
246
|
|
|
236
247
|
// EXPORTS
|
|
237
248
|
__webpack_require__.d(__webpack_exports__, {
|
|
238
|
-
g: () => (/*
|
|
249
|
+
g: () => (/* binding */ NotificationGateway)
|
|
239
250
|
});
|
|
240
251
|
|
|
241
252
|
;// CONCATENATED MODULE: external "@flusys/nestjs-core/config"
|
|
@@ -410,9 +421,6 @@ NotificationGateway = _ts_decorate([
|
|
|
410
421
|
])
|
|
411
422
|
], NotificationGateway);
|
|
412
423
|
|
|
413
|
-
;// CONCATENATED MODULE: ./projects/nestjs-notification/src/gateways/index.ts
|
|
414
|
-
|
|
415
|
-
|
|
416
424
|
|
|
417
425
|
},
|
|
418
426
|
53(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
@@ -479,22 +487,11 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
479
487
|
|
|
480
488
|
|
|
481
489
|
},
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
__webpack_require__
|
|
486
|
-
|
|
487
|
-
});
|
|
488
|
-
|
|
489
|
-
// EXTERNAL MODULE: external "@flusys/nestjs-shared/modules"
|
|
490
|
-
var modules_ = __webpack_require__(236);
|
|
491
|
-
// EXTERNAL MODULE: external "@nestjs/common"
|
|
492
|
-
var common_ = __webpack_require__(157);
|
|
493
|
-
;// CONCATENATED MODULE: external "@nestjs/core"
|
|
494
|
-
|
|
495
|
-
// EXTERNAL MODULE: ./projects/nestjs-notification/src/services/notification-config.service.ts
|
|
496
|
-
var notification_config_service = __webpack_require__(53);
|
|
497
|
-
;// CONCATENATED MODULE: ./projects/nestjs-notification/src/services/notification-datasource.provider.ts
|
|
490
|
+
500(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
491
|
+
/* import */ var _flusys_nestjs_shared_modules__rspack_import_0 = __webpack_require__(236);
|
|
492
|
+
/* import */ var _nestjs_common__rspack_import_1 = __webpack_require__(157);
|
|
493
|
+
/* import */ var _nestjs_core__rspack_import_2 = __webpack_require__(75);
|
|
494
|
+
/* import */ var _notification_config_service_js__rspack_import_3 = __webpack_require__(53);
|
|
498
495
|
function _ts_decorate(decorators, target, key, desc) {
|
|
499
496
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
500
497
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
@@ -522,7 +519,7 @@ function _ts_param(paramIndex, decorator) {
|
|
|
522
519
|
|
|
523
520
|
|
|
524
521
|
|
|
525
|
-
class NotificationDataSourceProvider extends
|
|
522
|
+
class NotificationDataSourceProvider extends _flusys_nestjs_shared_modules__rspack_import_0.MultiTenantDataSourceService {
|
|
526
523
|
configService;
|
|
527
524
|
static tenantConnections = new Map();
|
|
528
525
|
static singleDataSource = null;
|
|
@@ -561,19 +558,23 @@ class NotificationDataSourceProvider extends modules_.MultiTenantDataSourceServi
|
|
|
561
558
|
}
|
|
562
559
|
}
|
|
563
560
|
NotificationDataSourceProvider = _ts_decorate([
|
|
564
|
-
(0,
|
|
565
|
-
scope:
|
|
561
|
+
(0,_nestjs_common__rspack_import_1.Injectable)({
|
|
562
|
+
scope: _nestjs_common__rspack_import_1.Scope.REQUEST
|
|
566
563
|
}),
|
|
567
|
-
_ts_param(0, (0,
|
|
568
|
-
_ts_param(1, (0,
|
|
569
|
-
_ts_param(1, (0,
|
|
564
|
+
_ts_param(0, (0,_nestjs_common__rspack_import_1.Inject)(_notification_config_service_js__rspack_import_3/* .NotificationConfigService */.v)),
|
|
565
|
+
_ts_param(1, (0,_nestjs_common__rspack_import_1.Optional)()),
|
|
566
|
+
_ts_param(1, (0,_nestjs_common__rspack_import_1.Inject)(_nestjs_core__rspack_import_2.REQUEST)),
|
|
570
567
|
_ts_metadata("design:type", Function),
|
|
571
568
|
_ts_metadata("design:paramtypes", [
|
|
572
|
-
typeof
|
|
569
|
+
typeof _notification_config_service_js__rspack_import_3/* .NotificationConfigService */.v === "undefined" ? Object : _notification_config_service_js__rspack_import_3/* .NotificationConfigService */.v,
|
|
573
570
|
typeof Request === "undefined" ? Object : Request
|
|
574
571
|
])
|
|
575
572
|
], NotificationDataSourceProvider);
|
|
576
573
|
|
|
574
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
575
|
+
M: () => (NotificationDataSourceProvider)
|
|
576
|
+
});
|
|
577
|
+
|
|
577
578
|
|
|
578
579
|
},
|
|
579
580
|
487(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
@@ -581,12 +582,13 @@ NotificationDataSourceProvider = _ts_decorate([
|
|
|
581
582
|
/* import */ var _flusys_nestjs_shared_classes__rspack_import_1 = __webpack_require__(937);
|
|
582
583
|
/* import */ var _flusys_nestjs_shared_enums__rspack_import_2 = __webpack_require__(471);
|
|
583
584
|
/* import */ var _flusys_nestjs_shared_modules__rspack_import_3 = __webpack_require__(236);
|
|
584
|
-
/* import */ var
|
|
585
|
-
/* import */ var
|
|
586
|
-
/* import */ var
|
|
587
|
-
/* import */ var
|
|
588
|
-
/* import */ var
|
|
589
|
-
/* import */ var
|
|
585
|
+
/* import */ var _flusys_nestjs_shared_utils__rspack_import_4 = __webpack_require__(216);
|
|
586
|
+
/* import */ var _nestjs_common__rspack_import_5 = __webpack_require__(157);
|
|
587
|
+
/* import */ var _config_index_js__rspack_import_10 = __webpack_require__(360);
|
|
588
|
+
/* import */ var _entities_index_js__rspack_import_6 = __webpack_require__(240);
|
|
589
|
+
/* import */ var _gateways_index_js__rspack_import_7 = __webpack_require__(267);
|
|
590
|
+
/* import */ var _notification_config_service_js__rspack_import_8 = __webpack_require__(53);
|
|
591
|
+
/* import */ var _notification_datasource_provider_js__rspack_import_9 = __webpack_require__(500);
|
|
590
592
|
function _ts_decorate(decorators, target, key, desc) {
|
|
591
593
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
592
594
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
@@ -620,6 +622,7 @@ function _ts_param(paramIndex, decorator) {
|
|
|
620
622
|
|
|
621
623
|
|
|
622
624
|
|
|
625
|
+
|
|
623
626
|
class NotificationHelperService {
|
|
624
627
|
cacheManager;
|
|
625
628
|
utilsService;
|
|
@@ -670,9 +673,9 @@ class NotificationHelperService {
|
|
|
670
673
|
}
|
|
671
674
|
async publishSentEvent(notifications, userIds) {
|
|
672
675
|
await (0,_flusys_nestjs_shared_classes__rspack_import_1.publishDomainEvent)({
|
|
673
|
-
module:
|
|
674
|
-
entity:
|
|
675
|
-
action:
|
|
676
|
+
module: _config_index_js__rspack_import_10/* .NOTIFICATION_EVENT_MODULE */.Wx,
|
|
677
|
+
entity: _config_index_js__rspack_import_10/* .NOTIFICATION_EVENT_ENTITIES.NOTIFICATION */.BA.NOTIFICATION,
|
|
678
|
+
action: _config_index_js__rspack_import_10/* .NOTIFICATION_EVENT_ACTIONS.SENT */.R.SENT,
|
|
676
679
|
ids: notifications.map((notification)=>notification.id),
|
|
677
680
|
metadata: {
|
|
678
681
|
recipientCount: userIds.length
|
|
@@ -687,7 +690,7 @@ class NotificationHelperService {
|
|
|
687
690
|
}
|
|
688
691
|
async getRepository() {
|
|
689
692
|
const ds = await this.getDataSource();
|
|
690
|
-
const EntityClass = this.configService.isCompanyFeatureEnabled() ?
|
|
693
|
+
const EntityClass = this.configService.isCompanyFeatureEnabled() ? _entities_index_js__rspack_import_6.NotificationWithCompany : _entities_index_js__rspack_import_6.Notification;
|
|
691
694
|
return ds.getRepository(EntityClass);
|
|
692
695
|
}
|
|
693
696
|
buildEntity(userId, content) {
|
|
@@ -727,7 +730,7 @@ class NotificationHelperService {
|
|
|
727
730
|
};
|
|
728
731
|
}
|
|
729
732
|
async clearCache() {
|
|
730
|
-
await this.utilsService.clearCache(
|
|
733
|
+
await this.utilsService.clearCache(_config_index_js__rspack_import_10/* .NOTIFICATION_EVENT_ENTITIES.NOTIFICATION */.BA.NOTIFICATION, this.cacheManager, undefined, (0,_flusys_nestjs_shared_utils__rspack_import_4.cacheTenantId)(this.dataSourceProvider));
|
|
731
734
|
}
|
|
732
735
|
}
|
|
733
736
|
_ts_decorate([
|
|
@@ -753,20 +756,20 @@ _ts_decorate([
|
|
|
753
756
|
_ts_metadata("design:returntype", Promise)
|
|
754
757
|
], NotificationHelperService.prototype, "sendToMany", null);
|
|
755
758
|
NotificationHelperService = _ts_decorate([
|
|
756
|
-
(0,
|
|
757
|
-
_ts_param(0, (0,
|
|
758
|
-
_ts_param(1, (0,
|
|
759
|
-
_ts_param(2, (0,
|
|
760
|
-
_ts_param(3, (0,
|
|
761
|
-
_ts_param(4, (0,
|
|
762
|
-
_ts_param(4, (0,
|
|
759
|
+
(0,_nestjs_common__rspack_import_5.Injectable)(),
|
|
760
|
+
_ts_param(0, (0,_nestjs_common__rspack_import_5.Inject)('CACHE_INSTANCE')),
|
|
761
|
+
_ts_param(1, (0,_nestjs_common__rspack_import_5.Inject)(_flusys_nestjs_shared_modules__rspack_import_3.UtilsService)),
|
|
762
|
+
_ts_param(2, (0,_nestjs_common__rspack_import_5.Inject)(_notification_config_service_js__rspack_import_8/* .NotificationConfigService */.v)),
|
|
763
|
+
_ts_param(3, (0,_nestjs_common__rspack_import_5.Inject)(_notification_datasource_provider_js__rspack_import_9/* .NotificationDataSourceProvider */.M)),
|
|
764
|
+
_ts_param(4, (0,_nestjs_common__rspack_import_5.Optional)()),
|
|
765
|
+
_ts_param(4, (0,_nestjs_common__rspack_import_5.Inject)(_gateways_index_js__rspack_import_7/* .NotificationGateway */.g)),
|
|
763
766
|
_ts_metadata("design:type", Function),
|
|
764
767
|
_ts_metadata("design:paramtypes", [
|
|
765
768
|
typeof _flusys_nestjs_shared_classes__rspack_import_1.HybridCache === "undefined" ? Object : _flusys_nestjs_shared_classes__rspack_import_1.HybridCache,
|
|
766
769
|
typeof _flusys_nestjs_shared_modules__rspack_import_3.UtilsService === "undefined" ? Object : _flusys_nestjs_shared_modules__rspack_import_3.UtilsService,
|
|
767
|
-
typeof
|
|
768
|
-
typeof
|
|
769
|
-
typeof
|
|
770
|
+
typeof _notification_config_service_js__rspack_import_8/* .NotificationConfigService */.v === "undefined" ? Object : _notification_config_service_js__rspack_import_8/* .NotificationConfigService */.v,
|
|
771
|
+
typeof _notification_datasource_provider_js__rspack_import_9/* .NotificationDataSourceProvider */.M === "undefined" ? Object : _notification_datasource_provider_js__rspack_import_9/* .NotificationDataSourceProvider */.M,
|
|
772
|
+
typeof _gateways_index_js__rspack_import_7/* .NotificationGateway */.g === "undefined" ? Object : _gateways_index_js__rspack_import_7/* .NotificationGateway */.g
|
|
770
773
|
])
|
|
771
774
|
], NotificationHelperService);
|
|
772
775
|
|
|
@@ -799,12 +802,24 @@ module.exports = __rspack_external__flusys_nestjs_shared_enums_327421f8;
|
|
|
799
802
|
module.exports = __rspack_external__flusys_nestjs_shared_modules_24702bee;
|
|
800
803
|
|
|
801
804
|
|
|
805
|
+
},
|
|
806
|
+
216(module) {
|
|
807
|
+
|
|
808
|
+
module.exports = __rspack_external__flusys_nestjs_shared_utils_9125c1f1;
|
|
809
|
+
|
|
810
|
+
|
|
802
811
|
},
|
|
803
812
|
157(module) {
|
|
804
813
|
|
|
805
814
|
module.exports = __rspack_external__nestjs_common_a04939da;
|
|
806
815
|
|
|
807
816
|
|
|
817
|
+
},
|
|
818
|
+
75(module) {
|
|
819
|
+
|
|
820
|
+
module.exports = __rspack_external__nestjs_core_d7b00a1a;
|
|
821
|
+
|
|
822
|
+
|
|
808
823
|
},
|
|
809
824
|
125(module) {
|
|
810
825
|
|
package/fesm/446.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { IsEnum, IsNotEmpty, IsObject, IsOptional, IsString, IsUUID, MaxLength } from "class-validator";
|
|
2
|
-
import { applyCompanyFilter } from "@flusys/nestjs-shared/utils";
|
|
3
2
|
import * as __rspack_external__nestjs_swagger_7cd450b5 from "@nestjs/swagger";
|
|
4
3
|
import * as __rspack_external_class_transformer_c5a479fb from "class-transformer";
|
|
5
4
|
import * as __rspack_external__flusys_nestjs_shared_decorators_c129b601 from "@flusys/nestjs-shared/decorators";
|
|
@@ -53,8 +52,8 @@ var message_keys = __webpack_require__(158);
|
|
|
53
52
|
var dtos = __webpack_require__(733);
|
|
54
53
|
// EXTERNAL MODULE: ./projects/nestjs-notification/src/services/notification-helper.service.ts
|
|
55
54
|
var notification_helper_service = __webpack_require__(487);
|
|
56
|
-
// EXTERNAL MODULE: ./projects/nestjs-notification/src/services/notification.service.ts
|
|
57
|
-
var notification_service = __webpack_require__(
|
|
55
|
+
// EXTERNAL MODULE: ./projects/nestjs-notification/src/services/notification.service.ts
|
|
56
|
+
var notification_service = __webpack_require__(692);
|
|
58
57
|
;// CONCATENATED MODULE: ./projects/nestjs-notification/src/controllers/notification.controller.ts
|
|
59
58
|
function _ts_decorate(decorators, target, key, desc) {
|
|
60
59
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -620,36 +619,18 @@ class SendBulkNotificationDto extends (0,swagger_.IntersectionType)(UserIdsDto,
|
|
|
620
619
|
|
|
621
620
|
|
|
622
621
|
},
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
__webpack_require__
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
var
|
|
632
|
-
|
|
633
|
-
var
|
|
634
|
-
|
|
635
|
-
var modules_ = __webpack_require__(236);
|
|
636
|
-
;// CONCATENATED MODULE: external "@flusys/nestjs-shared/utils"
|
|
637
|
-
|
|
638
|
-
// EXTERNAL MODULE: external "@nestjs/common"
|
|
639
|
-
var common_ = __webpack_require__(157);
|
|
640
|
-
// EXTERNAL MODULE: ./projects/nestjs-notification/src/config/event-actions.ts
|
|
641
|
-
var event_actions = __webpack_require__(360);
|
|
642
|
-
// EXTERNAL MODULE: ./projects/nestjs-notification/src/config/message-keys.ts
|
|
643
|
-
var message_keys = __webpack_require__(158);
|
|
644
|
-
// EXTERNAL MODULE: ./projects/nestjs-notification/src/entities/index.ts + 4 modules
|
|
645
|
-
var src_entities = __webpack_require__(240);
|
|
646
|
-
// EXTERNAL MODULE: ./projects/nestjs-notification/src/gateways/index.ts + 4 modules
|
|
647
|
-
var gateways = __webpack_require__(31);
|
|
648
|
-
// EXTERNAL MODULE: ./projects/nestjs-notification/src/services/notification-config.service.ts
|
|
649
|
-
var notification_config_service = __webpack_require__(53);
|
|
650
|
-
// EXTERNAL MODULE: ./projects/nestjs-notification/src/services/notification-datasource.provider.ts + 1 modules
|
|
651
|
-
var notification_datasource_provider = __webpack_require__(335);
|
|
652
|
-
;// CONCATENATED MODULE: ./projects/nestjs-notification/src/services/notification.service.ts
|
|
622
|
+
692(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
623
|
+
/* import */ var _flusys_nestjs_shared__rspack_import_0 = __webpack_require__(422);
|
|
624
|
+
/* import */ var _flusys_nestjs_shared_classes__rspack_import_1 = __webpack_require__(937);
|
|
625
|
+
/* import */ var _flusys_nestjs_shared_modules__rspack_import_2 = __webpack_require__(236);
|
|
626
|
+
/* import */ var _flusys_nestjs_shared_utils__rspack_import_3 = __webpack_require__(216);
|
|
627
|
+
/* import */ var _nestjs_common__rspack_import_4 = __webpack_require__(157);
|
|
628
|
+
/* import */ var _config_index_js__rspack_import_9 = __webpack_require__(360);
|
|
629
|
+
/* import */ var _config_index_js__rspack_import_10 = __webpack_require__(158);
|
|
630
|
+
/* import */ var _entities_index_js__rspack_import_5 = __webpack_require__(240);
|
|
631
|
+
/* import */ var _gateways_index_js__rspack_import_6 = __webpack_require__(267);
|
|
632
|
+
/* import */ var _notification_config_service_js__rspack_import_7 = __webpack_require__(53);
|
|
633
|
+
/* import */ var _notification_datasource_provider_js__rspack_import_8 = __webpack_require__(500);
|
|
653
634
|
function _ts_decorate(decorators, target, key, desc) {
|
|
654
635
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
655
636
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
@@ -683,13 +664,13 @@ function _ts_param(paramIndex, decorator) {
|
|
|
683
664
|
|
|
684
665
|
|
|
685
666
|
|
|
686
|
-
class NotificationService extends
|
|
667
|
+
class NotificationService extends _flusys_nestjs_shared_classes__rspack_import_1.ApiService {
|
|
687
668
|
cacheManager;
|
|
688
669
|
utilsService;
|
|
689
670
|
notificationConfig;
|
|
690
671
|
gateway;
|
|
691
672
|
constructor(cacheManager, utilsService, notificationConfig, dataSourceProvider, gateway){
|
|
692
|
-
super(
|
|
673
|
+
super(_config_index_js__rspack_import_9/* .NOTIFICATION_EVENT_ENTITIES.NOTIFICATION */.BA.NOTIFICATION, cacheManager, utilsService, NotificationService.name, false, _config_index_js__rspack_import_9/* .NOTIFICATION_EVENT_MODULE */.Wx, dataSourceProvider, notificationConfig.isCompanyFeatureEnabled() ? _entities_index_js__rspack_import_5.NotificationWithCompany : _entities_index_js__rspack_import_5.Notification), this.cacheManager = cacheManager, this.utilsService = utilsService, this.notificationConfig = notificationConfig, this.gateway = gateway;
|
|
693
674
|
}
|
|
694
675
|
async convertSingleDtoToEntity(dto, user) {
|
|
695
676
|
let entity = {};
|
|
@@ -700,9 +681,9 @@ class NotificationService extends classes_.ApiService {
|
|
|
700
681
|
}
|
|
701
682
|
});
|
|
702
683
|
if (!existing) {
|
|
703
|
-
throw new
|
|
684
|
+
throw new _nestjs_common__rspack_import_4.NotFoundException({
|
|
704
685
|
message: 'Notification not found',
|
|
705
|
-
messageKey:
|
|
686
|
+
messageKey: _config_index_js__rspack_import_10/* .NOTIFICATION_MESSAGES.NOT_FOUND */.x.NOT_FOUND
|
|
706
687
|
});
|
|
707
688
|
}
|
|
708
689
|
entity = existing;
|
|
@@ -768,7 +749,7 @@ class NotificationService extends classes_.ApiService {
|
|
|
768
749
|
currentUserId: user.id
|
|
769
750
|
});
|
|
770
751
|
}
|
|
771
|
-
applyCompanyFilter(query, {
|
|
752
|
+
(0,_flusys_nestjs_shared_utils__rspack_import_3.applyCompanyFilter)(query, {
|
|
772
753
|
isCompanyFeatureEnabled: this.notificationConfig.isCompanyFeatureEnabled(),
|
|
773
754
|
entityAlias: this.entityName
|
|
774
755
|
}, user);
|
|
@@ -793,9 +774,9 @@ class NotificationService extends classes_.ApiService {
|
|
|
793
774
|
}
|
|
794
775
|
});
|
|
795
776
|
if (!notification) {
|
|
796
|
-
throw new
|
|
777
|
+
throw new _nestjs_common__rspack_import_4.NotFoundException({
|
|
797
778
|
message: 'Notification not found',
|
|
798
|
-
messageKey:
|
|
779
|
+
messageKey: _config_index_js__rspack_import_10/* .NOTIFICATION_MESSAGES.NOT_FOUND */.x.NOT_FOUND
|
|
799
780
|
});
|
|
800
781
|
}
|
|
801
782
|
notification.isRead = true;
|
|
@@ -812,7 +793,7 @@ class NotificationService extends classes_.ApiService {
|
|
|
812
793
|
this.emitToUser(user.id, ext.companyId ?? user.companyId, 'notification:read', {
|
|
813
794
|
id
|
|
814
795
|
});
|
|
815
|
-
await this.publishDomainAction(
|
|
796
|
+
await this.publishDomainAction(_config_index_js__rspack_import_9/* .NOTIFICATION_EVENT_ACTIONS.READ */.R.READ, {
|
|
816
797
|
ids: [
|
|
817
798
|
notification.id
|
|
818
799
|
],
|
|
@@ -836,7 +817,7 @@ class NotificationService extends classes_.ApiService {
|
|
|
836
817
|
await this.clearCacheForAll();
|
|
837
818
|
// Emit to user's sockets in the current company context
|
|
838
819
|
this.emitToUser(user.id, user.companyId, 'notification:read-all', {});
|
|
839
|
-
await this.publishDomainAction(
|
|
820
|
+
await this.publishDomainAction(_config_index_js__rspack_import_9/* .NOTIFICATION_EVENT_ACTIONS.ALL_READ */.R.ALL_READ, {
|
|
840
821
|
metadata: {
|
|
841
822
|
count: result.affected ?? 0
|
|
842
823
|
},
|
|
@@ -879,7 +860,7 @@ class NotificationService extends classes_.ApiService {
|
|
|
879
860
|
}
|
|
880
861
|
}
|
|
881
862
|
_ts_decorate([
|
|
882
|
-
(0,
|
|
863
|
+
(0,_flusys_nestjs_shared__rspack_import_0.LogAction)({
|
|
883
864
|
action: 'notification.markAsRead',
|
|
884
865
|
module: 'notification'
|
|
885
866
|
}),
|
|
@@ -891,7 +872,7 @@ _ts_decorate([
|
|
|
891
872
|
_ts_metadata("design:returntype", Promise)
|
|
892
873
|
], NotificationService.prototype, "markAsRead", null);
|
|
893
874
|
_ts_decorate([
|
|
894
|
-
(0,
|
|
875
|
+
(0,_flusys_nestjs_shared__rspack_import_0.LogAction)({
|
|
895
876
|
action: 'notification.markAllAsRead',
|
|
896
877
|
module: 'notification'
|
|
897
878
|
}),
|
|
@@ -902,25 +883,29 @@ _ts_decorate([
|
|
|
902
883
|
_ts_metadata("design:returntype", Promise)
|
|
903
884
|
], NotificationService.prototype, "markAllAsRead", null);
|
|
904
885
|
NotificationService = _ts_decorate([
|
|
905
|
-
(0,
|
|
906
|
-
scope:
|
|
907
|
-
}),
|
|
908
|
-
_ts_param(0, (0,
|
|
909
|
-
_ts_param(1, (0,
|
|
910
|
-
_ts_param(2, (0,
|
|
911
|
-
_ts_param(3, (0,
|
|
912
|
-
_ts_param(4, (0,
|
|
913
|
-
_ts_param(4, (0,
|
|
886
|
+
(0,_nestjs_common__rspack_import_4.Injectable)({
|
|
887
|
+
scope: _nestjs_common__rspack_import_4.Scope.REQUEST
|
|
888
|
+
}),
|
|
889
|
+
_ts_param(0, (0,_nestjs_common__rspack_import_4.Inject)('CACHE_INSTANCE')),
|
|
890
|
+
_ts_param(1, (0,_nestjs_common__rspack_import_4.Inject)(_flusys_nestjs_shared_modules__rspack_import_2.UtilsService)),
|
|
891
|
+
_ts_param(2, (0,_nestjs_common__rspack_import_4.Inject)(_notification_config_service_js__rspack_import_7/* .NotificationConfigService */.v)),
|
|
892
|
+
_ts_param(3, (0,_nestjs_common__rspack_import_4.Inject)(_notification_datasource_provider_js__rspack_import_8/* .NotificationDataSourceProvider */.M)),
|
|
893
|
+
_ts_param(4, (0,_nestjs_common__rspack_import_4.Optional)()),
|
|
894
|
+
_ts_param(4, (0,_nestjs_common__rspack_import_4.Inject)(_gateways_index_js__rspack_import_6/* .NotificationGateway */.g)),
|
|
914
895
|
_ts_metadata("design:type", Function),
|
|
915
896
|
_ts_metadata("design:paramtypes", [
|
|
916
|
-
typeof
|
|
917
|
-
typeof
|
|
918
|
-
typeof
|
|
919
|
-
typeof
|
|
920
|
-
typeof
|
|
897
|
+
typeof _flusys_nestjs_shared_classes__rspack_import_1.HybridCache === "undefined" ? Object : _flusys_nestjs_shared_classes__rspack_import_1.HybridCache,
|
|
898
|
+
typeof _flusys_nestjs_shared_modules__rspack_import_2.UtilsService === "undefined" ? Object : _flusys_nestjs_shared_modules__rspack_import_2.UtilsService,
|
|
899
|
+
typeof _notification_config_service_js__rspack_import_7/* .NotificationConfigService */.v === "undefined" ? Object : _notification_config_service_js__rspack_import_7/* .NotificationConfigService */.v,
|
|
900
|
+
typeof _notification_datasource_provider_js__rspack_import_8/* .NotificationDataSourceProvider */.M === "undefined" ? Object : _notification_datasource_provider_js__rspack_import_8/* .NotificationDataSourceProvider */.M,
|
|
901
|
+
typeof _gateways_index_js__rspack_import_6/* .NotificationGateway */.g === "undefined" ? Object : _gateways_index_js__rspack_import_6/* .NotificationGateway */.g
|
|
921
902
|
])
|
|
922
903
|
], NotificationService);
|
|
923
904
|
|
|
905
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
906
|
+
J: () => (NotificationService)
|
|
907
|
+
});
|
|
908
|
+
|
|
924
909
|
|
|
925
910
|
},
|
|
926
911
|
176(module) {
|
package/fesm/adapters/index.js
CHANGED
|
@@ -10,6 +10,10 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
10
10
|
|
|
11
11
|
// EXTERNAL MODULE: external "@nestjs/common"
|
|
12
12
|
var common_ = __webpack_require__(157);
|
|
13
|
+
// EXTERNAL MODULE: external "@nestjs/core"
|
|
14
|
+
var core_ = __webpack_require__(75);
|
|
15
|
+
// EXTERNAL MODULE: ./projects/nestjs-notification/src/gateways/notification.gateway.ts + 3 modules
|
|
16
|
+
var notification_gateway = __webpack_require__(864);
|
|
13
17
|
// EXTERNAL MODULE: ./projects/nestjs-notification/src/services/notification-helper.service.ts
|
|
14
18
|
var notification_helper_service = __webpack_require__(487);
|
|
15
19
|
;// CONCATENATED MODULE: ./projects/nestjs-notification/src/adapters/notification.adapter.ts
|
|
@@ -38,27 +42,39 @@ function _ts_param(paramIndex, decorator) {
|
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
|
|
45
|
+
|
|
46
|
+
|
|
41
47
|
class NotificationAdapter {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
48
|
+
moduleRef;
|
|
49
|
+
gateway;
|
|
50
|
+
constructor(moduleRef, gateway){
|
|
51
|
+
this.moduleRef = moduleRef;
|
|
52
|
+
this.gateway = gateway;
|
|
45
53
|
}
|
|
46
54
|
async send(options) {
|
|
47
|
-
await this.
|
|
55
|
+
await (await this.helper()).send(options);
|
|
48
56
|
}
|
|
49
57
|
async sendToMany(options) {
|
|
50
|
-
await this.
|
|
58
|
+
await (await this.helper()).sendToMany(options);
|
|
51
59
|
}
|
|
52
60
|
isUserOnline(userId) {
|
|
53
|
-
return this.
|
|
61
|
+
return this.gateway?.isUserOnline(userId) ?? false;
|
|
62
|
+
}
|
|
63
|
+
helper() {
|
|
64
|
+
return this.moduleRef.resolve(notification_helper_service/* .NotificationHelperService */.T, core_.ContextIdFactory.create(), {
|
|
65
|
+
strict: false
|
|
66
|
+
});
|
|
54
67
|
}
|
|
55
68
|
}
|
|
56
69
|
NotificationAdapter = _ts_decorate([
|
|
57
70
|
(0,common_.Injectable)(),
|
|
58
|
-
_ts_param(0, (0,common_.Inject)(
|
|
71
|
+
_ts_param(0, (0,common_.Inject)(core_.ModuleRef)),
|
|
72
|
+
_ts_param(1, (0,common_.Optional)()),
|
|
73
|
+
_ts_param(1, (0,common_.Inject)(notification_gateway/* .NotificationGateway */.g)),
|
|
59
74
|
_ts_metadata("design:type", Function),
|
|
60
75
|
_ts_metadata("design:paramtypes", [
|
|
61
|
-
typeof
|
|
76
|
+
typeof core_.ModuleRef === "undefined" ? Object : core_.ModuleRef,
|
|
77
|
+
typeof notification_gateway/* .NotificationGateway */.g === "undefined" ? Object : notification_gateway/* .NotificationGateway */.g
|
|
62
78
|
])
|
|
63
79
|
], NotificationAdapter);
|
|
64
80
|
|
package/fesm/gateways/index.js
CHANGED
|
@@ -16,11 +16,21 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
},
|
|
19
|
-
|
|
19
|
+
267(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
20
|
+
/* import */ var _notification_gateway_js__rspack_import_0 = __webpack_require__(864);
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
24
|
+
g: () => (/* reexport safe */ _notification_gateway_js__rspack_import_0.g)
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
},
|
|
29
|
+
864(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
20
30
|
|
|
21
31
|
// EXPORTS
|
|
22
32
|
__webpack_require__.d(__webpack_exports__, {
|
|
23
|
-
g: () => (/*
|
|
33
|
+
g: () => (/* binding */ NotificationGateway)
|
|
24
34
|
});
|
|
25
35
|
|
|
26
36
|
;// CONCATENATED MODULE: external "@flusys/nestjs-core/config"
|
|
@@ -195,9 +205,6 @@ NotificationGateway = _ts_decorate([
|
|
|
195
205
|
])
|
|
196
206
|
], NotificationGateway);
|
|
197
207
|
|
|
198
|
-
;// CONCATENATED MODULE: ./projects/nestjs-notification/src/gateways/index.ts
|
|
199
|
-
|
|
200
|
-
|
|
201
208
|
|
|
202
209
|
},
|
|
203
210
|
53(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
@@ -282,5 +289,5 @@ import { __webpack_require__ } from '../runtime.js';
|
|
|
282
289
|
var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); }
|
|
283
290
|
import * as __rspack_chunk_1 from './index.js';
|
|
284
291
|
__webpack_require__.C(__rspack_chunk_1);
|
|
285
|
-
var __webpack_exports__ = __webpack_exec__(
|
|
292
|
+
var __webpack_exports__ = __webpack_exec__(267);var __webpack_exports__NotificationGateway = __webpack_exports__.g;
|
|
286
293
|
export { __webpack_exports__NotificationGateway as NotificationGateway };
|
package/fesm/index.js
CHANGED
|
@@ -11,6 +11,10 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
11
11
|
|
|
12
12
|
// EXTERNAL MODULE: external "@nestjs/common"
|
|
13
13
|
var common_ = __webpack_require__(157);
|
|
14
|
+
// EXTERNAL MODULE: external "@nestjs/core"
|
|
15
|
+
var core_ = __webpack_require__(75);
|
|
16
|
+
// EXTERNAL MODULE: ./projects/nestjs-notification/src/gateways/notification.gateway.ts + 3 modules
|
|
17
|
+
var notification_gateway = __webpack_require__(864);
|
|
14
18
|
// EXTERNAL MODULE: ./projects/nestjs-notification/src/services/notification-helper.service.ts
|
|
15
19
|
var notification_helper_service = __webpack_require__(487);
|
|
16
20
|
;// CONCATENATED MODULE: ./projects/nestjs-notification/src/adapters/notification.adapter.ts
|
|
@@ -39,27 +43,39 @@ function _ts_param(paramIndex, decorator) {
|
|
|
39
43
|
}
|
|
40
44
|
|
|
41
45
|
|
|
46
|
+
|
|
47
|
+
|
|
42
48
|
class NotificationAdapter {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
49
|
+
moduleRef;
|
|
50
|
+
gateway;
|
|
51
|
+
constructor(moduleRef, gateway){
|
|
52
|
+
this.moduleRef = moduleRef;
|
|
53
|
+
this.gateway = gateway;
|
|
46
54
|
}
|
|
47
55
|
async send(options) {
|
|
48
|
-
await this.
|
|
56
|
+
await (await this.helper()).send(options);
|
|
49
57
|
}
|
|
50
58
|
async sendToMany(options) {
|
|
51
|
-
await this.
|
|
59
|
+
await (await this.helper()).sendToMany(options);
|
|
52
60
|
}
|
|
53
61
|
isUserOnline(userId) {
|
|
54
|
-
return this.
|
|
62
|
+
return this.gateway?.isUserOnline(userId) ?? false;
|
|
63
|
+
}
|
|
64
|
+
helper() {
|
|
65
|
+
return this.moduleRef.resolve(notification_helper_service/* .NotificationHelperService */.T, core_.ContextIdFactory.create(), {
|
|
66
|
+
strict: false
|
|
67
|
+
});
|
|
55
68
|
}
|
|
56
69
|
}
|
|
57
70
|
NotificationAdapter = _ts_decorate([
|
|
58
71
|
(0,common_.Injectable)(),
|
|
59
|
-
_ts_param(0, (0,common_.Inject)(
|
|
72
|
+
_ts_param(0, (0,common_.Inject)(core_.ModuleRef)),
|
|
73
|
+
_ts_param(1, (0,common_.Optional)()),
|
|
74
|
+
_ts_param(1, (0,common_.Inject)(notification_gateway/* .NotificationGateway */.g)),
|
|
60
75
|
_ts_metadata("design:type", Function),
|
|
61
76
|
_ts_metadata("design:paramtypes", [
|
|
62
|
-
typeof
|
|
77
|
+
typeof core_.ModuleRef === "undefined" ? Object : core_.ModuleRef,
|
|
78
|
+
typeof notification_gateway/* .NotificationGateway */.g === "undefined" ? Object : notification_gateway/* .NotificationGateway */.g
|
|
63
79
|
])
|
|
64
80
|
], NotificationAdapter);
|
|
65
81
|
|
|
@@ -194,7 +210,7 @@ ws://localhost:2002/notification?token=<jwt>
|
|
|
194
210
|
/* import */ var _docs_index_js__rspack_import_3 = __webpack_require__(674);
|
|
195
211
|
/* import */ var _dtos_index_js__rspack_import_4 = __webpack_require__(733);
|
|
196
212
|
/* import */ var _entities_index_js__rspack_import_5 = __webpack_require__(240);
|
|
197
|
-
/* import */ var _gateways_index_js__rspack_import_6 = __webpack_require__(
|
|
213
|
+
/* import */ var _gateways_index_js__rspack_import_6 = __webpack_require__(267);
|
|
198
214
|
/* import */ var _modules_index_js__rspack_import_7 = __webpack_require__(540);
|
|
199
215
|
/* import */ var _services_index_js__rspack_import_8 = __webpack_require__(816);
|
|
200
216
|
// Adapters
|
|
@@ -273,8 +289,8 @@ var controllers = __webpack_require__(101);
|
|
|
273
289
|
var adapters = __webpack_require__(295);
|
|
274
290
|
// EXTERNAL MODULE: ./projects/nestjs-notification/src/services/index.ts
|
|
275
291
|
var services = __webpack_require__(816);
|
|
276
|
-
// EXTERNAL MODULE: ./projects/nestjs-notification/src/gateways/index.ts
|
|
277
|
-
var gateways = __webpack_require__(
|
|
292
|
+
// EXTERNAL MODULE: ./projects/nestjs-notification/src/gateways/index.ts
|
|
293
|
+
var gateways = __webpack_require__(267);
|
|
278
294
|
;// CONCATENATED MODULE: ./projects/nestjs-notification/src/modules/notification.module.ts
|
|
279
295
|
function _ts_decorate(decorators, target, key, desc) {
|
|
280
296
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -420,8 +436,8 @@ NotificationModule = _ts_decorate([
|
|
|
420
436
|
},
|
|
421
437
|
816(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
422
438
|
/* import */ var _notification_config_service_js__rspack_import_0 = __webpack_require__(53);
|
|
423
|
-
/* import */ var _notification_datasource_provider_js__rspack_import_1 = __webpack_require__(
|
|
424
|
-
/* import */ var _notification_service_js__rspack_import_2 = __webpack_require__(
|
|
439
|
+
/* import */ var _notification_datasource_provider_js__rspack_import_1 = __webpack_require__(500);
|
|
440
|
+
/* import */ var _notification_service_js__rspack_import_2 = __webpack_require__(692);
|
|
425
441
|
/* import */ var _notification_helper_service_js__rspack_import_3 = __webpack_require__(487);
|
|
426
442
|
|
|
427
443
|
|
package/fesm/modules/index.js
CHANGED
|
@@ -11,6 +11,10 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
11
11
|
|
|
12
12
|
// EXTERNAL MODULE: external "@nestjs/common"
|
|
13
13
|
var common_ = __webpack_require__(157);
|
|
14
|
+
// EXTERNAL MODULE: external "@nestjs/core"
|
|
15
|
+
var core_ = __webpack_require__(75);
|
|
16
|
+
// EXTERNAL MODULE: ./projects/nestjs-notification/src/gateways/notification.gateway.ts + 3 modules
|
|
17
|
+
var notification_gateway = __webpack_require__(864);
|
|
14
18
|
// EXTERNAL MODULE: ./projects/nestjs-notification/src/services/notification-helper.service.ts
|
|
15
19
|
var notification_helper_service = __webpack_require__(487);
|
|
16
20
|
;// CONCATENATED MODULE: ./projects/nestjs-notification/src/adapters/notification.adapter.ts
|
|
@@ -39,27 +43,39 @@ function _ts_param(paramIndex, decorator) {
|
|
|
39
43
|
}
|
|
40
44
|
|
|
41
45
|
|
|
46
|
+
|
|
47
|
+
|
|
42
48
|
class NotificationAdapter {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
49
|
+
moduleRef;
|
|
50
|
+
gateway;
|
|
51
|
+
constructor(moduleRef, gateway){
|
|
52
|
+
this.moduleRef = moduleRef;
|
|
53
|
+
this.gateway = gateway;
|
|
46
54
|
}
|
|
47
55
|
async send(options) {
|
|
48
|
-
await this.
|
|
56
|
+
await (await this.helper()).send(options);
|
|
49
57
|
}
|
|
50
58
|
async sendToMany(options) {
|
|
51
|
-
await this.
|
|
59
|
+
await (await this.helper()).sendToMany(options);
|
|
52
60
|
}
|
|
53
61
|
isUserOnline(userId) {
|
|
54
|
-
return this.
|
|
62
|
+
return this.gateway?.isUserOnline(userId) ?? false;
|
|
63
|
+
}
|
|
64
|
+
helper() {
|
|
65
|
+
return this.moduleRef.resolve(notification_helper_service/* .NotificationHelperService */.T, core_.ContextIdFactory.create(), {
|
|
66
|
+
strict: false
|
|
67
|
+
});
|
|
55
68
|
}
|
|
56
69
|
}
|
|
57
70
|
NotificationAdapter = _ts_decorate([
|
|
58
71
|
(0,common_.Injectable)(),
|
|
59
|
-
_ts_param(0, (0,common_.Inject)(
|
|
72
|
+
_ts_param(0, (0,common_.Inject)(core_.ModuleRef)),
|
|
73
|
+
_ts_param(1, (0,common_.Optional)()),
|
|
74
|
+
_ts_param(1, (0,common_.Inject)(notification_gateway/* .NotificationGateway */.g)),
|
|
60
75
|
_ts_metadata("design:type", Function),
|
|
61
76
|
_ts_metadata("design:paramtypes", [
|
|
62
|
-
typeof
|
|
77
|
+
typeof core_.ModuleRef === "undefined" ? Object : core_.ModuleRef,
|
|
78
|
+
typeof notification_gateway/* .NotificationGateway */.g === "undefined" ? Object : notification_gateway/* .NotificationGateway */.g
|
|
63
79
|
])
|
|
64
80
|
], NotificationAdapter);
|
|
65
81
|
|
|
@@ -91,8 +107,8 @@ var controllers = __webpack_require__(101);
|
|
|
91
107
|
var adapters = __webpack_require__(295);
|
|
92
108
|
// EXTERNAL MODULE: ./projects/nestjs-notification/src/services/index.ts
|
|
93
109
|
var services = __webpack_require__(816);
|
|
94
|
-
// EXTERNAL MODULE: ./projects/nestjs-notification/src/gateways/index.ts
|
|
95
|
-
var gateways = __webpack_require__(
|
|
110
|
+
// EXTERNAL MODULE: ./projects/nestjs-notification/src/gateways/index.ts
|
|
111
|
+
var gateways = __webpack_require__(267);
|
|
96
112
|
;// CONCATENATED MODULE: ./projects/nestjs-notification/src/modules/notification.module.ts
|
|
97
113
|
function _ts_decorate(decorators, target, key, desc) {
|
|
98
114
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -238,8 +254,8 @@ NotificationModule = _ts_decorate([
|
|
|
238
254
|
},
|
|
239
255
|
816(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
240
256
|
/* import */ var _notification_config_service_js__rspack_import_0 = __webpack_require__(53);
|
|
241
|
-
/* import */ var _notification_datasource_provider_js__rspack_import_1 = __webpack_require__(
|
|
242
|
-
/* import */ var _notification_service_js__rspack_import_2 = __webpack_require__(
|
|
257
|
+
/* import */ var _notification_datasource_provider_js__rspack_import_1 = __webpack_require__(500);
|
|
258
|
+
/* import */ var _notification_service_js__rspack_import_2 = __webpack_require__(692);
|
|
243
259
|
/* import */ var _notification_helper_service_js__rspack_import_3 = __webpack_require__(487);
|
|
244
260
|
|
|
245
261
|
|
package/fesm/services/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { applyCompanyFilter } from "@flusys/nestjs-shared/utils";
|
|
2
1
|
export const __rspack_esm_id = 995;
|
|
3
2
|
export const __rspack_esm_ids = [995];
|
|
4
3
|
export const __webpack_modules__ = {
|
|
@@ -22,8 +21,8 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
22
21
|
},
|
|
23
22
|
816(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
24
23
|
/* import */ var _notification_config_service_js__rspack_import_0 = __webpack_require__(53);
|
|
25
|
-
/* import */ var _notification_datasource_provider_js__rspack_import_1 = __webpack_require__(
|
|
26
|
-
/* import */ var _notification_service_js__rspack_import_2 = __webpack_require__(
|
|
24
|
+
/* import */ var _notification_datasource_provider_js__rspack_import_1 = __webpack_require__(500);
|
|
25
|
+
/* import */ var _notification_service_js__rspack_import_2 = __webpack_require__(692);
|
|
27
26
|
/* import */ var _notification_helper_service_js__rspack_import_3 = __webpack_require__(487);
|
|
28
27
|
|
|
29
28
|
|
|
@@ -39,36 +38,18 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
39
38
|
|
|
40
39
|
|
|
41
40
|
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
__webpack_require__
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
var
|
|
51
|
-
|
|
52
|
-
var
|
|
53
|
-
|
|
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
|
|
41
|
+
692(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
42
|
+
/* import */ var _flusys_nestjs_shared__rspack_import_0 = __webpack_require__(422);
|
|
43
|
+
/* import */ var _flusys_nestjs_shared_classes__rspack_import_1 = __webpack_require__(937);
|
|
44
|
+
/* import */ var _flusys_nestjs_shared_modules__rspack_import_2 = __webpack_require__(236);
|
|
45
|
+
/* import */ var _flusys_nestjs_shared_utils__rspack_import_3 = __webpack_require__(216);
|
|
46
|
+
/* import */ var _nestjs_common__rspack_import_4 = __webpack_require__(157);
|
|
47
|
+
/* import */ var _config_index_js__rspack_import_9 = __webpack_require__(360);
|
|
48
|
+
/* import */ var _config_index_js__rspack_import_10 = __webpack_require__(158);
|
|
49
|
+
/* import */ var _entities_index_js__rspack_import_5 = __webpack_require__(240);
|
|
50
|
+
/* import */ var _gateways_index_js__rspack_import_6 = __webpack_require__(267);
|
|
51
|
+
/* import */ var _notification_config_service_js__rspack_import_7 = __webpack_require__(53);
|
|
52
|
+
/* import */ var _notification_datasource_provider_js__rspack_import_8 = __webpack_require__(500);
|
|
72
53
|
function _ts_decorate(decorators, target, key, desc) {
|
|
73
54
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
74
55
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
@@ -102,13 +83,13 @@ function _ts_param(paramIndex, decorator) {
|
|
|
102
83
|
|
|
103
84
|
|
|
104
85
|
|
|
105
|
-
class NotificationService extends
|
|
86
|
+
class NotificationService extends _flusys_nestjs_shared_classes__rspack_import_1.ApiService {
|
|
106
87
|
cacheManager;
|
|
107
88
|
utilsService;
|
|
108
89
|
notificationConfig;
|
|
109
90
|
gateway;
|
|
110
91
|
constructor(cacheManager, utilsService, notificationConfig, dataSourceProvider, gateway){
|
|
111
|
-
super(
|
|
92
|
+
super(_config_index_js__rspack_import_9/* .NOTIFICATION_EVENT_ENTITIES.NOTIFICATION */.BA.NOTIFICATION, cacheManager, utilsService, NotificationService.name, false, _config_index_js__rspack_import_9/* .NOTIFICATION_EVENT_MODULE */.Wx, dataSourceProvider, notificationConfig.isCompanyFeatureEnabled() ? _entities_index_js__rspack_import_5.NotificationWithCompany : _entities_index_js__rspack_import_5.Notification), this.cacheManager = cacheManager, this.utilsService = utilsService, this.notificationConfig = notificationConfig, this.gateway = gateway;
|
|
112
93
|
}
|
|
113
94
|
async convertSingleDtoToEntity(dto, user) {
|
|
114
95
|
let entity = {};
|
|
@@ -119,9 +100,9 @@ class NotificationService extends classes_.ApiService {
|
|
|
119
100
|
}
|
|
120
101
|
});
|
|
121
102
|
if (!existing) {
|
|
122
|
-
throw new
|
|
103
|
+
throw new _nestjs_common__rspack_import_4.NotFoundException({
|
|
123
104
|
message: 'Notification not found',
|
|
124
|
-
messageKey:
|
|
105
|
+
messageKey: _config_index_js__rspack_import_10/* .NOTIFICATION_MESSAGES.NOT_FOUND */.x.NOT_FOUND
|
|
125
106
|
});
|
|
126
107
|
}
|
|
127
108
|
entity = existing;
|
|
@@ -187,7 +168,7 @@ class NotificationService extends classes_.ApiService {
|
|
|
187
168
|
currentUserId: user.id
|
|
188
169
|
});
|
|
189
170
|
}
|
|
190
|
-
applyCompanyFilter(query, {
|
|
171
|
+
(0,_flusys_nestjs_shared_utils__rspack_import_3.applyCompanyFilter)(query, {
|
|
191
172
|
isCompanyFeatureEnabled: this.notificationConfig.isCompanyFeatureEnabled(),
|
|
192
173
|
entityAlias: this.entityName
|
|
193
174
|
}, user);
|
|
@@ -212,9 +193,9 @@ class NotificationService extends classes_.ApiService {
|
|
|
212
193
|
}
|
|
213
194
|
});
|
|
214
195
|
if (!notification) {
|
|
215
|
-
throw new
|
|
196
|
+
throw new _nestjs_common__rspack_import_4.NotFoundException({
|
|
216
197
|
message: 'Notification not found',
|
|
217
|
-
messageKey:
|
|
198
|
+
messageKey: _config_index_js__rspack_import_10/* .NOTIFICATION_MESSAGES.NOT_FOUND */.x.NOT_FOUND
|
|
218
199
|
});
|
|
219
200
|
}
|
|
220
201
|
notification.isRead = true;
|
|
@@ -231,7 +212,7 @@ class NotificationService extends classes_.ApiService {
|
|
|
231
212
|
this.emitToUser(user.id, ext.companyId ?? user.companyId, 'notification:read', {
|
|
232
213
|
id
|
|
233
214
|
});
|
|
234
|
-
await this.publishDomainAction(
|
|
215
|
+
await this.publishDomainAction(_config_index_js__rspack_import_9/* .NOTIFICATION_EVENT_ACTIONS.READ */.R.READ, {
|
|
235
216
|
ids: [
|
|
236
217
|
notification.id
|
|
237
218
|
],
|
|
@@ -255,7 +236,7 @@ class NotificationService extends classes_.ApiService {
|
|
|
255
236
|
await this.clearCacheForAll();
|
|
256
237
|
// Emit to user's sockets in the current company context
|
|
257
238
|
this.emitToUser(user.id, user.companyId, 'notification:read-all', {});
|
|
258
|
-
await this.publishDomainAction(
|
|
239
|
+
await this.publishDomainAction(_config_index_js__rspack_import_9/* .NOTIFICATION_EVENT_ACTIONS.ALL_READ */.R.ALL_READ, {
|
|
259
240
|
metadata: {
|
|
260
241
|
count: result.affected ?? 0
|
|
261
242
|
},
|
|
@@ -298,7 +279,7 @@ class NotificationService extends classes_.ApiService {
|
|
|
298
279
|
}
|
|
299
280
|
}
|
|
300
281
|
_ts_decorate([
|
|
301
|
-
(0,
|
|
282
|
+
(0,_flusys_nestjs_shared__rspack_import_0.LogAction)({
|
|
302
283
|
action: 'notification.markAsRead',
|
|
303
284
|
module: 'notification'
|
|
304
285
|
}),
|
|
@@ -310,7 +291,7 @@ _ts_decorate([
|
|
|
310
291
|
_ts_metadata("design:returntype", Promise)
|
|
311
292
|
], NotificationService.prototype, "markAsRead", null);
|
|
312
293
|
_ts_decorate([
|
|
313
|
-
(0,
|
|
294
|
+
(0,_flusys_nestjs_shared__rspack_import_0.LogAction)({
|
|
314
295
|
action: 'notification.markAllAsRead',
|
|
315
296
|
module: 'notification'
|
|
316
297
|
}),
|
|
@@ -321,25 +302,29 @@ _ts_decorate([
|
|
|
321
302
|
_ts_metadata("design:returntype", Promise)
|
|
322
303
|
], NotificationService.prototype, "markAllAsRead", null);
|
|
323
304
|
NotificationService = _ts_decorate([
|
|
324
|
-
(0,
|
|
325
|
-
scope:
|
|
305
|
+
(0,_nestjs_common__rspack_import_4.Injectable)({
|
|
306
|
+
scope: _nestjs_common__rspack_import_4.Scope.REQUEST
|
|
326
307
|
}),
|
|
327
|
-
_ts_param(0, (0,
|
|
328
|
-
_ts_param(1, (0,
|
|
329
|
-
_ts_param(2, (0,
|
|
330
|
-
_ts_param(3, (0,
|
|
331
|
-
_ts_param(4, (0,
|
|
332
|
-
_ts_param(4, (0,
|
|
308
|
+
_ts_param(0, (0,_nestjs_common__rspack_import_4.Inject)('CACHE_INSTANCE')),
|
|
309
|
+
_ts_param(1, (0,_nestjs_common__rspack_import_4.Inject)(_flusys_nestjs_shared_modules__rspack_import_2.UtilsService)),
|
|
310
|
+
_ts_param(2, (0,_nestjs_common__rspack_import_4.Inject)(_notification_config_service_js__rspack_import_7/* .NotificationConfigService */.v)),
|
|
311
|
+
_ts_param(3, (0,_nestjs_common__rspack_import_4.Inject)(_notification_datasource_provider_js__rspack_import_8/* .NotificationDataSourceProvider */.M)),
|
|
312
|
+
_ts_param(4, (0,_nestjs_common__rspack_import_4.Optional)()),
|
|
313
|
+
_ts_param(4, (0,_nestjs_common__rspack_import_4.Inject)(_gateways_index_js__rspack_import_6/* .NotificationGateway */.g)),
|
|
333
314
|
_ts_metadata("design:type", Function),
|
|
334
315
|
_ts_metadata("design:paramtypes", [
|
|
335
|
-
typeof
|
|
336
|
-
typeof
|
|
337
|
-
typeof
|
|
338
|
-
typeof
|
|
339
|
-
typeof
|
|
316
|
+
typeof _flusys_nestjs_shared_classes__rspack_import_1.HybridCache === "undefined" ? Object : _flusys_nestjs_shared_classes__rspack_import_1.HybridCache,
|
|
317
|
+
typeof _flusys_nestjs_shared_modules__rspack_import_2.UtilsService === "undefined" ? Object : _flusys_nestjs_shared_modules__rspack_import_2.UtilsService,
|
|
318
|
+
typeof _notification_config_service_js__rspack_import_7/* .NotificationConfigService */.v === "undefined" ? Object : _notification_config_service_js__rspack_import_7/* .NotificationConfigService */.v,
|
|
319
|
+
typeof _notification_datasource_provider_js__rspack_import_8/* .NotificationDataSourceProvider */.M === "undefined" ? Object : _notification_datasource_provider_js__rspack_import_8/* .NotificationDataSourceProvider */.M,
|
|
320
|
+
typeof _gateways_index_js__rspack_import_6/* .NotificationGateway */.g === "undefined" ? Object : _gateways_index_js__rspack_import_6/* .NotificationGateway */.g
|
|
340
321
|
])
|
|
341
322
|
], NotificationService);
|
|
342
323
|
|
|
324
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
325
|
+
J: () => (NotificationService)
|
|
326
|
+
});
|
|
327
|
+
|
|
343
328
|
|
|
344
329
|
},
|
|
345
330
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flusys/nestjs-notification",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.0",
|
|
4
4
|
"description": "Notification module with real-time Socket.IO support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./fesm/index.js",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"express": "^5.0.0"
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|
|
85
|
-
"@flusys/nestjs-core": "
|
|
86
|
-
"@flusys/nestjs-shared": "
|
|
85
|
+
"@flusys/nestjs-core": "9.0.0",
|
|
86
|
+
"@flusys/nestjs-shared": "9.0.0"
|
|
87
87
|
}
|
|
88
88
|
}
|