@nathapp/nestjs-notification 1.0.0-rc.5 → 1.0.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.
Files changed (102) hide show
  1. package/README.md +3 -3
  2. package/dist/email/constant.js +1 -0
  3. package/dist/email/constant.js.map +1 -0
  4. package/dist/email/email-provider.factory.js +1 -0
  5. package/dist/email/email-provider.factory.js.map +1 -0
  6. package/dist/email/email.interface.js +1 -0
  7. package/dist/email/email.interface.js.map +1 -0
  8. package/dist/email/email.module.d.ts +3 -0
  9. package/dist/email/email.module.js +20 -5
  10. package/dist/email/email.module.js.map +1 -0
  11. package/dist/email/email.provider.d.ts +2 -0
  12. package/dist/email/email.provider.js +29 -7
  13. package/dist/email/email.provider.js.map +1 -0
  14. package/dist/email/email.service.d.ts +1 -1
  15. package/dist/email/email.service.js +3 -2
  16. package/dist/email/email.service.js.map +1 -0
  17. package/dist/email/index.d.ts +2 -2
  18. package/dist/email/index.js +3 -1
  19. package/dist/email/index.js.map +1 -0
  20. package/dist/index.d.ts +1 -0
  21. package/dist/index.js +2 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/interface/index.d.ts +4 -2
  24. package/dist/interface/index.js +1 -0
  25. package/dist/interface/index.js.map +1 -0
  26. package/dist/interface/message.interface.d.ts +13 -0
  27. package/dist/interface/message.interface.js +1 -0
  28. package/dist/interface/message.interface.js.map +1 -0
  29. package/dist/interface/payload.inteface.d.ts +22 -0
  30. package/dist/interface/payload.inteface.js +3 -0
  31. package/dist/interface/payload.inteface.js.map +1 -0
  32. package/dist/interface/result.interface.d.ts +5 -0
  33. package/dist/interface/result.interface.js +1 -0
  34. package/dist/interface/result.interface.js.map +1 -0
  35. package/dist/notification/constant.js +1 -0
  36. package/dist/notification/constant.js.map +1 -0
  37. package/dist/notification/index.d.ts +2 -2
  38. package/dist/notification/index.js +1 -0
  39. package/dist/notification/index.js.map +1 -0
  40. package/dist/notification/notification.module.d.ts +28 -5
  41. package/dist/notification/notification.module.js +149 -10
  42. package/dist/notification/notification.module.js.map +1 -0
  43. package/dist/notification/notification.service.d.ts +14 -3
  44. package/dist/notification/notification.service.js +135 -10
  45. package/dist/notification/notification.service.js.map +1 -0
  46. package/dist/push-notification/constant.d.ts +1 -0
  47. package/dist/push-notification/constant.js +5 -0
  48. package/dist/push-notification/constant.js.map +1 -0
  49. package/dist/push-notification/fcm-push-notification.provider.d.ts +13 -0
  50. package/dist/push-notification/fcm-push-notification.provider.js +78 -0
  51. package/dist/push-notification/fcm-push-notification.provider.js.map +1 -0
  52. package/dist/push-notification/firebase.interface.d.ts +144 -0
  53. package/dist/push-notification/firebase.interface.js +3 -0
  54. package/dist/push-notification/firebase.interface.js.map +1 -0
  55. package/dist/push-notification/index.d.ts +11 -0
  56. package/dist/push-notification/index.js +24 -0
  57. package/dist/push-notification/index.js.map +1 -0
  58. package/dist/push-notification/push-notification-module.interface.d.ts +33 -0
  59. package/dist/push-notification/push-notification-module.interface.js +4 -0
  60. package/dist/push-notification/push-notification-module.interface.js.map +1 -0
  61. package/dist/push-notification/push-notification-provider-module.factory.d.ts +5 -0
  62. package/dist/push-notification/push-notification-provider-module.factory.js +13 -0
  63. package/dist/push-notification/push-notification-provider-module.factory.js.map +1 -0
  64. package/dist/push-notification/push-notification-provider.factory.d.ts +5 -0
  65. package/dist/push-notification/push-notification-provider.factory.js +16 -0
  66. package/dist/push-notification/push-notification-provider.factory.js.map +1 -0
  67. package/dist/push-notification/push-notification-provider.manager.d.ts +13 -0
  68. package/dist/push-notification/push-notification-provider.manager.js +38 -0
  69. package/dist/push-notification/push-notification-provider.manager.js.map +1 -0
  70. package/dist/push-notification/push-notification.interface.d.ts +16 -0
  71. package/dist/push-notification/push-notification.interface.js +11 -0
  72. package/dist/push-notification/push-notification.interface.js.map +1 -0
  73. package/dist/push-notification/push-notification.module.d.ts +15 -0
  74. package/dist/push-notification/push-notification.module.js +189 -0
  75. package/dist/push-notification/push-notification.module.js.map +1 -0
  76. package/dist/push-notification/push-notification.provider.d.ts +12 -0
  77. package/dist/push-notification/push-notification.provider.js +7 -0
  78. package/dist/push-notification/push-notification.provider.js.map +1 -0
  79. package/dist/push-notification/push-notification.service.d.ts +15 -0
  80. package/dist/push-notification/push-notification.service.js +66 -0
  81. package/dist/push-notification/push-notification.service.js.map +1 -0
  82. package/dist/push-notification/user-token.store.d.ts +19 -0
  83. package/dist/push-notification/user-token.store.js +44 -0
  84. package/dist/push-notification/user-token.store.js.map +1 -0
  85. package/dist/sms/index.js +1 -0
  86. package/dist/sms/index.js.map +1 -0
  87. package/dist/sms/sms.service.js +1 -0
  88. package/dist/sms/sms.service.js.map +1 -0
  89. package/dist/template/constant.js +1 -0
  90. package/dist/template/constant.js.map +1 -0
  91. package/dist/template/fake-template.loader.d.ts +3 -0
  92. package/dist/template/fake-template.loader.js +15 -1
  93. package/dist/template/fake-template.loader.js.map +1 -0
  94. package/dist/template/index.d.ts +2 -2
  95. package/dist/template/index.js +3 -1
  96. package/dist/template/index.js.map +1 -0
  97. package/dist/template/template.loader.js +3 -2
  98. package/dist/template/template.loader.js.map +1 -0
  99. package/dist/template/template.service.js +3 -2
  100. package/dist/template/template.service.js.map +1 -0
  101. package/package.json +13 -22
  102. package/.eslintrc.js +0 -24
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.PushNotificationService = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const push_notification_provider_manager_1 = require("./push-notification-provider.manager");
15
+ const user_token_store_1 = require("./user-token.store");
16
+ let PushNotificationService = class PushNotificationService {
17
+ constructor(providerManager, userTokenStore) {
18
+ this.providerManager = providerManager;
19
+ this.userTokenStore = userTokenStore;
20
+ }
21
+ async saveUserToken(userId, token) {
22
+ return this.userTokenStore.saveUserToken(userId, token);
23
+ }
24
+ async getUserDeviceToken(userId) {
25
+ return this.userTokenStore.getUserDeviceToken(userId);
26
+ }
27
+ async getUserDeviceTokens(userId) {
28
+ return this.userTokenStore.getUserDeviceTokens(userId);
29
+ }
30
+ send(message) {
31
+ return this.providerManager.getProvider(message.paltform).send(message);
32
+ }
33
+ async sendMulticast(tokens, message) {
34
+ const groupedKeys = this.groupDevicesToken(tokens);
35
+ const results = [];
36
+ for (const [key, value] of Object.entries(groupedKeys)) {
37
+ const provider = this.providerManager.getProvider(key);
38
+ const tokens = value;
39
+ const result = await provider.sendMulticast(tokens, message);
40
+ results.push(result);
41
+ }
42
+ return results.reduce((a, b) => {
43
+ const results = [...a.results, ...b.results];
44
+ return {
45
+ results,
46
+ successCount: a.successCount + b.successCount,
47
+ failureCount: a.failureCount + b.failureCount,
48
+ };
49
+ });
50
+ }
51
+ groupDevicesToken(tokens) {
52
+ return tokens.reduce((group, item) => {
53
+ if (!group[item.type]) {
54
+ group[item.type] = [];
55
+ }
56
+ group[item.type].push(item.data);
57
+ return group;
58
+ }, {});
59
+ }
60
+ };
61
+ exports.PushNotificationService = PushNotificationService;
62
+ exports.PushNotificationService = PushNotificationService = __decorate([
63
+ (0, common_1.Injectable)(),
64
+ __metadata("design:paramtypes", [push_notification_provider_manager_1.ProviderManager, user_token_store_1.UserTokenStore])
65
+ ], PushNotificationService);
66
+ //# sourceMappingURL=push-notification.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"push-notification.service.js","sourceRoot":"","sources":["../../lib/push-notification/push-notification.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAG5C,6FAAuE;AACvE,yDAA6D;AAGtD,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAElC,YAA6B,eAAgC,EAAmB,cAA8B;QAAjF,oBAAe,GAAf,eAAe,CAAiB;QAAmB,mBAAc,GAAd,cAAc,CAAgB;IAC9G,CAAC;IAED,KAAK,CAAC,aAAa,CACjB,MAAuB,EACvB,KAAkB;QAElB,OAAO,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC1D,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,MAAuB;QAC9C,OAAO,IAAI,CAAC,cAAc,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACxD,CAAC;IACD,KAAK,CAAC,mBAAmB,CAAC,MAAuB;QAC/C,OAAO,IAAI,CAAC,cAAc,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;IACzD,CAAC;IAED,IAAI,CAAC,OAAoB;QACvB,OAAO,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC1E,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,MAAqB,EAAE,OAAwB;QACjE,MAAM,WAAW,GAAG,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;QACnD,MAAM,OAAO,GAAG,EAAE,CAAC;QACnB,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;YACvD,MAAM,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,GAAiB,CAAC,CAAC;YACrE,MAAM,MAAM,GAAG,KAAK,CAAC;YACrB,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAC7D,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACvB,CAAC;QAED,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAkB,EAAE,CAAkB,EAAE,EAAE;YAC/D,MAAM,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,CAAA;YAC5C,OAAO;gBACL,OAAO;gBACP,YAAY,EAAE,CAAC,CAAC,YAAY,GAAG,CAAC,CAAC,YAAY;gBAC7C,YAAY,EAAE,CAAC,CAAC,YAAY,GAAG,CAAC,CAAC,YAAY;aAC9C,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAEO,iBAAiB,CAAC,MAAqB;QAC7C,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,KAAkC,EAAE,IAAI,EAAE,EAAE;YAChE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;gBACtB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;YACxB,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACjC,OAAO,KAAK,CAAC;QACf,CAAC,EAAE,EAAE,CAAC,CAAC;IACT,CAAC;CACF,CAAA;AApDY,0DAAuB;kCAAvB,uBAAuB;IADnC,IAAA,mBAAU,GAAE;qCAGmC,oDAAe,EAAmC,iCAAc;GAFnG,uBAAuB,CAoDnC"}
@@ -0,0 +1,19 @@
1
+ import { DeviceToken } from './push-notification.interface';
2
+ export type TokenId = string | number;
3
+ export interface IUserTokenStore {
4
+ saveUserToken(userId: string | number, token: DeviceToken): Promise<TokenId>;
5
+ getUserDeviceToken(userId: string | number): Promise<DeviceToken>;
6
+ getUserDeviceTokens(userId: string | number): Promise<DeviceToken[]>;
7
+ }
8
+ export declare abstract class UserTokenStore implements IUserTokenStore {
9
+ abstract saveUserToken(userId: string | number, token: DeviceToken): Promise<TokenId>;
10
+ abstract getUserDeviceToken(userId: string | number): Promise<DeviceToken>;
11
+ abstract getUserDeviceTokens(userId: string | number): Promise<DeviceToken[]>;
12
+ }
13
+ export declare class InMemoryUserTokenStore extends UserTokenStore {
14
+ private readonly cache;
15
+ constructor();
16
+ saveUserToken(userId: string | number, token: DeviceToken): Promise<TokenId>;
17
+ getUserDeviceToken(userId: string | number): Promise<DeviceToken>;
18
+ getUserDeviceTokens(userId: string | number): Promise<DeviceToken[]>;
19
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.InMemoryUserTokenStore = exports.UserTokenStore = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ class UserTokenStore {
15
+ }
16
+ exports.UserTokenStore = UserTokenStore;
17
+ let InMemoryUserTokenStore = class InMemoryUserTokenStore extends UserTokenStore {
18
+ constructor() {
19
+ super();
20
+ this.cache = {};
21
+ }
22
+ async saveUserToken(userId, token) {
23
+ this.cache[userId] = token;
24
+ return userId;
25
+ }
26
+ async getUserDeviceToken(userId) {
27
+ if (this.cache[userId]) {
28
+ return this.cache[userId];
29
+ }
30
+ return null;
31
+ }
32
+ async getUserDeviceTokens(userId) {
33
+ if (this.cache[userId]) {
34
+ return [this.cache[userId]];
35
+ }
36
+ return [];
37
+ }
38
+ };
39
+ exports.InMemoryUserTokenStore = InMemoryUserTokenStore;
40
+ exports.InMemoryUserTokenStore = InMemoryUserTokenStore = __decorate([
41
+ (0, common_1.Injectable)(),
42
+ __metadata("design:paramtypes", [])
43
+ ], InMemoryUserTokenStore);
44
+ //# sourceMappingURL=user-token.store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-token.store.js","sourceRoot":"","sources":["../../lib/push-notification/user-token.store.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAa5C,MAAsB,cAAc;CASnC;AATD,wCASC;AAMM,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,cAAc;IAGxD;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,aAAa,CACjB,MAAuB,EACvB,KAAkB;QAElB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC;QAC3B,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,MAAuB;QAC9C,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;YACvB,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC5B,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,KAAK,CAAC,mBAAmB,CAAC,MAAuB;QAC/C,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;YACvB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;QAC9B,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;CACF,CAAA;AA5BY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,mBAAU,GAAE;;GACA,sBAAsB,CA4BlC"}
package/dist/sms/index.js CHANGED
@@ -3,3 +3,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SmsService = void 0;
4
4
  const sms_service_1 = require("./sms.service");
5
5
  Object.defineProperty(exports, "SmsService", { enumerable: true, get: function () { return sms_service_1.SmsService; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/sms/index.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAElC,2FAFA,wBAAU,OAEA"}
@@ -4,3 +4,4 @@ exports.SmsService = void 0;
4
4
  class SmsService {
5
5
  }
6
6
  exports.SmsService = SmsService;
7
+ //# sourceMappingURL=sms.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sms.service.js","sourceRoot":"","sources":["../../lib/sms/sms.service.ts"],"names":[],"mappings":";;;AAQA,MAAsB,UAAU;CAE/B;AAFD,gCAEC"}
@@ -2,3 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TEMPLATE_LOADER = void 0;
4
4
  exports.TEMPLATE_LOADER = "TEMPLATE_LOADER";
5
+ //# sourceMappingURL=constant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constant.js","sourceRoot":"","sources":["../../lib/template/constant.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,iBAAiB,CAAA"}
@@ -4,3 +4,6 @@ export declare class FakeTemplateLoader extends TemplateLoader {
4
4
  constructor();
5
5
  getTemplate(templateCode: string, locale: string, fallbackLocale?: string): Promise<MessageTemplate>;
6
6
  }
7
+ export declare class EmptyTemplateLoader extends TemplateLoader {
8
+ getTemplate(templateCode: string, locale: string, fallbackLocale?: string): Promise<MessageTemplate>;
9
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FakeTemplateLoader = void 0;
3
+ exports.EmptyTemplateLoader = exports.FakeTemplateLoader = void 0;
4
4
  const common_1 = require("@nestjs/common");
5
5
  const template_loader_1 = require("./template.loader");
6
6
  class FakeTemplateLoader extends template_loader_1.TemplateLoader {
@@ -21,3 +21,17 @@ class FakeTemplateLoader extends template_loader_1.TemplateLoader {
21
21
  }
22
22
  }
23
23
  exports.FakeTemplateLoader = FakeTemplateLoader;
24
+ class EmptyTemplateLoader extends template_loader_1.TemplateLoader {
25
+ getTemplate(templateCode, locale, fallbackLocale) {
26
+ return new Promise((resolve, reject) => {
27
+ resolve({
28
+ code: templateCode,
29
+ content: '',
30
+ subject: '',
31
+ locale,
32
+ });
33
+ });
34
+ }
35
+ }
36
+ exports.EmptyTemplateLoader = EmptyTemplateLoader;
37
+ //# sourceMappingURL=fake-template.loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fake-template.loader.js","sourceRoot":"","sources":["../../lib/template/fake-template.loader.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AACxC,uDAAoE;AAEpE,MAAa,kBAAmB,SAAQ,gCAAc;IAEpD;QACE,KAAK,EAAE,CAAC;QAFO,WAAM,GAAG,IAAI,eAAM,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;QAG5D,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,kHAAkH,CAAC,CAAC;IACvI,CAAC;IAED,WAAW,CAAC,YAAoB,EAAE,MAAc,EAAE,cAAuB;QACxE,OAAO,IAAI,OAAO,CAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACvD,OAAO,CAAC;gBACN,IAAI,EAAE,YAAY;gBAClB,OAAO,EAAE,GAAG,YAAY,UAAU;gBAClC,OAAO,EAAE,GAAG,YAAY,UAAU;gBAClC,MAAM;aACP,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC;CAEF;AAlBD,gDAkBC;AAED,MAAa,mBAAoB,SAAQ,gCAAc;IACrD,WAAW,CAAC,YAAoB,EAAE,MAAc,EAAE,cAAuB;QACvE,OAAO,IAAI,OAAO,CAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACtD,OAAO,CAAC;gBACN,IAAI,EAAE,YAAY;gBAClB,OAAO,EAAC,EAAE;gBACV,OAAO,EAAC,EAAE;gBACV,MAAM;aACP,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACN,CAAC;CAEF;AAZD,kDAYC"}
@@ -1,5 +1,5 @@
1
1
  import { TEMPLATE_LOADER } from "./constant";
2
- import { FakeTemplateLoader } from "./fake-template.loader";
2
+ import { EmptyTemplateLoader, FakeTemplateLoader } from "./fake-template.loader";
3
3
  import { CacheOptions, MessageTemplate, ResolveOption, TemplateLoader, CachableTemplateLoader } from "./template.loader";
4
4
  import { TemplateService } from "./template.service";
5
- export { CacheOptions, MessageTemplate, ResolveOption, TemplateLoader, CachableTemplateLoader, TEMPLATE_LOADER, TemplateService, FakeTemplateLoader, };
5
+ export { CacheOptions, MessageTemplate, ResolveOption, TemplateLoader, CachableTemplateLoader, TEMPLATE_LOADER, TemplateService, FakeTemplateLoader, EmptyTemplateLoader, };
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FakeTemplateLoader = exports.TemplateService = exports.TEMPLATE_LOADER = exports.CachableTemplateLoader = exports.TemplateLoader = exports.MessageTemplate = void 0;
3
+ exports.EmptyTemplateLoader = exports.FakeTemplateLoader = exports.TemplateService = exports.TEMPLATE_LOADER = exports.CachableTemplateLoader = exports.TemplateLoader = exports.MessageTemplate = void 0;
4
4
  const constant_1 = require("./constant");
5
5
  Object.defineProperty(exports, "TEMPLATE_LOADER", { enumerable: true, get: function () { return constant_1.TEMPLATE_LOADER; } });
6
6
  const fake_template_loader_1 = require("./fake-template.loader");
7
+ Object.defineProperty(exports, "EmptyTemplateLoader", { enumerable: true, get: function () { return fake_template_loader_1.EmptyTemplateLoader; } });
7
8
  Object.defineProperty(exports, "FakeTemplateLoader", { enumerable: true, get: function () { return fake_template_loader_1.FakeTemplateLoader; } });
8
9
  const template_loader_1 = require("./template.loader");
9
10
  Object.defineProperty(exports, "MessageTemplate", { enumerable: true, get: function () { return template_loader_1.MessageTemplate; } });
@@ -11,3 +12,4 @@ Object.defineProperty(exports, "TemplateLoader", { enumerable: true, get: functi
11
12
  Object.defineProperty(exports, "CachableTemplateLoader", { enumerable: true, get: function () { return template_loader_1.CachableTemplateLoader; } });
12
13
  const template_service_1 = require("./template.service");
13
14
  Object.defineProperty(exports, "TemplateService", { enumerable: true, get: function () { return template_service_1.TemplateService; } });
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/template/index.ts"],"names":[],"mappings":";;;AAAA,yCAA6C;AAW3C,gGAXO,0BAAe,OAWP;AAVjB,iEAAiF;AAa/E,oGAbO,0CAAmB,OAaP;AADnB,mGAZ4B,yCAAkB,OAY5B;AAXpB,uDAAyH;AAKvH,gGALqB,iCAAe,OAKrB;AAEf,+FAPqD,gCAAc,OAOrD;AACd,uGARqE,wCAAsB,OAQrE;AAPxB,yDAAqD;AASnD,gGATO,kCAAe,OASP"}
@@ -71,8 +71,9 @@ let CachableTemplateLoader = class CachableTemplateLoader extends TemplateLoader
71
71
  return `${cacheKey}.${templateCode}.${locale}`;
72
72
  }
73
73
  };
74
- CachableTemplateLoader = __decorate([
74
+ exports.CachableTemplateLoader = CachableTemplateLoader;
75
+ exports.CachableTemplateLoader = CachableTemplateLoader = __decorate([
75
76
  __param(0, (0, common_1.Inject)(cache_manager_1.CACHE_MANAGER)),
76
77
  __metadata("design:paramtypes", [Object, Object])
77
78
  ], CachableTemplateLoader);
78
- exports.CachableTemplateLoader = CachableTemplateLoader;
79
+ //# sourceMappingURL=template.loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.loader.js","sourceRoot":"","sources":["../../lib/template/template.loader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,kEAAmC;AACnC,yDAAsD;AACtD,2CAAwC;AAGxC,MAAM,qBAAqB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAC7C,MAAM,iBAAiB,GAAG,yBAAyB,CAAC;AAQpD,MAAa,eAAe;CAK3B;AALD,0CAKC;AAUD,MAAsB,cAAc;IAIlC,KAAK,CAAC,OAAO,CAAC,YAAoB,EAAE,UAAyB,EAAE;QAC7D,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QACjD,MAAM,iBAAiB,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC;QACvF,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,iBAAiB,CAAC;QAC/C,OAAO;YACL,GAAG,iBAAiB;YACpB,OAAO,EAAE,OAAO,IAAI,IAAA,uBAAM,EAAC,OAAO,EAAE,IAAI,CAAC;YACzC,OAAO,EAAE,OAAO,IAAI,IAAA,uBAAM,EAAC,OAAO,EAAE,IAAI,CAAC;SAC1C,CAAA;IACH,CAAC;CACF;AAdD,wCAcC;AAED,IAAsB,sBAAsB,GAA5C,MAAsB,sBAAuB,SAAQ,cAAc;IAIjE,YAA2C,YAAmB,EAAE,YAA2B;QACzF,KAAK,EAAE,CAAC;QADiC,iBAAY,GAAZ,YAAY,CAAO;QAE5D,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC;YAChC,QAAQ,EAAE,iBAAiB;YAC3B,GAAG,EAAE,qBAAqB;SAC3B,EAAE,YAAY,CAAC,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,YAAoB,EAAE,UAAyB,EAAE;QAC7D,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QACjD,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC;QAClC,MAAM,kBAAkB,GAAG,IAAI,CAAC,mBAAmB,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QAC1E,MAAM,UAAU,GAAoB,MAAM,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;QACpF,IAAI,iBAAkC,CAAC;QACvC,IAAG,UAAU,EAAE,CAAC;YACd,iBAAiB,GAAG,UAAU,CAAC;QACjC,CAAC;aAAM,CAAC;YACN,iBAAiB,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC;YACjF,MAAM,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,kBAAkB,EAAE,iBAAiB,EAAE,GAAG,CAAC,CAAC;QAC1E,CAAC;QAED,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,iBAAiB,CAAC;QAC/C,OAAO;YACL,GAAG,iBAAiB;YACpB,OAAO,EAAE,OAAO,IAAI,IAAA,uBAAM,EAAC,OAAO,EAAE,IAAI,CAAC;YACzC,OAAO,EAAE,OAAO,IAAI,IAAA,uBAAM,EAAC,OAAO,EAAE,IAAI,CAAC;SAC1C,CAAA;IACH,CAAC;IAES,mBAAmB,CAAC,YAAoB,EAAE,MAAc;QAChE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC;QAC7C,OAAO,GAAG,QAAQ,IAAI,YAAY,IAAI,MAAM,EAAE,CAAC;IAChD,CAAC;CAEF,CAAA;AAtCqB,wDAAsB;iCAAtB,sBAAsB;IAI7B,WAAA,IAAA,eAAM,EAAC,6BAAa,CAAC,CAAA;;GAJd,sBAAsB,CAsC3C"}
@@ -24,9 +24,10 @@ let TemplateService = class TemplateService {
24
24
  return this.templateLoader.resolve(code, options);
25
25
  }
26
26
  };
27
- TemplateService = __decorate([
27
+ exports.TemplateService = TemplateService;
28
+ exports.TemplateService = TemplateService = __decorate([
28
29
  (0, common_1.Injectable)(),
29
30
  __param(0, (0, common_1.Inject)(constant_1.TEMPLATE_LOADER)),
30
31
  __metadata("design:paramtypes", [template_loader_1.TemplateLoader])
31
32
  ], TemplateService);
32
- exports.TemplateService = TemplateService;
33
+ //# sourceMappingURL=template.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.service.js","sourceRoot":"","sources":["../../lib/template/template.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAoD;AACpD,uDAAmF;AACnF,yCAA6C;AAGtC,IAAM,eAAe,GAArB,MAAM,eAAe;IAE1B,YAAsD,cAA8B;QAA9B,mBAAc,GAAd,cAAc,CAAgB;IAEpF,CAAC;IAED,eAAe,CAAC,IAAY,EAAE,UAAyB,EAAE;QACvD,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;CAEF,CAAA;AAVY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,mBAAU,GAAE;IAGE,WAAA,IAAA,eAAM,EAAC,0BAAe,CAAC,CAAA;qCAAkC,gCAAc;GAFzE,eAAe,CAU3B"}
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@nathapp/nestjs-notification",
3
- "version": "1.0.0-rc.5",
3
+ "version": "1.0.1",
4
4
  "description": "Notification Module",
5
5
  "scripts": {
6
+ "clean": "rimraf dist/ .turbo/",
6
7
  "build": "rimraf dist && tsc -p tsconfig.json",
7
8
  "precommit": "lint-staged",
8
9
  "test": "jest --config ./test/jest-test.json",
@@ -16,24 +17,10 @@
16
17
  "node": ">=16"
17
18
  },
18
19
  "devDependencies": {
19
- "@golevelup/ts-jest": "^0.3.7",
20
- "@nestjs/platform-express": "^10.0.0",
21
- "@nestjs/testing": "^10.0.0",
22
- "@types/jest": "^29.5.2",
23
- "@types/node": "^17.0.22",
24
20
  "@types/nodemailer": "^6.4.11",
25
21
  "@types/string-format": "^2.0.1",
26
- "@types/supertest": "^2.0.12",
27
- "@typescript-eslint/eslint-plugin": "^4",
28
- "@typescript-eslint/parser": "^4",
29
- "eslint": "*",
30
- "eslint-config-prettier": "^6",
31
- "eslint-plugin-prettier": "^3",
32
- "jest": "^29.5.0",
33
- "prettier": "^2",
34
- "supertest": "^6.3.3",
35
- "ts-jest": "^29.1.0",
36
- "typescript": "^4"
22
+ "eslint": "^8.57.0",
23
+ "typescript": "^5"
37
24
  },
38
25
  "types": "./index.d.ts",
39
26
  "main": "index.js",
@@ -45,12 +32,16 @@
45
32
  "string-format": "^2.0.0"
46
33
  },
47
34
  "peerDependencies": {
48
- "@nestjs/cache-manager": "^2.1.0",
35
+ "@nathapp/common": "^0.1.13",
36
+ "@nestjs/cache-manager": "^3.0.0",
49
37
  "@nestjs/common": "^8.0.0 || ^9.0.0 || ^10.0.0",
50
38
  "@nestjs/core": "^8.0.0 || ^9.0.0 || ^10.0.0",
51
- "cache-manager": "^5.0.0",
52
- "class-transformer": "*",
53
- "class-validator": "*",
54
- "rxjs": "*"
39
+ "cache-manager": ">=6",
40
+ "firebase-admin": "^12.1.0"
41
+ },
42
+ "peerDependenciesMeta": {
43
+ "@grpc/grpc-js": {
44
+ "firebase-admin": true
45
+ }
55
46
  }
56
47
  }
package/.eslintrc.js DELETED
@@ -1,24 +0,0 @@
1
- module.exports = {
2
- parser: '@typescript-eslint/parser',
3
- parserOptions: {
4
- project: 'tsconfig.json',
5
- sourceType: 'module',
6
- },
7
- plugins: ['@typescript-eslint/eslint-plugin'],
8
- extends: [
9
- 'plugin:@typescript-eslint/recommended',
10
- 'plugin:prettier/recommended',
11
- ],
12
- root: true,
13
- env: {
14
- node: true,
15
- jest: true,
16
- },
17
- ignorePatterns: ['.eslintrc.js'],
18
- rules: {
19
- '@typescript-eslint/interface-name-prefix': 'off',
20
- '@typescript-eslint/explicit-function-return-type': 'off',
21
- '@typescript-eslint/explicit-module-boundary-types': 'off',
22
- '@typescript-eslint/no-explicit-any': 'off',
23
- },
24
- };