@flusys/nestjs-notification 9.1.0-rc.1 → 9.1.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
@@ -197,6 +197,10 @@ export class OrderService {
197
197
  }
198
198
  ```
199
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
+
200
204
  ## License
201
205
 
202
206
  MIT © FLUSYS
@@ -1,9 +1,12 @@
1
1
  import { type INotificationAdapter, type INotificationBulkSendOptions, type INotificationSendOptions } from '@flusys/nestjs-shared';
2
- import { NotificationHelperService } from '../services/notification-helper.service.js';
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 notificationHelper;
5
- constructor(notificationHelper: NotificationHelperService);
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
@@ -9,8 +9,8 @@ import * as __rspack_external__flusys_nestjs_shared_enums_327421f8 from "@flusys
9
9
  import * as __rspack_external__flusys_nestjs_shared_modules_24702bee from "@flusys/nestjs-shared/modules";
10
10
  import * as __rspack_external__flusys_nestjs_shared_utils_9125c1f1 from "@flusys/nestjs-shared/utils";
11
11
  import * as __rspack_external__nestjs_common_a04939da from "@nestjs/common";
12
- import * as __rspack_external__nestjs_jwt_50c0e0ae from "@nestjs/jwt";
13
12
  import * as __rspack_external__nestjs_core_d7b00a1a from "@nestjs/core";
13
+ import * as __rspack_external__nestjs_jwt_50c0e0ae from "@nestjs/jwt";
14
14
  export const __rspack_esm_id = 244;
15
15
  export const __rspack_esm_ids = [244];
16
16
  export const __webpack_modules__ = {
@@ -232,11 +232,21 @@ function getNotificationEntitiesByConfig(enableCompanyFeature) {
232
232
 
233
233
 
234
234
  },
235
- 31(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
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__) {
236
246
 
237
247
  // EXPORTS
238
248
  __webpack_require__.d(__webpack_exports__, {
239
- g: () => (/* reexport */ NotificationGateway)
249
+ g: () => (/* binding */ NotificationGateway)
240
250
  });
241
251
 
242
252
  ;// CONCATENATED MODULE: external "@flusys/nestjs-core/config"
@@ -411,9 +421,6 @@ NotificationGateway = _ts_decorate([
411
421
  ])
412
422
  ], NotificationGateway);
413
423
 
414
- ;// CONCATENATED MODULE: ./projects/nestjs-notification/src/gateways/index.ts
415
-
416
-
417
424
 
418
425
  },
419
426
  53(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
@@ -480,22 +487,11 @@ __webpack_require__.d(__webpack_exports__, {
480
487
 
481
488
 
482
489
  },
483
- 335(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
484
-
485
- // EXPORTS
486
- __webpack_require__.d(__webpack_exports__, {
487
- M: () => (/* binding */ NotificationDataSourceProvider)
488
- });
489
-
490
- // EXTERNAL MODULE: external "@flusys/nestjs-shared/modules"
491
- var modules_ = __webpack_require__(236);
492
- // EXTERNAL MODULE: external "@nestjs/common"
493
- var common_ = __webpack_require__(157);
494
- ;// CONCATENATED MODULE: external "@nestjs/core"
495
-
496
- // EXTERNAL MODULE: ./projects/nestjs-notification/src/services/notification-config.service.ts
497
- var notification_config_service = __webpack_require__(53);
498
- ;// 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);
499
495
  function _ts_decorate(decorators, target, key, desc) {
500
496
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
501
497
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
@@ -523,7 +519,7 @@ function _ts_param(paramIndex, decorator) {
523
519
 
524
520
 
525
521
 
526
- class NotificationDataSourceProvider extends modules_.MultiTenantDataSourceService {
522
+ class NotificationDataSourceProvider extends _flusys_nestjs_shared_modules__rspack_import_0.MultiTenantDataSourceService {
527
523
  configService;
528
524
  static tenantConnections = new Map();
529
525
  static singleDataSource = null;
@@ -562,19 +558,23 @@ class NotificationDataSourceProvider extends modules_.MultiTenantDataSourceServi
562
558
  }
563
559
  }
564
560
  NotificationDataSourceProvider = _ts_decorate([
565
- (0,common_.Injectable)({
566
- scope: common_.Scope.REQUEST
561
+ (0,_nestjs_common__rspack_import_1.Injectable)({
562
+ scope: _nestjs_common__rspack_import_1.Scope.REQUEST
567
563
  }),
568
- _ts_param(0, (0,common_.Inject)(notification_config_service/* .NotificationConfigService */.v)),
569
- _ts_param(1, (0,common_.Optional)()),
570
- _ts_param(1, (0,common_.Inject)(__rspack_external__nestjs_core_d7b00a1a.REQUEST)),
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)),
571
567
  _ts_metadata("design:type", Function),
572
568
  _ts_metadata("design:paramtypes", [
573
- typeof notification_config_service/* .NotificationConfigService */.v === "undefined" ? Object : notification_config_service/* .NotificationConfigService */.v,
569
+ typeof _notification_config_service_js__rspack_import_3/* .NotificationConfigService */.v === "undefined" ? Object : _notification_config_service_js__rspack_import_3/* .NotificationConfigService */.v,
574
570
  typeof Request === "undefined" ? Object : Request
575
571
  ])
576
572
  ], NotificationDataSourceProvider);
577
573
 
574
+ __webpack_require__.d(__webpack_exports__, {
575
+ M: () => (NotificationDataSourceProvider)
576
+ });
577
+
578
578
 
579
579
  },
580
580
  487(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
@@ -586,9 +586,9 @@ NotificationDataSourceProvider = _ts_decorate([
586
586
  /* import */ var _nestjs_common__rspack_import_5 = __webpack_require__(157);
587
587
  /* import */ var _config_index_js__rspack_import_10 = __webpack_require__(360);
588
588
  /* import */ var _entities_index_js__rspack_import_6 = __webpack_require__(240);
589
- /* import */ var _gateways_index_js__rspack_import_7 = __webpack_require__(31);
589
+ /* import */ var _gateways_index_js__rspack_import_7 = __webpack_require__(267);
590
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);
591
+ /* import */ var _notification_datasource_provider_js__rspack_import_9 = __webpack_require__(500);
592
592
  function _ts_decorate(decorators, target, key, desc) {
593
593
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
594
594
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
@@ -814,6 +814,12 @@ module.exports = __rspack_external__flusys_nestjs_shared_utils_9125c1f1;
814
814
  module.exports = __rspack_external__nestjs_common_a04939da;
815
815
 
816
816
 
817
+ },
818
+ 75(module) {
819
+
820
+ module.exports = __rspack_external__nestjs_core_d7b00a1a;
821
+
822
+
817
823
  },
818
824
  125(module) {
819
825
 
package/fesm/446.js CHANGED
@@ -391,7 +391,7 @@ function _ts_metadata(metadataKey, metadataValue) {
391
391
 
392
392
 
393
393
 
394
- let NotificationContentDto = class NotificationContentDto {
394
+ let notification_dto_NotificationContentDto = class NotificationContentDto {
395
395
  title;
396
396
  message;
397
397
  type;
@@ -406,13 +406,13 @@ _ts_decorate([
406
406
  IsString(),
407
407
  MaxLength(255),
408
408
  _ts_metadata("design:type", String)
409
- ], NotificationContentDto.prototype, "title", void 0);
409
+ ], notification_dto_NotificationContentDto.prototype, "title", void 0);
410
410
  _ts_decorate([
411
411
  (0,swagger_.ApiPropertyOptional)(),
412
412
  IsOptional(),
413
413
  IsString(),
414
414
  _ts_metadata("design:type", String)
415
- ], NotificationContentDto.prototype, "message", void 0);
415
+ ], notification_dto_NotificationContentDto.prototype, "message", void 0);
416
416
  _ts_decorate([
417
417
  (0,swagger_.ApiPropertyOptional)({
418
418
  enum: enums_.NotificationType,
@@ -421,20 +421,20 @@ _ts_decorate([
421
421
  IsOptional(),
422
422
  IsEnum(enums_.NotificationType),
423
423
  _ts_metadata("design:type", typeof enums_.NotificationType === "undefined" ? Object : enums_.NotificationType)
424
- ], NotificationContentDto.prototype, "type", void 0);
424
+ ], notification_dto_NotificationContentDto.prototype, "type", void 0);
425
425
  _ts_decorate([
426
426
  (0,swagger_.ApiPropertyOptional)(),
427
427
  IsOptional(),
428
428
  IsObject(),
429
429
  _ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
430
- ], NotificationContentDto.prototype, "data", void 0);
430
+ ], notification_dto_NotificationContentDto.prototype, "data", void 0);
431
431
  _ts_decorate([
432
432
  (0,swagger_.ApiPropertyOptional)(),
433
433
  IsOptional(),
434
434
  IsUUID(),
435
435
  _ts_metadata("design:type", String)
436
- ], NotificationContentDto.prototype, "companyId", void 0);
437
- let UserIdDto = class UserIdDto {
436
+ ], notification_dto_NotificationContentDto.prototype, "companyId", void 0);
437
+ let notification_dto_UserIdDto = class UserIdDto {
438
438
  userId;
439
439
  };
440
440
  _ts_decorate([
@@ -442,8 +442,8 @@ _ts_decorate([
442
442
  IsNotEmpty(),
443
443
  IsUUID(),
444
444
  _ts_metadata("design:type", String)
445
- ], UserIdDto.prototype, "userId", void 0);
446
- let UserIdsDto = class UserIdsDto {
445
+ ], notification_dto_UserIdDto.prototype, "userId", void 0);
446
+ let notification_dto_UserIdsDto = class UserIdsDto {
447
447
  userIds;
448
448
  };
449
449
  _ts_decorate([
@@ -457,8 +457,8 @@ _ts_decorate([
457
457
  each: true
458
458
  }),
459
459
  _ts_metadata("design:type", Array)
460
- ], UserIdsDto.prototype, "userIds", void 0);
461
- class CreateNotificationDto extends (0,swagger_.IntersectionType)(UserIdDto, NotificationContentDto) {
460
+ ], notification_dto_UserIdsDto.prototype, "userIds", void 0);
461
+ class CreateNotificationDto extends (0,swagger_.IntersectionType)(notification_dto_UserIdDto, notification_dto_NotificationContentDto) {
462
462
  }
463
463
  class UpdateNotificationDto extends (0,swagger_.PartialType)((0,swagger_.OmitType)(CreateNotificationDto, [
464
464
  'userId'
@@ -609,9 +609,9 @@ _ts_decorate([
609
609
  }),
610
610
  _ts_metadata("design:type", Number)
611
611
  ], UnreadCountResponseDto.prototype, "count", void 0);
612
- class SendNotificationDto extends (0,swagger_.IntersectionType)(UserIdDto, NotificationContentDto) {
612
+ class SendNotificationDto extends (0,swagger_.IntersectionType)(notification_dto_UserIdDto, notification_dto_NotificationContentDto) {
613
613
  }
614
- class SendBulkNotificationDto extends (0,swagger_.IntersectionType)(UserIdsDto, NotificationContentDto) {
614
+ class SendBulkNotificationDto extends (0,swagger_.IntersectionType)(notification_dto_UserIdsDto, notification_dto_NotificationContentDto) {
615
615
  }
616
616
 
617
617
  ;// CONCATENATED MODULE: ./projects/nestjs-notification/src/dtos/index.ts
@@ -628,9 +628,9 @@ class SendBulkNotificationDto extends (0,swagger_.IntersectionType)(UserIdsDto,
628
628
  /* import */ var _config_index_js__rspack_import_9 = __webpack_require__(360);
629
629
  /* import */ var _config_index_js__rspack_import_10 = __webpack_require__(158);
630
630
  /* import */ var _entities_index_js__rspack_import_5 = __webpack_require__(240);
631
- /* import */ var _gateways_index_js__rspack_import_6 = __webpack_require__(31);
631
+ /* import */ var _gateways_index_js__rspack_import_6 = __webpack_require__(267);
632
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);
633
+ /* import */ var _notification_datasource_provider_js__rspack_import_8 = __webpack_require__(500);
634
634
  function _ts_decorate(decorators, target, key, desc) {
635
635
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
636
636
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
@@ -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
- notificationHelper;
43
- constructor(notificationHelper){
44
- this.notificationHelper = notificationHelper;
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.notificationHelper.send(options);
55
+ await (await this.helper()).send(options);
48
56
  }
49
57
  async sendToMany(options) {
50
- await this.notificationHelper.sendToMany(options);
58
+ await (await this.helper()).sendToMany(options);
51
59
  }
52
60
  isUserOnline(userId) {
53
- return this.notificationHelper.isUserOnline(userId);
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)(notification_helper_service/* .NotificationHelperService */.T)),
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 notification_helper_service/* .NotificationHelperService */.T === "undefined" ? Object : notification_helper_service/* .NotificationHelperService */.T
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
 
@@ -49,7 +49,7 @@ function _ts_metadata(metadataKey, metadataValue) {
49
49
 
50
50
 
51
51
 
52
- let NotificationContentDto = class NotificationContentDto {
52
+ let notification_dto_NotificationContentDto = class NotificationContentDto {
53
53
  title;
54
54
  message;
55
55
  type;
@@ -64,13 +64,13 @@ _ts_decorate([
64
64
  IsString(),
65
65
  MaxLength(255),
66
66
  _ts_metadata("design:type", String)
67
- ], NotificationContentDto.prototype, "title", void 0);
67
+ ], notification_dto_NotificationContentDto.prototype, "title", void 0);
68
68
  _ts_decorate([
69
69
  (0,swagger_.ApiPropertyOptional)(),
70
70
  IsOptional(),
71
71
  IsString(),
72
72
  _ts_metadata("design:type", String)
73
- ], NotificationContentDto.prototype, "message", void 0);
73
+ ], notification_dto_NotificationContentDto.prototype, "message", void 0);
74
74
  _ts_decorate([
75
75
  (0,swagger_.ApiPropertyOptional)({
76
76
  enum: enums_.NotificationType,
@@ -79,20 +79,20 @@ _ts_decorate([
79
79
  IsOptional(),
80
80
  IsEnum(enums_.NotificationType),
81
81
  _ts_metadata("design:type", typeof enums_.NotificationType === "undefined" ? Object : enums_.NotificationType)
82
- ], NotificationContentDto.prototype, "type", void 0);
82
+ ], notification_dto_NotificationContentDto.prototype, "type", void 0);
83
83
  _ts_decorate([
84
84
  (0,swagger_.ApiPropertyOptional)(),
85
85
  IsOptional(),
86
86
  IsObject(),
87
87
  _ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
88
- ], NotificationContentDto.prototype, "data", void 0);
88
+ ], notification_dto_NotificationContentDto.prototype, "data", void 0);
89
89
  _ts_decorate([
90
90
  (0,swagger_.ApiPropertyOptional)(),
91
91
  IsOptional(),
92
92
  IsUUID(),
93
93
  _ts_metadata("design:type", String)
94
- ], NotificationContentDto.prototype, "companyId", void 0);
95
- let UserIdDto = class UserIdDto {
94
+ ], notification_dto_NotificationContentDto.prototype, "companyId", void 0);
95
+ let notification_dto_UserIdDto = class UserIdDto {
96
96
  userId;
97
97
  };
98
98
  _ts_decorate([
@@ -100,8 +100,8 @@ _ts_decorate([
100
100
  IsNotEmpty(),
101
101
  IsUUID(),
102
102
  _ts_metadata("design:type", String)
103
- ], UserIdDto.prototype, "userId", void 0);
104
- let UserIdsDto = class UserIdsDto {
103
+ ], notification_dto_UserIdDto.prototype, "userId", void 0);
104
+ let notification_dto_UserIdsDto = class UserIdsDto {
105
105
  userIds;
106
106
  };
107
107
  _ts_decorate([
@@ -115,8 +115,8 @@ _ts_decorate([
115
115
  each: true
116
116
  }),
117
117
  _ts_metadata("design:type", Array)
118
- ], UserIdsDto.prototype, "userIds", void 0);
119
- class CreateNotificationDto extends (0,swagger_.IntersectionType)(UserIdDto, NotificationContentDto) {
118
+ ], notification_dto_UserIdsDto.prototype, "userIds", void 0);
119
+ class CreateNotificationDto extends (0,swagger_.IntersectionType)(notification_dto_UserIdDto, notification_dto_NotificationContentDto) {
120
120
  }
121
121
  class UpdateNotificationDto extends (0,swagger_.PartialType)((0,swagger_.OmitType)(CreateNotificationDto, [
122
122
  'userId'
@@ -267,9 +267,9 @@ _ts_decorate([
267
267
  }),
268
268
  _ts_metadata("design:type", Number)
269
269
  ], UnreadCountResponseDto.prototype, "count", void 0);
270
- class SendNotificationDto extends (0,swagger_.IntersectionType)(UserIdDto, NotificationContentDto) {
270
+ class SendNotificationDto extends (0,swagger_.IntersectionType)(notification_dto_UserIdDto, notification_dto_NotificationContentDto) {
271
271
  }
272
- class SendBulkNotificationDto extends (0,swagger_.IntersectionType)(UserIdsDto, NotificationContentDto) {
272
+ class SendBulkNotificationDto extends (0,swagger_.IntersectionType)(notification_dto_UserIdsDto, notification_dto_NotificationContentDto) {
273
273
  }
274
274
 
275
275
  ;// CONCATENATED MODULE: ./projects/nestjs-notification/src/dtos/index.ts
@@ -16,11 +16,21 @@ __webpack_require__.d(__webpack_exports__, {
16
16
 
17
17
 
18
18
  },
19
- 31(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
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: () => (/* reexport */ NotificationGateway)
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__(31);var __webpack_exports__NotificationGateway = __webpack_exports__.g;
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
- notificationHelper;
44
- constructor(notificationHelper){
45
- this.notificationHelper = notificationHelper;
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.notificationHelper.send(options);
56
+ await (await this.helper()).send(options);
49
57
  }
50
58
  async sendToMany(options) {
51
- await this.notificationHelper.sendToMany(options);
59
+ await (await this.helper()).sendToMany(options);
52
60
  }
53
61
  isUserOnline(userId) {
54
- return this.notificationHelper.isUserOnline(userId);
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)(notification_helper_service/* .NotificationHelperService */.T)),
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 notification_helper_service/* .NotificationHelperService */.T === "undefined" ? Object : notification_helper_service/* .NotificationHelperService */.T
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__(31);
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 + 4 modules
277
- var gateways = __webpack_require__(31);
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,7 +436,7 @@ 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__(335);
439
+ /* import */ var _notification_datasource_provider_js__rspack_import_1 = __webpack_require__(500);
424
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
 
@@ -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
- notificationHelper;
44
- constructor(notificationHelper){
45
- this.notificationHelper = notificationHelper;
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.notificationHelper.send(options);
56
+ await (await this.helper()).send(options);
49
57
  }
50
58
  async sendToMany(options) {
51
- await this.notificationHelper.sendToMany(options);
59
+ await (await this.helper()).sendToMany(options);
52
60
  }
53
61
  isUserOnline(userId) {
54
- return this.notificationHelper.isUserOnline(userId);
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)(notification_helper_service/* .NotificationHelperService */.T)),
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 notification_helper_service/* .NotificationHelperService */.T === "undefined" ? Object : notification_helper_service/* .NotificationHelperService */.T
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 + 4 modules
95
- var gateways = __webpack_require__(31);
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,7 +254,7 @@ 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__(335);
257
+ /* import */ var _notification_datasource_provider_js__rspack_import_1 = __webpack_require__(500);
242
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
 
@@ -21,7 +21,7 @@ __webpack_require__.d(__webpack_exports__, {
21
21
  },
22
22
  816(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
23
23
  /* import */ var _notification_config_service_js__rspack_import_0 = __webpack_require__(53);
24
- /* import */ var _notification_datasource_provider_js__rspack_import_1 = __webpack_require__(335);
24
+ /* import */ var _notification_datasource_provider_js__rspack_import_1 = __webpack_require__(500);
25
25
  /* import */ var _notification_service_js__rspack_import_2 = __webpack_require__(692);
26
26
  /* import */ var _notification_helper_service_js__rspack_import_3 = __webpack_require__(487);
27
27
 
@@ -47,9 +47,9 @@ __webpack_require__.d(__webpack_exports__, {
47
47
  /* import */ var _config_index_js__rspack_import_9 = __webpack_require__(360);
48
48
  /* import */ var _config_index_js__rspack_import_10 = __webpack_require__(158);
49
49
  /* import */ var _entities_index_js__rspack_import_5 = __webpack_require__(240);
50
- /* import */ var _gateways_index_js__rspack_import_6 = __webpack_require__(31);
50
+ /* import */ var _gateways_index_js__rspack_import_6 = __webpack_require__(267);
51
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);
52
+ /* import */ var _notification_datasource_provider_js__rspack_import_8 = __webpack_require__(500);
53
53
  function _ts_decorate(decorators, target, key, desc) {
54
54
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
55
55
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flusys/nestjs-notification",
3
- "version": "9.1.0-rc.1",
3
+ "version": "9.1.1",
4
4
  "description": "Notification module with real-time Socket.IO support",
5
5
  "type": "module",
6
6
  "main": "./fesm/index.js",
@@ -70,7 +70,7 @@
70
70
  "@nestjs/config": "^12.0.0",
71
71
  "@nestjs/core": "^12.0.0",
72
72
  "@nestjs/jwt": "^12.0.0",
73
- "@nestjs/platform-express": "^12.0.0",
73
+ "@nestjs/platform-express": "^12.1.2",
74
74
  "@nestjs/swagger": "^12.0.0",
75
75
  "@nestjs/typeorm": "^12.0.0",
76
76
  "@nestjs/websockets": "^12.0.0",
@@ -78,11 +78,11 @@
78
78
  "class-transformer": "^0.5.1",
79
79
  "class-validator": "^0.15.0",
80
80
  "socket.io": "^4.8.0",
81
- "typeorm": "^0.3.0",
81
+ "typeorm": "^0.3.31",
82
82
  "express": "^5.0.0"
83
83
  },
84
84
  "dependencies": {
85
- "@flusys/nestjs-core": "9.1.0-rc.1",
86
- "@flusys/nestjs-shared": "9.1.0-rc.1"
85
+ "@flusys/nestjs-core": "9.1.1",
86
+ "@flusys/nestjs-shared": "9.1.1"
87
87
  }
88
88
  }