@nathapp/nestjs-notification 2.1.4 → 3.0.0-rc.4

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.
Files changed (123) hide show
  1. package/CLAUDE.md +21 -0
  2. package/UPGRADE-PLAN-PHASE7-8.md +307 -0
  3. package/UPGRADE-PLAN-PHASE9.md +361 -0
  4. package/UPGRADE-PLAN.md +425 -0
  5. package/dist/email/email.interface.d.ts +1 -1
  6. package/dist/email/email.provider.d.ts +2 -2
  7. package/dist/email/email.provider.js +7 -5
  8. package/dist/email/email.provider.js.map +1 -1
  9. package/dist/email/index.d.ts +1 -3
  10. package/dist/email/index.js +1 -6
  11. package/dist/email/index.js.map +1 -1
  12. package/dist/index.d.ts +4 -3
  13. package/dist/index.js +22 -3
  14. package/dist/index.js.map +1 -1
  15. package/dist/interface/index.d.ts +3 -3
  16. package/dist/interface/message.interface.d.ts +11 -4
  17. package/dist/interface/payload.interface.d.ts +71 -0
  18. package/dist/{push-notification/push-notification-module.interface.js → interface/payload.interface.js} +1 -2
  19. package/dist/interface/payload.interface.js.map +1 -0
  20. package/dist/interface/result.interface.d.ts +2 -1
  21. package/dist/notification/errors.d.ts +3 -0
  22. package/dist/notification/errors.js +11 -0
  23. package/dist/notification/errors.js.map +1 -0
  24. package/dist/notification/index.d.ts +6 -2
  25. package/dist/notification/index.js +7 -1
  26. package/dist/notification/index.js.map +1 -1
  27. package/dist/notification/notification-provider.factory.d.ts +5 -0
  28. package/dist/notification/notification-provider.factory.js +33 -0
  29. package/dist/notification/notification-provider.factory.js.map +1 -0
  30. package/dist/notification/notification.interceptor.d.ts +18 -0
  31. package/dist/notification/notification.interceptor.js +5 -0
  32. package/dist/notification/notification.interceptor.js.map +1 -0
  33. package/dist/notification/notification.module.d.ts +29 -19
  34. package/dist/notification/notification.module.js +338 -65
  35. package/dist/notification/notification.module.js.map +1 -1
  36. package/dist/notification/notification.service.d.ts +18 -2
  37. package/dist/notification/notification.service.js +277 -16
  38. package/dist/notification/notification.service.js.map +1 -1
  39. package/dist/notification/provider-config.d.ts +17 -0
  40. package/dist/{interface/payload.inteface.js → notification/provider-config.js} +1 -1
  41. package/dist/notification/provider-config.js.map +1 -0
  42. package/dist/push-notification/fcm-push-notification.provider.d.ts +3 -0
  43. package/dist/push-notification/fcm-push-notification.provider.js +17 -2
  44. package/dist/push-notification/fcm-push-notification.provider.js.map +1 -1
  45. package/dist/push-notification/firebase.interface.d.ts +1 -0
  46. package/dist/push-notification/index.d.ts +1 -4
  47. package/dist/push-notification/index.js +1 -5
  48. package/dist/push-notification/index.js.map +1 -1
  49. package/dist/push-notification/push-notification-provider.manager.d.ts +8 -3
  50. package/dist/push-notification/push-notification-provider.manager.js +12 -3
  51. package/dist/push-notification/push-notification-provider.manager.js.map +1 -1
  52. package/dist/push-notification/push-notification.provider.d.ts +1 -0
  53. package/dist/push-notification/push-notification.provider.js.map +1 -1
  54. package/dist/push-notification/push-notification.service.js +3 -2
  55. package/dist/push-notification/push-notification.service.js.map +1 -1
  56. package/dist/push-notification/user-token.store.js +7 -7
  57. package/dist/push-notification/user-token.store.js.map +1 -1
  58. package/dist/sms/constant.d.ts +1 -0
  59. package/dist/sms/constant.js +5 -0
  60. package/dist/sms/constant.js.map +1 -0
  61. package/dist/sms/index.d.ts +3 -2
  62. package/dist/sms/index.js +6 -2
  63. package/dist/sms/index.js.map +1 -1
  64. package/dist/sms/sms.provider.d.ts +9 -0
  65. package/dist/sms/sms.provider.js +7 -0
  66. package/dist/sms/sms.provider.js.map +1 -0
  67. package/dist/sms/sms.service.d.ts +8 -7
  68. package/dist/sms/sms.service.js +30 -2
  69. package/dist/sms/sms.service.js.map +1 -1
  70. package/dist/template/constant.d.ts +1 -0
  71. package/dist/template/constant.js +2 -1
  72. package/dist/template/constant.js.map +1 -1
  73. package/dist/template/engines/string-format.engine.d.ts +6 -0
  74. package/dist/template/engines/string-format.engine.js +17 -0
  75. package/dist/template/engines/string-format.engine.js.map +1 -0
  76. package/dist/template/fake-template.loader.js +14 -18
  77. package/dist/template/fake-template.loader.js.map +1 -1
  78. package/dist/template/index.d.ts +4 -2
  79. package/dist/template/index.js +4 -1
  80. package/dist/template/index.js.map +1 -1
  81. package/dist/template/template-engine.d.ts +5 -0
  82. package/dist/template/template-engine.js +3 -0
  83. package/dist/template/template-engine.js.map +1 -0
  84. package/dist/template/template.loader.d.ts +4 -1
  85. package/dist/template/template.loader.js +22 -14
  86. package/dist/template/template.loader.js.map +1 -1
  87. package/dist/whatsapp/constant.d.ts +2 -0
  88. package/dist/whatsapp/constant.js +6 -0
  89. package/dist/whatsapp/constant.js.map +1 -0
  90. package/dist/whatsapp/index.d.ts +3 -0
  91. package/dist/whatsapp/index.js +11 -0
  92. package/dist/whatsapp/index.js.map +1 -0
  93. package/dist/whatsapp/whatsapp.provider.d.ts +9 -0
  94. package/dist/whatsapp/whatsapp.provider.js +7 -0
  95. package/dist/whatsapp/whatsapp.provider.js.map +1 -0
  96. package/dist/whatsapp/whatsapp.service.d.ts +9 -0
  97. package/dist/whatsapp/whatsapp.service.js +35 -0
  98. package/dist/whatsapp/whatsapp.service.js.map +1 -0
  99. package/docs/20260214-fix-plan-notification.md +149 -0
  100. package/docs/20260214-fix-plan-post-refactor.md +118 -0
  101. package/docs/20260214-nestjs-notification-review.md +390 -0
  102. package/docs/20260214-review-post-refactor.md +285 -0
  103. package/docs/20260215-review-notification-post-fix.md +933 -0
  104. package/package.json +2 -1
  105. package/dist/email/email-provider.factory.d.ts +0 -5
  106. package/dist/email/email-provider.factory.js +0 -18
  107. package/dist/email/email-provider.factory.js.map +0 -1
  108. package/dist/email/email.module.d.ts +0 -27
  109. package/dist/email/email.module.js +0 -110
  110. package/dist/email/email.module.js.map +0 -1
  111. package/dist/interface/payload.inteface.d.ts +0 -22
  112. package/dist/interface/payload.inteface.js.map +0 -1
  113. package/dist/push-notification/push-notification-module.interface.d.ts +0 -33
  114. package/dist/push-notification/push-notification-module.interface.js.map +0 -1
  115. package/dist/push-notification/push-notification-provider-module.factory.d.ts +0 -5
  116. package/dist/push-notification/push-notification-provider-module.factory.js +0 -13
  117. package/dist/push-notification/push-notification-provider-module.factory.js.map +0 -1
  118. package/dist/push-notification/push-notification-provider.factory.d.ts +0 -5
  119. package/dist/push-notification/push-notification-provider.factory.js +0 -16
  120. package/dist/push-notification/push-notification-provider.factory.js.map +0 -1
  121. package/dist/push-notification/push-notification.module.d.ts +0 -15
  122. package/dist/push-notification/push-notification.module.js +0 -189
  123. package/dist/push-notification/push-notification.module.js.map +0 -1
