@flusys/nestjs-notification 8.1.5 → 9.1.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md 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',
package/fesm/244.js CHANGED
@@ -7,6 +7,7 @@ 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
12
  import * as __rspack_external__nestjs_jwt_50c0e0ae from "@nestjs/jwt";
12
13
  import * as __rspack_external__nestjs_core_d7b00a1a from "@nestjs/core";
@@ -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 _nestjs_common__rspack_import_4 = __webpack_require__(157);
585
- /* import */ var _config_index_js__rspack_import_9 = __webpack_require__(360);
586
- /* import */ var _entities_index_js__rspack_import_5 = __webpack_require__(240);
587
- /* import */ var _gateways_index_js__rspack_import_6 = __webpack_require__(31);
588
- /* import */ var _notification_config_service_js__rspack_import_7 = __webpack_require__(53);
589
- /* import */ var _notification_datasource_provider_js__rspack_import_8 = __webpack_require__(335);
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__(31);
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__(335);
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: _config_index_js__rspack_import_9/* .NOTIFICATION_EVENT_MODULE */.Wx,
674
- entity: _config_index_js__rspack_import_9/* .NOTIFICATION_EVENT_ENTITIES.NOTIFICATION */.BA.NOTIFICATION,
675
- action: _config_index_js__rspack_import_9/* .NOTIFICATION_EVENT_ACTIONS.SENT */.R.SENT,
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() ? _entities_index_js__rspack_import_5.NotificationWithCompany : _entities_index_js__rspack_import_5.Notification;
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(_config_index_js__rspack_import_9/* .NOTIFICATION_EVENT_ENTITIES.NOTIFICATION */.BA.NOTIFICATION, this.cacheManager);
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,_nestjs_common__rspack_import_4.Injectable)(),
757
- _ts_param(0, (0,_nestjs_common__rspack_import_4.Inject)('CACHE_INSTANCE')),
758
- _ts_param(1, (0,_nestjs_common__rspack_import_4.Inject)(_flusys_nestjs_shared_modules__rspack_import_3.UtilsService)),
759
- _ts_param(2, (0,_nestjs_common__rspack_import_4.Inject)(_notification_config_service_js__rspack_import_7/* .NotificationConfigService */.v)),
760
- _ts_param(3, (0,_nestjs_common__rspack_import_4.Inject)(_notification_datasource_provider_js__rspack_import_8/* .NotificationDataSourceProvider */.M)),
761
- _ts_param(4, (0,_nestjs_common__rspack_import_4.Optional)()),
762
- _ts_param(4, (0,_nestjs_common__rspack_import_4.Inject)(_gateways_index_js__rspack_import_6/* .NotificationGateway */.g)),
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 _notification_config_service_js__rspack_import_7/* .NotificationConfigService */.v === "undefined" ? Object : _notification_config_service_js__rspack_import_7/* .NotificationConfigService */.v,
768
- typeof _notification_datasource_provider_js__rspack_import_8/* .NotificationDataSourceProvider */.M === "undefined" ? Object : _notification_datasource_provider_js__rspack_import_8/* .NotificationDataSourceProvider */.M,
769
- typeof _gateways_index_js__rspack_import_6/* .NotificationGateway */.g === "undefined" ? Object : _gateways_index_js__rspack_import_6/* .NotificationGateway */.g
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,6 +802,12 @@ 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
 
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 + 1 modules
57
- var notification_service = __webpack_require__(305);
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
- 305(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
624
-
625
- // EXPORTS
626
- __webpack_require__.d(__webpack_exports__, {
627
- J: () => (/* binding */ NotificationService)
628
- });
629
-
630
- // EXTERNAL MODULE: external "@flusys/nestjs-shared"
631
- var nestjs_shared_ = __webpack_require__(422);
632
- // EXTERNAL MODULE: external "@flusys/nestjs-shared/classes"
633
- var classes_ = __webpack_require__(937);
634
- // EXTERNAL MODULE: external "@flusys/nestjs-shared/modules"
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__(31);
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__(335);
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 classes_.ApiService {
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(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;
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 common_.NotFoundException({
684
+ throw new _nestjs_common__rspack_import_4.NotFoundException({
704
685
  message: 'Notification not found',
705
- messageKey: message_keys/* .NOTIFICATION_MESSAGES.NOT_FOUND */.x.NOT_FOUND
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 common_.NotFoundException({
777
+ throw new _nestjs_common__rspack_import_4.NotFoundException({
797
778
  message: 'Notification not found',
798
- messageKey: message_keys/* .NOTIFICATION_MESSAGES.NOT_FOUND */.x.NOT_FOUND
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(event_actions/* .NOTIFICATION_EVENT_ACTIONS.READ */.R.READ, {
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(event_actions/* .NOTIFICATION_EVENT_ACTIONS.ALL_READ */.R.ALL_READ, {
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,nestjs_shared_.LogAction)({
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,nestjs_shared_.LogAction)({
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,common_.Injectable)({
906
- scope: common_.Scope.REQUEST
907
- }),
908
- _ts_param(0, (0,common_.Inject)('CACHE_INSTANCE')),
909
- _ts_param(1, (0,common_.Inject)(modules_.UtilsService)),
910
- _ts_param(2, (0,common_.Inject)(notification_config_service/* .NotificationConfigService */.v)),
911
- _ts_param(3, (0,common_.Inject)(notification_datasource_provider/* .NotificationDataSourceProvider */.M)),
912
- _ts_param(4, (0,common_.Optional)()),
913
- _ts_param(4, (0,common_.Inject)(gateways/* .NotificationGateway */.g)),
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 classes_.HybridCache === "undefined" ? Object : classes_.HybridCache,
917
- typeof modules_.UtilsService === "undefined" ? Object : modules_.UtilsService,
918
- typeof notification_config_service/* .NotificationConfigService */.v === "undefined" ? Object : notification_config_service/* .NotificationConfigService */.v,
919
- typeof notification_datasource_provider/* .NotificationDataSourceProvider */.M === "undefined" ? Object : notification_datasource_provider/* .NotificationDataSourceProvider */.M,
920
- typeof gateways/* .NotificationGateway */.g === "undefined" ? Object : gateways/* .NotificationGateway */.g
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/index.js CHANGED
@@ -421,7 +421,7 @@ NotificationModule = _ts_decorate([
421
421
  816(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
422
422
  /* import */ var _notification_config_service_js__rspack_import_0 = __webpack_require__(53);
423
423
  /* import */ var _notification_datasource_provider_js__rspack_import_1 = __webpack_require__(335);
424
- /* import */ var _notification_service_js__rspack_import_2 = __webpack_require__(305);
424
+ /* import */ var _notification_service_js__rspack_import_2 = __webpack_require__(692);
425
425
  /* import */ var _notification_helper_service_js__rspack_import_3 = __webpack_require__(487);
426
426
 
427
427
 
@@ -239,7 +239,7 @@ NotificationModule = _ts_decorate([
239
239
  816(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
240
240
  /* import */ var _notification_config_service_js__rspack_import_0 = __webpack_require__(53);
241
241
  /* import */ var _notification_datasource_provider_js__rspack_import_1 = __webpack_require__(335);
242
- /* import */ var _notification_service_js__rspack_import_2 = __webpack_require__(305);
242
+ /* import */ var _notification_service_js__rspack_import_2 = __webpack_require__(692);
243
243
  /* import */ var _notification_helper_service_js__rspack_import_3 = __webpack_require__(487);
244
244
 
245
245
 
@@ -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__ = {
@@ -23,7 +22,7 @@ __webpack_require__.d(__webpack_exports__, {
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
24
  /* import */ var _notification_datasource_provider_js__rspack_import_1 = __webpack_require__(335);
26
- /* import */ var _notification_service_js__rspack_import_2 = __webpack_require__(305);
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
- 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
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__(31);
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__(335);
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 classes_.ApiService {
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(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;
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 common_.NotFoundException({
103
+ throw new _nestjs_common__rspack_import_4.NotFoundException({
123
104
  message: 'Notification not found',
124
- messageKey: message_keys/* .NOTIFICATION_MESSAGES.NOT_FOUND */.x.NOT_FOUND
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 common_.NotFoundException({
196
+ throw new _nestjs_common__rspack_import_4.NotFoundException({
216
197
  message: 'Notification not found',
217
- messageKey: message_keys/* .NOTIFICATION_MESSAGES.NOT_FOUND */.x.NOT_FOUND
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(event_actions/* .NOTIFICATION_EVENT_ACTIONS.READ */.R.READ, {
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(event_actions/* .NOTIFICATION_EVENT_ACTIONS.ALL_READ */.R.ALL_READ, {
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,nestjs_shared_.LogAction)({
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,nestjs_shared_.LogAction)({
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,common_.Injectable)({
325
- scope: common_.Scope.REQUEST
305
+ (0,_nestjs_common__rspack_import_4.Injectable)({
306
+ scope: _nestjs_common__rspack_import_4.Scope.REQUEST
326
307
  }),
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)),
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 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
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": "8.1.5",
3
+ "version": "9.1.0-rc.1",
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": "8.1.5",
86
- "@flusys/nestjs-shared": "8.1.5"
85
+ "@flusys/nestjs-core": "9.1.0-rc.1",
86
+ "@flusys/nestjs-shared": "9.1.0-rc.1"
87
87
  }
88
88
  }