@@ -18,11 +18,20 @@ const common_1 = require("@nestjs/common");
18
18
  const template_1 = require("../template");
19
19
  const email_1 = require("../email");
20
20
  const push_notification_1 = require("../push-notification");
21
+ const sms_1 = require("../sms");
22
+ const whatsapp_1 = require("../whatsapp");
23
+ const constant_1 = require("./constant");
24
+ const errors_1 = require("./errors");
25
+ const notification_interceptor_1 = require("./notification.interceptor");
21
26
  let NotificationService = NotificationService_1 = class NotificationService {
22
- constructor(templateLoader, emailService, pushNotificationService) {
27
+ constructor(templateLoader, emailService, pushNotificationService, smsService, whatsAppService, options, interceptors) {
23
28
  this.templateLoader = templateLoader;
24
29
  this.emailService = emailService;
25
30
  this.pushNotificationService = pushNotificationService;
31
+ this.smsService = smsService;
32
+ this.whatsAppService = whatsAppService;
33
+ this.options = options;
34
+ this.interceptors = interceptors;
26
35
  this.logger = new common_1.Logger(NotificationService_1.name);
27
36
  const services = [];
28
37
  services.push(templateLoader.constructor.name);
@@ -30,11 +39,51 @@ let NotificationService = NotificationService_1 = class NotificationService {
30
39
  services.push(emailService.constructor.name);
31
40
  if (pushNotificationService)
32
41
  services.push(pushNotificationService.constructor.name);
33
- this.logger.log(`NotificationService initialized with ${services.join(', ')} services`);
42
+ if (smsService)
43
+ services.push(smsService.constructor.name);
44
+ if (whatsAppService)
45
+ services.push(whatsAppService.constructor.name);
46
+ this.strict = (options === null || options === void 0 ? void 0 : options.strict) !== false;
47
+ this.logger.log(`NotificationService initialized with ${services.join(', ')} services (strict: ${this.strict})`);
48
+ }
49
+ async runBeforeSendHooks(context) {
50
+ if (!this.interceptors || this.interceptors.length === 0) {
51
+ return context;
52
+ }
53
+ let modifiedContext = context;
54
+ for (const interceptor of this.interceptors) {
55
+ if (interceptor.beforeSend) {
56
+ modifiedContext = await interceptor.beforeSend(modifiedContext);
57
+ }
58
+ }
59
+ return modifiedContext;
60
+ }
61
+ async runAfterSendHooks(context, result) {
62
+ if (!this.interceptors || this.interceptors.length === 0) {
63
+ return;
64
+ }
65
+ for (const interceptor of this.interceptors) {
66
+ if (interceptor.afterSend) {
67
+ await interceptor.afterSend(context, result);
68
+ }
69
+ }
70
+ }
71
+ async runOnErrorHooks(context, error) {
72
+ if (!this.interceptors || this.interceptors.length === 0) {
73
+ return;
74
+ }
75
+ for (const interceptor of this.interceptors) {
76
+ if (interceptor.onError) {
77
+ await interceptor.onError(context, error);
78
+ }
79
+ }
34
80
  }
35
81
  async sendEmailRaw(message) {
36
82
  if (!this.emailService) {
37
83
  this.logger.error("Email Service is not configure..please configure the email option");
84
+ if (this.strict) {
85
+ throw new errors_1.NotificationConfigError("EmailService");
86
+ }
38
87
  return {
39
88
  success: false,
40
89
  message: "Email Service is not configure"
@@ -43,6 +92,7 @@ let NotificationService = NotificationService_1 = class NotificationService {
43
92
  return this.emailService.send(message);
44
93
  }
45
94
  async sendEmail(templateCodeOrPayload, email, resolveOption, attachments) {
95
+ var _a, _b;
46
96
  let resolvedTemplateCode = '';
47
97
  let resolvedEmail = '';
48
98
  let resolvedResolveOption = {};
@@ -67,16 +117,37 @@ let NotificationService = NotificationService_1 = class NotificationService {
67
117
  message: `Template ${resolvedTemplateCode} resolve failure. Please make sure the template has set`
68
118
  };
69
119
  }
70
- return this.sendEmailRaw({
120
+ let context = {
121
+ channel: 'email',
122
+ templateCode: resolvedTemplateCode,
71
123
  recipient: resolvedEmail,
72
- subject: templateMessage.subject || "",
73
- message: templateMessage.content,
74
- attachments: resolvedAttachments,
75
- });
124
+ resolvedMessage: {
125
+ subject: templateMessage.subject || "",
126
+ content: templateMessage.content,
127
+ },
128
+ };
129
+ try {
130
+ context = await this.runBeforeSendHooks(context);
131
+ const result = await this.sendEmailRaw({
132
+ recipient: context.recipient,
133
+ subject: ((_a = context.resolvedMessage) === null || _a === void 0 ? void 0 : _a.subject) || "",
134
+ message: ((_b = context.resolvedMessage) === null || _b === void 0 ? void 0 : _b.content) || "",
135
+ attachments: resolvedAttachments,
136
+ });
137
+ await this.runAfterSendHooks(context, result);
138
+ return result;
139
+ }
140
+ catch (error) {
141
+ await this.runOnErrorHooks(context, error);
142
+ throw error;
143
+ }
76
144
  }
77
145
  async sendPushNotificationRaw(message) {
78
146
  if (!this.pushNotificationService) {
79
147
  this.logger.error("Push Notification Service is not configure..please configure the pushNotification option");
148
+ if (this.strict) {
149
+ throw new errors_1.NotificationConfigError("PushNotificationService");
150
+ }
80
151
  return {
81
152
  success: false,
82
153
  message: "Push Notification Service is not configure..please configure the pushNotification option"
@@ -85,6 +156,7 @@ let NotificationService = NotificationService_1 = class NotificationService {
85
156
  return this.pushNotificationService.send(message);
86
157
  }
87
158
  async sendPushNotification(templateCodeOrPayload, token, resolveOption) {
159
+ var _a, _b;
88
160
  let resolvedTemplateCode = '';
89
161
  let resolvedToken;
90
162
  let resolvedDeviceToken;
@@ -119,7 +191,7 @@ let NotificationService = NotificationService_1 = class NotificationService {
119
191
  else {
120
192
  resolvedDeviceToken = resolvedToken;
121
193
  }
122
- const templateMessage = await this.templateLoader.resolve(resolvedTemplateCode, resolveOption);
194
+ const templateMessage = await this.templateLoader.resolve(resolvedTemplateCode, resolvedResolveOption);
123
195
  if (!templateMessage) {
124
196
  this.logger.error(`Template ${resolvedTemplateCode} resolve failure. Please make sure the template has set`);
125
197
  return {
@@ -127,17 +199,38 @@ let NotificationService = NotificationService_1 = class NotificationService {
127
199
  message: `Template ${resolvedTemplateCode} resolve failure. Please make sure the template has set`
128
200
  };
129
201
  }
130
- return this.sendPushNotificationRaw({
202
+ let context = {
203
+ channel: 'push',
204
+ templateCode: resolvedTemplateCode,
131
205
  recipient: resolvedDeviceToken.data,
132
- paltform: resolvedDeviceToken.type,
133
- subject: templateMessage.subject || "",
134
- message: templateMessage.content,
135
- });
206
+ resolvedMessage: {
207
+ subject: templateMessage.subject || "",
208
+ content: templateMessage.content,
209
+ },
210
+ };
211
+ try {
212
+ context = await this.runBeforeSendHooks(context);
213
+ const result = await this.sendPushNotificationRaw({
214
+ recipient: context.recipient,
215
+ platform: resolvedDeviceToken.type,
216
+ subject: ((_a = context.resolvedMessage) === null || _a === void 0 ? void 0 : _a.subject) || "",
217
+ message: ((_b = context.resolvedMessage) === null || _b === void 0 ? void 0 : _b.content) || "",
218
+ });
219
+ await this.runAfterSendHooks(context, result);
220
+ return result;
221
+ }
222
+ catch (error) {
223
+ await this.runOnErrorHooks(context, error);
224
+ throw error;
225
+ }
136
226
  }
137
227
  async sendPushNotificationMulticastRaw(tokens, message) {
138
228
  if (!this.pushNotificationService) {
139
229
  this.logger.error("PushNotification Service is not configure..please configure the pushNotification option");
140
- return null;
230
+ if (this.strict) {
231
+ throw new errors_1.NotificationConfigError("PushNotificationService");
232
+ }
233
+ return { successCount: 0, failureCount: 0, results: [] };
141
234
  }
142
235
  return this.pushNotificationService.sendMulticast(tokens, message);
143
236
  }
@@ -145,7 +238,7 @@ let NotificationService = NotificationService_1 = class NotificationService {
145
238
  const templateMessage = await this.templateLoader.resolve(templateCode, resolveOption);
146
239
  if (!templateMessage) {
147
240
  this.logger.error(`Template ${templateCode} Load Failed. Please make sure the template has set`);
148
- return null;
241
+ return { successCount: 0, failureCount: 0, results: [] };
149
242
  }
150
243
  return this.sendPushNotificationMulticastRaw(tokens, {
151
244
  subject: templateMessage.subject || "",
@@ -159,6 +252,164 @@ let NotificationService = NotificationService_1 = class NotificationService {
159
252
  isPushNotificationPayload(value) {
160
253
  return typeof value === 'object' && 'templateCode' in value && ('userId' in value || 'deviceToken' in value);
161
254
  }
255
+ async sendSms(payload) {
256
+ var _a;
257
+ if (!this.smsService) {
258
+ this.logger.error("SMS Service is not configure..please configure the sms option");
259
+ if (this.strict) {
260
+ throw new errors_1.NotificationConfigError("SmsService");
261
+ }
262
+ return {
263
+ success: false,
264
+ message: "SMS Service is not configure"
265
+ };
266
+ }
267
+ const templateMessage = await this.templateLoader.resolve(payload.templateCode, payload.options);
268
+ if (!templateMessage) {
269
+ this.logger.error(`Template ${payload.templateCode} resolve failure. Please make sure the template has set`);
270
+ return {
271
+ success: false,
272
+ message: `Template ${payload.templateCode} resolve failure. Please make sure the template has set`
273
+ };
274
+ }
275
+ let context = {
276
+ channel: 'sms',
277
+ templateCode: payload.templateCode,
278
+ recipient: payload.phoneNumber,
279
+ resolvedMessage: {
280
+ content: templateMessage.content,
281
+ },
282
+ };
283
+ try {
284
+ context = await this.runBeforeSendHooks(context);
285
+ const smsMessage = {
286
+ recipient: context.recipient,
287
+ message: ((_a = context.resolvedMessage) === null || _a === void 0 ? void 0 : _a.content) || "",
288
+ countryIso2: payload.countryIso2,
289
+ dialCode: payload.dialCode,
290
+ };
291
+ const result = await this.smsService.send(smsMessage);
292
+ await this.runAfterSendHooks(context, result);
293
+ return result;
294
+ }
295
+ catch (error) {
296
+ await this.runOnErrorHooks(context, error);
297
+ throw error;
298
+ }
299
+ }
300
+ async sendWhatsApp(payload) {
301
+ var _a, _b;
302
+ if (!this.whatsAppService) {
303
+ this.logger.error("WhatsApp Service is not configure..please configure the whatsApp option");
304
+ if (this.strict) {
305
+ throw new errors_1.NotificationConfigError("WhatsAppService");
306
+ }
307
+ return {
308
+ success: false,
309
+ message: "WhatsApp Service is not configure"
310
+ };
311
+ }
312
+ const templateMessage = await this.templateLoader.resolve(payload.templateCode, payload.options);
313
+ if (!templateMessage) {
314
+ this.logger.error(`Template ${payload.templateCode} resolve failure. Please make sure the template has set`);
315
+ return {
316
+ success: false,
317
+ message: `Template ${payload.templateCode} resolve failure. Please make sure the template has set`
318
+ };
319
+ }
320
+ let context = {
321
+ channel: 'whatsapp',
322
+ templateCode: payload.templateCode,
323
+ recipient: payload.phoneNumber,
324
+ resolvedMessage: {
325
+ content: templateMessage.content,
326
+ },
327
+ };
328
+ try {
329
+ context = await this.runBeforeSendHooks(context);
330
+ const whatsAppMessage = {
331
+ recipient: context.recipient,
332
+ message: ((_a = context.resolvedMessage) === null || _a === void 0 ? void 0 : _a.content) || "",
333
+ templateName: payload.whatsappTemplateName,
334
+ languageCode: (_b = payload.options) === null || _b === void 0 ? void 0 : _b.locale,
335
+ mediaUrl: payload.mediaUrl,
336
+ };
337
+ const result = await this.whatsAppService.send(whatsAppMessage);
338
+ await this.runAfterSendHooks(context, result);
339
+ return result;
340
+ }
341
+ catch (error) {
342
+ await this.runOnErrorHooks(context, error);
343
+ throw error;
344
+ }
345
+ }
346
+ async sendToChannel(channel, payload) {
347
+ switch (channel) {
348
+ case 'email':
349
+ return this.sendEmail({
350
+ templateCode: payload.templateCode,
351
+ email: payload.email,
352
+ options: payload.options,
353
+ attachments: payload.attachments,
354
+ });
355
+ case 'push':
356
+ return this.sendPushNotification({
357
+ templateCode: payload.templateCode,
358
+ userId: payload.userId,
359
+ deviceToken: payload.deviceToken,
360
+ options: payload.options,
361
+ });
362
+ case 'sms':
363
+ return this.sendSms({
364
+ templateCode: payload.templateCode,
365
+ phoneNumber: payload.phoneNumber,
366
+ options: payload.options,
367
+ countryIso2: payload.countryIso2,
368
+ dialCode: payload.dialCode,
369
+ });
370
+ case 'whatsapp':
371
+ return this.sendWhatsApp({
372
+ templateCode: payload.templateCode,
373
+ phoneNumber: payload.phoneNumber,
374
+ options: payload.options,
375
+ whatsappTemplateName: payload.whatsappTemplateName,
376
+ mediaUrl: payload.mediaUrl,
377
+ });
378
+ default:
379
+ return { success: false, message: `Unknown channel: ${channel}` };
380
+ }
381
+ }
382
+ async send(payload) {
383
+ var _a;
384
+ const results = {};
385
+ for (const channel of payload.channels) {
386
+ results[channel] = await this.sendToChannel(channel, payload);
387
+ }
388
+ const primarySuccess = Object.values(results).some(r => r.success);
389
+ if (!primarySuccess && ((_a = payload.fallback) === null || _a === void 0 ? void 0 : _a.length)) {
390
+ const fallbackAttempted = [];
391
+ let fallbackSucceeded;
392
+ for (const fallbackChannel of payload.fallback) {
393
+ fallbackAttempted.push(fallbackChannel);
394
+ const fallbackResult = await this.sendToChannel(fallbackChannel, payload);
395
+ results[fallbackChannel] = fallbackResult;
396
+ if (fallbackResult.success) {
397
+ fallbackSucceeded = fallbackChannel;
398
+ break;
399
+ }
400
+ }
401
+ return {
402
+ results,
403
+ success: !!fallbackSucceeded,
404
+ fallbackAttempted,
405
+ fallbackSucceeded,
406
+ };
407
+ }
408
+ return {
409
+ results,
410
+ success: primarySuccess,
411
+ };
412
+ }
162
413
  };
163
414
  exports.NotificationService = NotificationService;
164
415
  exports.NotificationService = NotificationService = NotificationService_1 = __decorate([
@@ -167,8 +418,18 @@ exports.NotificationService = NotificationService = NotificationService_1 = __de
167
418
  __param(1, (0, common_1.Inject)(email_1.EmailService)),
168
419
  __param(2, (0, common_1.Optional)()),
169
420
  __param(2, (0, common_1.Inject)(push_notification_1.PushNotificationService)),
421
+ __param(3, (0, common_1.Optional)()),
422
+ __param(3, (0, common_1.Inject)(sms_1.SmsService)),
423
+ __param(4, (0, common_1.Optional)()),
424
+ __param(4, (0, common_1.Inject)(whatsapp_1.WhatsAppService)),
425
+ __param(5, (0, common_1.Optional)()),
426
+ __param(5, (0, common_1.Inject)(constant_1.NOTIFICATION_OPTIONS)),
427
+ __param(6, (0, common_1.Optional)()),
428
+ __param(6, (0, common_1.Inject)(notification_interceptor_1.NOTIFICATION_INTERCEPTORS)),
170
429
  __metadata("design:paramtypes", [template_1.TemplateLoader,
171
430
  email_1.EmailService,
172
- push_notification_1.PushNotificationService])
431
+ push_notification_1.PushNotificationService,
432
+ sms_1.SmsService,
433
+ whatsapp_1.WhatsAppService, Object, Array])
173
434
  ], NotificationService);
174
435
  //# sourceMappingURL=notification.service.js.map
@@ -1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Aa,CAAC,CAAC;QACvF,IAAI,CAAC,eAAe,EAAE,CAAC;YACrB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,YAAY,qDAAqD,CAAC,CAAA;YAChG,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,IAAI,CAAC,gCAAgC,CAAC,MAAM,EAAE;YACnD,OAAO,EAAE,eAAe,CAAC,OAAO,IAAI,EAAE;YACtC,OAAO,EAAE,eAAe,CAAC,OAAO;SACjC,CAAC,CAAA;IACJ,CAAC;IAES,cAAc,CAAC,KAAU;QACjC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,cAAc,IAAI,KAAK,IAAI,OAAO,IAAI,KAAK,CAAC;IAClF,CAAC;IAAA,CAAC;IAEQ,yBAAyB,CAAC,KAAU;QAC5C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,cAAc,IAAI,KAAK,IAAI,CAAC,QAAQ,IAAI,KAAK,IAAI,aAAa,IAAI,KAAK,CAAC,CAAC;IAC/G,CAAC;CAEF,CAAA;AAhKY,kDAAmB;8BAAnB,mBAAmB;IAGjB,WAAA,IAAA,eAAM,EAAC,0BAAe,CAAC,CAAA;IACjC,WAAA,IAAA,iBAAQ,GAAE,CAAA;IAAE,WAAA,IAAA,eAAM,EAAC,oBAAY,CAAC,CAAA;IAChC,WAAA,IAAA,iBAAQ,GAAE,CAAA;IAAE,WAAA,IAAA,eAAM,EAAC,2CAAuB,CAAC,CAAA;qCAFwB,yBAAc;QACjB,oBAAY;QACU,2CAAuB;GALrG,mBAAmB,CAgK/B"}
1
+ {"version":3,"file":"notification.service.js","sourceRoot":"","sources":["../../lib/notification/notification.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA0D;AAC1D,0CAA6E;AAC7E,oCAAwC;AAExC,4DAA4E;AAC5E,gCAAoC;AACpC,0CAA8C;AAC9C,yCAAkD;AAElD,qCAAmD;AACnD,yEAAqH;AAErH,IAAa,mBAAmB,2BAAhC,MA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AAE,CAAA;IAAE,WAAA,IAAA,eAAM,EAAC,oDAAyB,CAAC,CAAA;qCANY,yBAAc;QACP,oBAAY;QACU,2CAAuB;QACjD,gBAAU;QACA,0BAAe;GAV7E,mBAAmB,CAqd/B"}
@@ -0,0 +1,17 @@
1
+ import { Type } from '@nestjs/common';
2
+ import { NotificationChannel } from '../interface';
3
+ import { EmailProvider } from '../email';
4
+ import { PushNotificationProvider } from '../push-notification';
5
+ import { SmsProvider } from '../sms';
6
+ import { WhatsAppProvider } from '../whatsapp';
7
+ export type ChannelProviderMap = {
8
+ email: EmailProvider;
9
+ push: PushNotificationProvider;
10
+ sms: SmsProvider;
11
+ whatsapp: WhatsAppProvider;
12
+ };
13
+ export interface ProviderConfig<C extends NotificationChannel = NotificationChannel> {
14
+ channel: C;
15
+ provider: Type<ChannelProviderMap[C]>;
16
+ options?: any;
17
+ }
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=payload.inteface.js.map
3
+ //# sourceMappingURL=provider-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider-config.js","sourceRoot":"","sources":["../../lib/notification/provider-config.ts"],"names":[],"mappings":""}
@@ -4,8 +4,11 @@ import { PushMessage, SendResult, PushMessageOnly, BatchSendResult } from "../in
4
4
  export declare class FCMPushNotificationProvider extends PushNotificationProvider {
5
5
  private readonly option;
6
6
  private readonly client;
7
+ private readonly appName;
7
8
  constructor(option: FCMPushNotificationOption);
8
9
  get type(): PushNotificationPlatform;
10
+ get supportsAttachments(): boolean;
11
+ destroy(): Promise<void>;
9
12
  send(message: PushMessage): Promise<SendResult>;
10
13
  sendMulticast(tokens: string[], message: PushMessageOnly): Promise<BatchSendResult>;
11
14
  private generateMessage;
@@ -4,19 +4,34 @@ exports.FCMPushNotificationProvider = void 0;
4
4
  const load_package_util_1 = require("@nestjs/common/utils/load-package.util");
5
5
  const push_notification_provider_1 = require("./push-notification.provider");
6
6
  const common_1 = require("@nathapp/common");
7
+ const crypto_1 = require("crypto");
7
8
  class FCMPushNotificationProvider extends push_notification_provider_1.PushNotificationProvider {
8
9
  constructor(option) {
9
10
  super();
10
11
  const Firebase = (0, load_package_util_1.loadPackage)('firebase-admin', FCMPushNotificationProvider.name, () => require('firebase-admin'));
11
12
  this.option = option;
13
+ this.appName = `fcm-${(0, crypto_1.randomUUID)()}`;
14
+ let serviceAccountData;
15
+ try {
16
+ serviceAccountData = JSON.parse(option.serviceAccount);
17
+ }
18
+ catch (error) {
19
+ throw new Error(`Invalid Firebase service account JSON: failed to parse (${error.message}). Verify the JSON format of your service account configuration.`);
20
+ }
12
21
  this.client = Firebase.initializeApp({
13
- credential: Firebase.credential.cert(JSON.parse(option.serviceAccount)),
22
+ credential: Firebase.credential.cert(serviceAccountData),
14
23
  databaseURL: option.databaseUrl,
15
- });
24
+ }, this.appName);
16
25
  }
17
26
  get type() {
18
27
  return "firebase";
19
28
  }
29
+ get supportsAttachments() {
30
+ return false;
31
+ }
32
+ async destroy() {
33
+ await this.client.delete();
34
+ }
20
35
  async send(message) {
21
36
  const firebaseMessage = this.generateMessage(message);
22
37
  const messageId = await this.client.messaging().send(firebaseMessage);
@@ -1 +1 @@
1
- {"version":3,"file":"fcm-push-notification.provider.js","sourceRoot":"","sources":["../../lib/push-notification/fcm-push-notification.provider.ts"],"names":[],"mappings":";;;AAEA,8EAAqE;AACrE,6EAAwE;AAExE,4CAA2D;AAK3D,MAAa,2BAA4B,SAAQ,qDAAwB;IAGvE,YAAY,MAAiC;QAC3C,KAAK,EAAE,CAAC;QACR,MAAM,QAAQ,GAAG,IAAA,+BAAW,EAAC,gBAAgB,EAAE,2BAA2B,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC;QAClH,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC;YACnC,UAA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BAAkB,CAAC,WAAW,CAAC,SAAS,EAAE,WAAW,CAAiB,CAAC;IACrF,CAAC;IAGO,kBAAkB,CAAC,KAAwB,EAAE,WAA0C;QAE7F,MAAM,cAAc,GAAyB;YAC3C,YAAY,EAAE;gBACV,KAAK,EAAE,WAAW,CAAC,OAAO;gBAC1B,IAAI,EAAE,WAAW,CAAC,OAAO;aAC5B;YACD,IAAI,EAAE,WAAW,CAAC,IAAI;YACtB,IAAI,EAAE;gBACF,OAAO,EAAE;oBACL,GAAG,EAAE;wBACD,cAAc,EAAE,IAAI;wBACpB,gBAAgB,EAAE,IAAI;wBACtB,YAAY,EAAE,YAAY;qBAC7B;iBAEJ;aACF;SACJ,CAAC;QAEF,IAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACxB,OAAO;gBACL,GAAG,cAAc;gBACjB,MAAM,EAAE,KAAK;aACd,CAAA;QACH,CAAC;QACD,OAAO;YACL,GAAG,cAAc;YACjB,KAAK,EAAE,KAAK;SACb,CAAA;IACH,CAAC;CACF;AA/ED,kEA+EC"}
1
+ {"version":3,"file":"fcm-push-notification.provider.js","sourceRoot":"","sources":["../../lib/push-notification/fcm-push-notification.provider.ts"],"names":[],"mappings":";;;AAEA,8EAAqE;AACrE,6EAAwE;AAExE,4CAA2D;AAC3D,mCAAoC;AAKpC,MAAa,2BAA4B,SAAQ,qDAAwB;IAKvE,YAAY,MAAiC;QAC3C,KAAK,EAAE,CAAC;QACR,MAAM,QAAQ,GAAG,IAAA,+BAAW,EAAC,gBAAgB,EAAE,2BAA2B,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC;QAClH,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,IAAA,mBAAU,GAAE,EAAE,CAAC;QAErC,IAAI,kBAAkB,CAAC;QACvB,IAAI,CAAC;YACH,kBAAkB,GAAG,IAAI,CAA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AAE;;gBAC7C,OAAO;oBACL,OAAO,EAAE,QAAQ,CAAC,OAAO;oBACzB,SAAS,EAAE,QAAQ,CAAC,SAAS;oBAC7B,OAAO,EAAE,MAAA,QAAQ,CAAC,KAAK,0CAAE,OAAO;oBAChC,KAAK,EAAE,QAAQ,CAAC,KAAK;iBACtB,CAAC;YACJ,CAAC,CAAC;YACF,YAAY,EAAE,aAAa,CAAC,YAAY;YACxC,YAAY,EAAE,aAAa,CAAC,YAAY;SACzC,CAAA;IACH,CAAC;IAEO,eAAe,CAAC,WAAwB;QAC9C,OAAO,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,SAAS,EAAE,WAAW,CAAiB,CAAC;IACrF,CAAC;IAGO,kBAAkB,CAAC,KAAwB,EAAE,WAA0C;QAE7F,MAAM,cAAc,GAAyB;YAC3C,YAAY,EAAE;gBACV,KAAK,EAAE,WAAW,CAAC,OAAO;gBAC1B,IAAI,EAAE,WAAW,CAAC,OAAO;aAC5B;YACD,IAAI,EAAE,WAAW,CAAC,IAAI;YACtB,IAAI,EAAE;gBACF,OAAO,EAAE;oBACL,GAAG,EAAE;wBACD,cAAc,EAAE,IAAI;wBACpB,gBAAgB,EAAE,IAAI;wBACtB,YAAY,EAAE,YAAY;qBAC7B;iBAEJ;aACF;SACJ,CAAC;QAEF,IAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACxB,OAAO;gBACL,GAAG,cAAc;gBACjB,MAAM,EAAE,KAAK;aACd,CAAA;QACH,CAAC;QACD,OAAO;YACL,GAAG,cAAc;YACjB,KAAK,EAAE,KAAK;SACb,CAAA;IACH,CAAC;CACF;AAvGD,kEAuGC"}
@@ -5,6 +5,7 @@ export interface FirebaseMessaging {
5
5
  }
6
6
  export interface FirebaseApp {
7
7
  messaging(): FirebaseMessaging;
8
+ delete(): Promise<void>;
8
9
  }
9
10
  export interface BaseMessage {
10
11
  data?: {
@@ -1,11 +1,8 @@
1
1
  import { PUSH_NOTIFICATION_PROVIDERS } from "./constant";
2
2
  import { FCMPushNotificationProvider } from "./fcm-push-notification.provider";
3
- import { PushNotificationModuleAsyncOptions, PushNotificationModuleOptions, PushNotificationProviderAsyncOptions, PushNotificationProviderModuleOptionsFactory, PushNotificationProviderOptions } from "./push-notification-module.interface";
4
3
  import { DeviceToken, FCMPushNotificationOption, PlatformOS, PushNotificationOption, PushNotificationPlatform } from "./push-notification.interface";
5
- import { PushNotificationModule } from "./push-notification.module";
6
4
  import { PushNotificationProvider } from "./push-notification.provider";
7
5
  import { DefaultProviderManager, ProviderManager } from "./push-notification-provider.manager";
8
6
  import { PushNotificationService } from "./push-notification.service";
9
- import { DefaultFirebasePushNotificationProviderModuleOptionsFactory } from "./push-notification-provider-module.factory";
10
7
  import { IUserTokenStore, InMemoryUserTokenStore, TokenId, UserTokenStore } from "./user-token.store";
11
- export { PushNotificationService, FCMPushNotificationOption, PushNotificationOption, FCMPushNotificationProvider, PushNotificationProvider, PushNotificationPlatform, PlatformOS, ProviderManager, PushNotificationProviderOptions, PushNotificationModuleOptions, PushNotificationProviderModuleOptionsFactory, PushNotificationProviderAsyncOptions, PushNotificationModuleAsyncOptions, PUSH_NOTIFICATION_PROVIDERS, PushNotificationModule, DefaultProviderManager, DeviceToken, DefaultFirebasePushNotificationProviderModuleOptionsFactory, TokenId, IUserTokenStore, UserTokenStore, InMemoryUserTokenStore, };
8
+ export { PushNotificationService, FCMPushNotificationOption, PushNotificationOption, FCMPushNotificationProvider, PushNotificationProvider, PushNotificationPlatform, PlatformOS, ProviderManager, PUSH_NOTIFICATION_PROVIDERS, DefaultProviderManager, DeviceToken, TokenId, IUserTokenStore, UserTokenStore, InMemoryUserTokenStore, };
@@ -1,14 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InMemoryUserTokenStore = exports.UserTokenStore = exports.DefaultFirebasePushNotificationProviderModuleOptionsFactory = exports.DefaultProviderManager = exports.PushNotificationModule = exports.PUSH_NOTIFICATION_PROVIDERS = exports.ProviderManager = exports.PlatformOS = exports.PushNotificationProvider = exports.FCMPushNotificationProvider = exports.PushNotificationService = void 0;
3
+ exports.InMemoryUserTokenStore = exports.UserTokenStore = exports.DefaultProviderManager = exports.PUSH_NOTIFICATION_PROVIDERS = exports.ProviderManager = exports.PlatformOS = exports.PushNotificationProvider = exports.FCMPushNotificationProvider = exports.PushNotificationService = void 0;
4
4
  const constant_1 = require("./constant");
5
5
  Object.defineProperty(exports, "PUSH_NOTIFICATION_PROVIDERS", { enumerable: true, get: function () { return constant_1.PUSH_NOTIFICATION_PROVIDERS; } });
6
6
  const fcm_push_notification_provider_1 = require("./fcm-push-notification.provider");
7
7
  Object.defineProperty(exports, "FCMPushNotificationProvider", { enumerable: true, get: function () { return fcm_push_notification_provider_1.FCMPushNotificationProvider; } });
8
8
  const push_notification_interface_1 = require("./push-notification.interface");
9
9
  Object.defineProperty(exports, "PlatformOS", { enumerable: true, get: function () { return push_notification_interface_1.PlatformOS; } });
10
- const push_notification_module_1 = require("./push-notification.module");
11
- Object.defineProperty(exports, "PushNotificationModule", { enumerable: true, get: function () { return push_notification_module_1.PushNotificationModule; } });
12
10
  const push_notification_provider_1 = require("./push-notification.provider");
13
11
  Object.defineProperty(exports, "PushNotificationProvider", { enumerable: true, get: function () { return push_notification_provider_1.PushNotificationProvider; } });
14
12
  const push_notification_provider_manager_1 = require("./push-notification-provider.manager");
@@ -16,8 +14,6 @@ Object.defineProperty(exports, "DefaultProviderManager", { enumerable: true, get
16
14
  Object.defineProperty(exports, "ProviderManager", { enumerable: true, get: function () { return push_notification_provider_manager_1.ProviderManager; } });
17
15
  const push_notification_service_1 = require("./push-notification.service");
18
16
  Object.defineProperty(exports, "PushNotificationService", { enumerable: true, get: function () { return push_notification_service_1.PushNotificationService; } });
19
- const push_notification_provider_module_factory_1 = require("./push-notification-provider-module.factory");
20
- Object.defineProperty(exports, "DefaultFirebasePushNotificationProviderModuleOptionsFactory", { enumerable: true, get: function () { return push_notification_provider_module_factory_1.DefaultFirebasePushNotificationProviderModuleOptionsFactory; } });
21
17
  const user_token_store_1 = require("./user-token.store");
22
18
  Object.defineProperty(exports, "InMemoryUserTokenStore", { enumerable: true, get: function () { return user_token_store_1.InMemoryUserTokenStore; } });
23
19
  Object.defineProperty(exports, "UserTokenStore", { enumerable: true, get: function () { return user_token_store_1.UserTokenStore; } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/push-notification/index.ts"],"names":[],"mappings":";;;AAAA,yCAAyD;AAyBvD,4GAzBO,sCAA2B,OAyBP;AAxB7B,qFAA+E;AAc7E,4GAdO,4DAA2B,OAcP;AAZ7B,+EAAqJ;AAenJ,2FAf+C,wCAAU,OAe/C;AAdZ,yEAAoE;AAsBlE,uGAtBO,iDAAsB,OAsBP;AArBxB,6EAAwE;AAWtE,yGAXO,qDAAwB,OAWP;AAV1B,6FAA+F;AAqB7F,uGArBO,2DAAsB,OAqBP;AARtB,gGAb+B,oDAAe,OAa/B;AAZjB,2EAAsE;AAKpE,wGALO,mDAAuB,OAKP;AAJzB,2GAA0H;AAqBxH,4IArBO,uGAA2D,OAqBP;AApB7D,yDAAsG;AAwBpG,uGAxBwB,yCAAsB,OAwBxB;AADtB,+FAvByD,iCAAc,OAuBzD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/push-notification/index.ts"],"names":[],"mappings":";;;AAAA,yCAAyD;AAiBvD,4GAjBO,sCAA2B,OAiBP;AAhB7B,qFAA+E;AAW7E,4GAXO,4DAA2B,OAWP;AAV7B,+EAAqJ;AAanJ,2FAb+C,wCAAU,OAa/C;AAZZ,6EAAwE;AAUtE,yGAVO,qDAAwB,OAUP;AAT1B,6FAA+F;AAc7F,uGAdO,2DAAsB,OAcP;AAFtB,gGAZ+B,oDAAe,OAY/B;AAXjB,2EAAsE;AAIpE,wGAJO,mDAAuB,OAIP;AAHzB,yDAAsG;AAiBpG,uGAjBwB,yCAAsB,OAiBxB;AADtB,+FAhByD,iCAAc,OAgBzD"}
@@ -1,13 +1,18 @@
1
+ import { OnModuleDestroy } from "@nestjs/common";
1
2
  import { PushNotificationProvider } from "./push-notification.provider";
2
3
  import { PlatformOS } from "./push-notification.interface";
3
4
  export declare abstract class ProviderManager {
4
- abstract getProvider(paltform?: PlatformOS): PushNotificationProvider;
5
+ abstract getProvider(platform?: PlatformOS): PushNotificationProvider;
5
6
  abstract get defaultProvider(): PushNotificationProvider;
7
+ abstract destroy(): Promise<void>;
6
8
  }
7
- export declare class DefaultProviderManager extends ProviderManager {
9
+ export declare class DefaultProviderManager extends ProviderManager implements OnModuleDestroy {
8
10
  private readonly _defaultProvider;
9
11
  private readonly keysProviders;
12
+ private readonly allProviders;
10
13
  constructor(providers: PushNotificationProvider[]);
11
14
  get defaultProvider(): PushNotificationProvider;
12
- getProvider(paltform?: PlatformOS): PushNotificationProvider;
15
+ getProvider(platform?: PlatformOS): PushNotificationProvider;
16
+ destroy(): Promise<void>;
17
+ onModuleDestroy(): Promise<void>;
13
18
  }
@@ -13,6 +13,7 @@ class DefaultProviderManager extends ProviderManager {
13
13
  throw new Error("please provide at lease one PushNotificationProvider");
14
14
  }
15
15
  this._defaultProvider = providers[0];
16
+ this.allProviders = providers;
16
17
  providers.forEach(item => {
17
18
  this.keysProviders[item.type] = item;
18
19
  });
@@ -20,12 +21,12 @@ class DefaultProviderManager extends ProviderManager {
20
21
  get defaultProvider() {
21
22
  return this._defaultProvider;
22
23
  }
23
- getProvider(paltform) {
24
+ getProvider(platform) {
24
25
  let provider = undefined;
25
- if (paltform == push_notification_interface_1.PlatformOS.android || paltform == push_notification_interface_1.PlatformOS.ios) {
26
+ if (platform == push_notification_interface_1.PlatformOS.android || platform == push_notification_interface_1.PlatformOS.ios) {
26
27
  provider = this.keysProviders["firebase"];
27
28
  }
28
- else if (paltform == "huawei") {
29
+ else if (platform == "huawei") {
29
30
  provider = this.keysProviders["hms"];
30
31
  }
31
32
  if (!provider) {
@@ -33,6 +34,14 @@ class DefaultProviderManager extends ProviderManager {
33
34
  }
34
35
  return provider;
35
36
  }
37
+ async destroy() {
38
+ await Promise.allSettled(this.allProviders
39
+ .filter(p => typeof p.destroy === 'function')
40
+ .map(p => p.destroy()));
41
+ }
42
+ async onModuleDestroy() {
43
+ await this.destroy();
44
+ }
36
45
  }
37
46
  exports.DefaultProviderManager = DefaultProviderManager;
38
47
  //# sourceMappingURL=push-notification-provider.manager.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"push-notification-provider.manager.js","sourceRoot":"","sources":["../../lib/push-notification/push-notification-provider.manager.ts"],"names":[],"mappings":";;;AAEA,+EAA2D;AAG3D,MAAsB,eAAe;CAMpC;AAND,0CAMC;AAED,MAAa,sBAAuB,SAAQ,eAAe;IAMzD,YAAY,SAAqC;QAC/C,KAAK,EAAE,CAAC;QAHO,kBAAa,GAA6C,EAAE,CAAC;QAI5E,IAAI,SAAS,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;QAC1E,CAAC;QACD,IAAI,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;QACrC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACvB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;QACvC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;IAED,WAAW,CAAC,QAAqB;QAC/B,IAAI,QAAQ,GAA6B,SAAS,CAAC;QAEnD,IAAI,QAAQ,IAAI,wCAAU,CAAC,OAAO,IAAI,QAAQ,IAAI,wCAAU,CAAC,GAAG,EAAE,CAAC;YACjE,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QAC5C,CAAC;aAAM,IAAI,QAAQ,IAAI,QAAQ,EAAE,CAAC;YAChC,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QACvC,CAAC;QAED,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAC;QAClC,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CAGF;AArCD,wDAqCC"}
1
+ {"version":3,"file":"push-notification-provider.manager.js","sourceRoot":"","sources":["../../lib/push-notification/push-notification-provider.manager.ts"],"names":[],"mappings":";;;AAGA,+EAA2D;AAG3D,MAAsB,eAAe;CASpC;AATD,0CASC;AAED,MAAa,sBAAuB,SAAQ,eAAe;IAOzD,YAAY,SAAqC;QAC/C,KAAK,EAAE,CAAC;QAJO,kBAAa,GAA6C,EAAE,CAAC;QAK5E,IAAI,SAAS,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;QAC1E,CAAC;QACD,IAAI,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;QACrC,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC;QAC9B,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACvB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;QACvC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;IAED,WAAW,CAAC,QAAqB;QAC/B,IAAI,QAAQ,GAA6B,SAAS,CAAC;QAEnD,IAAI,QAAQ,IAAI,wCAAU,CAAC,OAAO,IAAI,QAAQ,IAAI,wCAAU,CAAC,GAAG,EAAE,CAAC;YACjE,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QAC5C,CAAC;aAAM,IAAI,QAAQ,IAAI,QAAQ,EAAE,CAAC;YAChC,QAAQ,GAAG,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