@natrave/shared-entities 1.5.0 → 1.5.2

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 (58) hide show
  1. package/dist/app-auth/users/user.entity.d.ts +3 -2
  2. package/dist/app-auth/users/user.entity.d.ts.map +1 -1
  3. package/dist/app-auth/users/user.entity.js +6 -3
  4. package/dist/database-entities/index.d.ts +2 -2
  5. package/dist/database-entities/index.d.ts.map +1 -1
  6. package/dist/database-entities/index.js +4 -2
  7. package/dist/notifications/enums/index.d.ts +4 -0
  8. package/dist/notifications/enums/index.d.ts.map +1 -0
  9. package/dist/notifications/enums/index.js +8 -0
  10. package/dist/notifications/enums/notification-channel.enum.d.ts +8 -0
  11. package/dist/notifications/enums/notification-channel.enum.d.ts.map +1 -0
  12. package/dist/notifications/enums/notification-channel.enum.js +11 -0
  13. package/dist/notifications/enums/notification-delivery-status.enum.d.ts +9 -0
  14. package/dist/notifications/enums/notification-delivery-status.enum.d.ts.map +1 -0
  15. package/dist/notifications/enums/notification-delivery-status.enum.js +12 -0
  16. package/dist/notifications/enums/notification-status.enum.d.ts +10 -0
  17. package/dist/notifications/enums/notification-status.enum.d.ts.map +1 -0
  18. package/dist/notifications/enums/notification-status.enum.js +13 -0
  19. package/dist/notifications/index.d.ts +4 -1
  20. package/dist/notifications/index.d.ts.map +1 -1
  21. package/dist/notifications/index.js +4 -1
  22. package/dist/notifications/notification-deliveries/index.d.ts +2 -0
  23. package/dist/notifications/notification-deliveries/index.d.ts.map +1 -0
  24. package/dist/notifications/notification-deliveries/index.js +4 -0
  25. package/dist/notifications/notification-deliveries/notification-delivery.entity.d.ts +21 -0
  26. package/dist/notifications/notification-deliveries/notification-delivery.entity.d.ts.map +1 -0
  27. package/dist/notifications/notification-deliveries/notification-delivery.entity.js +159 -0
  28. package/dist/notifications/notifications/index.d.ts +2 -0
  29. package/dist/notifications/notifications/index.d.ts.map +1 -0
  30. package/dist/notifications/notifications/index.js +4 -0
  31. package/dist/notifications/notifications/notification.entity.d.ts +22 -0
  32. package/dist/notifications/notifications/notification.entity.d.ts.map +1 -0
  33. package/dist/notifications/notifications/notification.entity.js +154 -0
  34. package/dist/notifications/push-device-tokens/enums/index.d.ts +3 -0
  35. package/dist/notifications/push-device-tokens/enums/index.d.ts.map +1 -0
  36. package/dist/notifications/push-device-tokens/enums/index.js +6 -0
  37. package/dist/notifications/push-device-tokens/enums/push-token-platform.enum.d.ts +7 -0
  38. package/dist/notifications/push-device-tokens/enums/push-token-platform.enum.d.ts.map +1 -0
  39. package/dist/notifications/push-device-tokens/enums/push-token-platform.enum.js +10 -0
  40. package/dist/notifications/push-device-tokens/enums/push-token-provider.enum.d.ts +4 -0
  41. package/dist/notifications/push-device-tokens/enums/push-token-provider.enum.d.ts.map +1 -0
  42. package/dist/notifications/push-device-tokens/enums/push-token-provider.enum.js +7 -0
  43. package/dist/notifications/push-device-tokens/index.d.ts +3 -0
  44. package/dist/notifications/push-device-tokens/index.d.ts.map +1 -0
  45. package/dist/notifications/push-device-tokens/index.js +5 -0
  46. package/dist/notifications/push-device-tokens/push-device-token.entity.d.ts +18 -0
  47. package/dist/notifications/push-device-tokens/push-device-token.entity.d.ts.map +1 -0
  48. package/dist/notifications/push-device-tokens/push-device-token.entity.js +136 -0
  49. package/package.json +4 -3
  50. package/dist/notifications/notification-tokens/enums/notification-platform.enum.d.ts +0 -6
  51. package/dist/notifications/notification-tokens/enums/notification-platform.enum.d.ts.map +0 -1
  52. package/dist/notifications/notification-tokens/enums/notification-platform.enum.js +0 -9
  53. package/dist/notifications/notification-tokens/index.d.ts +0 -3
  54. package/dist/notifications/notification-tokens/index.d.ts.map +0 -1
  55. package/dist/notifications/notification-tokens/index.js +0 -6
  56. package/dist/notifications/notification-tokens/notification-token.entity.d.ts +0 -14
  57. package/dist/notifications/notification-tokens/notification-token.entity.d.ts.map +0 -1
  58. package/dist/notifications/notification-tokens/notification-token.entity.js +0 -94
@@ -1,4 +1,4 @@
1
- import { NotificationToken } from '../../notifications';
1
+ import { Notification, PushDeviceToken } from '../../notifications';
2
2
  import { Player } from '../../players';
3
3
  import { TournamentRegistrationRequest } from '../../tournaments';
4
4
  import { RefreshToken } from '../refresh-tokens';
@@ -22,7 +22,8 @@ export declare class User {
22
22
  refreshTokens: RefreshToken[];
23
23
  userAuthProviders: UserAuthProvider[];
24
24
  player: Player;
25
- notificationTokens: NotificationToken[];
25
+ notifications: Notification[];
26
+ pushDeviceTokens: PushDeviceToken[];
26
27
  tournamentRegistrationRequests: TournamentRegistrationRequest[];
27
28
  prepareData(): void;
28
29
  }
@@ -1 +1 @@
1
- {"version":3,"file":"user.entity.d.ts","sourceRoot":"","sources":["../../../src/app-auth/users/user.entity.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAa7C,qBAiBa,IAAI;IAIf,EAAE,EAAE,MAAM,CAAC;IAUX,SAAS,EAAE,MAAM,CAAC;IAOlB,SAAS,EAAE,IAAI,CAAC;IAOhB,SAAS,EAAE,IAAI,CAAC;IAQhB,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;IASvB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAQpB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAQzB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAQ3B,KAAK,EAAE,MAAM,CAAC;IAQd,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAQtB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAS5B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAUvB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IASrB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAKxB,aAAa,EAAE,YAAY,EAAE,CAAC;IAK9B,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;IAKtC,MAAM,EAAE,MAAM,CAAC;IAGf,kBAAkB,EAAE,iBAAiB,EAAE,CAAC;IAGxC,8BAA8B,EAAE,6BAA6B,EAAE,CAAC;IAMhE,WAAW,IAAI,IAAI;CAGpB"}
1
+ {"version":3,"file":"user.entity.d.ts","sourceRoot":"","sources":["../../../src/app-auth/users/user.entity.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAa7C,qBAiBa,IAAI;IAIf,EAAE,EAAE,MAAM,CAAC;IAUX,SAAS,EAAE,MAAM,CAAC;IAOlB,SAAS,EAAE,IAAI,CAAC;IAOhB,SAAS,EAAE,IAAI,CAAC;IAQhB,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;IASvB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAQpB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAQzB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAQ3B,KAAK,EAAE,MAAM,CAAC;IAQd,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAQtB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAS5B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAUvB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IASrB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAKxB,aAAa,EAAE,YAAY,EAAE,CAAC;IAK9B,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;IAKtC,MAAM,EAAE,MAAM,CAAC;IAGf,aAAa,EAAE,YAAY,EAAE,CAAC;IAG9B,gBAAgB,EAAE,eAAe,EAAE,CAAC;IAGpC,8BAA8B,EAAE,6BAA6B,EAAE,CAAC;IAMhE,WAAW,IAAI,IAAI;CAGpB"}
@@ -21,7 +21,7 @@ import {
21
21
  Unique,
22
22
  UpdateDateColumn
23
23
  } from "typeorm";
24
- import { NotificationToken } from "../../notifications/index.js";
24
+ import { Notification, PushDeviceToken } from "../../notifications/index.js";
25
25
  import { Player } from "../../players/index.js";
26
26
  import { TournamentRegistrationRequest } from "../../tournaments/index.js";
27
27
  import { RefreshToken } from "../refresh-tokens/index.js";
@@ -161,8 +161,11 @@ __decorateClass([
161
161
  })
162
162
  ], User.prototype, "player", 2);
163
163
  __decorateClass([
164
- OneToMany(() => NotificationToken, (token) => token.user)
165
- ], User.prototype, "notificationTokens", 2);
164
+ OneToMany(() => Notification, (notification) => notification.user)
165
+ ], User.prototype, "notifications", 2);
166
+ __decorateClass([
167
+ OneToMany(() => PushDeviceToken, (pushDeviceToken) => pushDeviceToken.user)
168
+ ], User.prototype, "pushDeviceTokens", 2);
166
169
  __decorateClass([
167
170
  OneToMany(() => TournamentRegistrationRequest, (request) => request.requestedBy)
168
171
  ], User.prototype, "tournamentRegistrationRequests", 2);
@@ -3,11 +3,11 @@ import { Organization, OrganizationUser, OrganizationUserBillingInfo, PhoneNumbe
3
3
  import { Coupon, CouponUsage } from '../coupons';
4
4
  import { Address, Facility, FacilityImage, FacilityOwner, Field, FieldImage } from '../facilities';
5
5
  import { TeamPlayerMergeHistory } from '../history-logs';
6
- import { NotificationToken } from '../notifications';
6
+ import { Notification, NotificationDelivery, PushDeviceToken } from '../notifications';
7
7
  import { Payment, PaymentProvider, UserPaymentProvider } from '../payments';
8
8
  import { Player, PlayerPersonalData, PlayerPosition } from '../players';
9
9
  import { PlayerTeam, Team, TeamJoinRequest, TeamModality, TeamTrophy } from '../teams';
10
10
  import { Tournament, TournamentAllowedPhone, TournamentBracket, TournamentBracketSlot, TournamentContact, TournamentCoupon, TournamentFacility, TournamentFormatConfig, TournamentGroup, TournamentMatch, TournamentMatchAvailability, TournamentMatchCard, TournamentMatchGoal, TournamentMatchRule, TournamentMatchSchema, TournamentPayment, TournamentPenaltyShootout, TournamentPlayer, TournamentPlayerRule, TournamentPrizeRule, TournamentPublicationChargeRule, TournamentRegistrationRequirement, TournamentRegistrationRequest, TournamentTeam, TournamentTeamContactAttempt } from '../tournaments';
11
11
  import { UserDomainEvent, UserEventView } from '../user-events';
12
- export declare const DATABASE_ENTITIES: (typeof FacilityImage | typeof Facility | typeof FieldImage | typeof Field | typeof Address | typeof TournamentFacility | typeof OrganizationUserBillingInfo | typeof OrganizationUser | typeof Organization | typeof TournamentPayment | typeof PhoneNumber | typeof TournamentAllowedPhone | typeof Tournament | typeof FacilityOwner | typeof PasswordReset | typeof NotificationToken | typeof User | typeof UserAuthProvider | typeof RefreshToken | typeof Player | typeof TournamentRegistrationRequest | typeof UserVerification | typeof PlayerPersonalData | typeof PlayerPosition | typeof PlayerTeam | typeof TeamJoinRequest | typeof TeamPlayerMergeHistory | typeof Team | typeof TournamentPlayer | typeof TournamentTeam | typeof TeamModality | typeof TournamentTeamContactAttempt | typeof TeamTrophy | typeof TournamentContact | typeof Coupon | typeof CouponUsage | typeof TournamentCoupon | typeof TournamentFormatConfig | typeof TournamentMatchGoal | typeof TournamentMatch | typeof TournamentMatchCard | typeof TournamentPenaltyShootout | typeof TournamentGroup | typeof TournamentBracketSlot | typeof TournamentMatchRule | typeof TournamentMatchSchema | typeof TournamentMatchAvailability | typeof UserPaymentProvider | typeof PaymentProvider | typeof Payment | typeof TournamentPlayerRule | typeof TournamentPrizeRule | typeof TournamentRegistrationRequirement | typeof TournamentBracket | typeof TournamentPublicationChargeRule | typeof UserDomainEvent | typeof UserEventView)[];
12
+ export declare const DATABASE_ENTITIES: (typeof FacilityImage | typeof Facility | typeof FieldImage | typeof Field | typeof Address | typeof TournamentFacility | typeof OrganizationUserBillingInfo | typeof OrganizationUser | typeof Organization | typeof TournamentPayment | typeof PhoneNumber | typeof TournamentAllowedPhone | typeof Tournament | typeof FacilityOwner | typeof PasswordReset | typeof NotificationDelivery | typeof Notification | typeof User | typeof PushDeviceToken | typeof UserAuthProvider | typeof RefreshToken | typeof Player | typeof TournamentRegistrationRequest | typeof UserVerification | typeof PlayerPersonalData | typeof PlayerPosition | typeof PlayerTeam | typeof TeamJoinRequest | typeof TeamPlayerMergeHistory | typeof Team | typeof TournamentPlayer | typeof TournamentTeam | typeof TeamModality | typeof TournamentTeamContactAttempt | typeof TeamTrophy | typeof TournamentContact | typeof Coupon | typeof CouponUsage | typeof TournamentCoupon | typeof TournamentFormatConfig | typeof TournamentMatchGoal | typeof TournamentMatch | typeof TournamentMatchCard | typeof TournamentPenaltyShootout | typeof TournamentGroup | typeof TournamentBracketSlot | typeof TournamentMatchRule | typeof TournamentMatchSchema | typeof TournamentMatchAvailability | typeof UserPaymentProvider | typeof PaymentProvider | typeof Payment | typeof TournamentPlayerRule | typeof TournamentPrizeRule | typeof TournamentRegistrationRequirement | typeof TournamentBracket | typeof TournamentPublicationChargeRule | typeof UserDomainEvent | typeof UserEventView)[];
13
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/database-entities/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,IAAI,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpG,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,2BAA2B,EAC3B,WAAW,EACZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACnG,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,eAAe,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACvF,OAAO,EACL,UAAU,EACV,sBAAsB,EACtB,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,2BAA2B,EAC3B,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,yBAAyB,EACzB,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,+BAA+B,EAC/B,iCAAiC,EACjC,6BAA6B,EAE7B,cAAc,EACd,4BAA4B,EAC7B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEhE,eAAO,MAAM,iBAAiB,w8CA2D7B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/database-entities/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,IAAI,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpG,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,2BAA2B,EAC3B,WAAW,EACZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACnG,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACvF,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,eAAe,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACvF,OAAO,EACL,UAAU,EACV,sBAAsB,EACtB,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,2BAA2B,EAC3B,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,yBAAyB,EACzB,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,+BAA+B,EAC/B,iCAAiC,EACjC,6BAA6B,EAE7B,cAAc,EACd,4BAA4B,EAC7B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEhE,eAAO,MAAM,iBAAiB,0/CA6D7B,CAAC"}
@@ -8,7 +8,7 @@ import {
8
8
  import { Coupon, CouponUsage } from "../coupons/index.js";
9
9
  import { Address, Facility, FacilityImage, FacilityOwner, Field, FieldImage } from "../facilities/index.js";
10
10
  import { TeamPlayerMergeHistory } from "../history-logs/index.js";
11
- import { NotificationToken } from "../notifications/index.js";
11
+ import { Notification, NotificationDelivery, PushDeviceToken } from "../notifications/index.js";
12
12
  import { Payment, PaymentProvider, UserPaymentProvider } from "../payments/index.js";
13
13
  import { Player, PlayerPersonalData, PlayerPosition } from "../players/index.js";
14
14
  import { PlayerTeam, Team, TeamJoinRequest, TeamModality, TeamTrophy } from "../teams/index.js";
@@ -93,7 +93,9 @@ const DATABASE_ENTITIES = [
93
93
  PlayerTeam,
94
94
  TeamModality,
95
95
  TeamJoinRequest,
96
- NotificationToken,
96
+ Notification,
97
+ NotificationDelivery,
98
+ PushDeviceToken,
97
99
  PhoneNumber,
98
100
  TournamentAllowedPhone,
99
101
  TeamTrophy,
@@ -0,0 +1,4 @@
1
+ export { NotificationChannel } from './notification-channel.enum';
2
+ export { NotificationStatus } from './notification-status.enum';
3
+ export { NotificationDeliveryStatus } from './notification-delivery-status.enum';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/notifications/enums/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { NotificationChannel } from "./notification-channel.enum.js";
2
+ import { NotificationStatus } from "./notification-status.enum.js";
3
+ import { NotificationDeliveryStatus } from "./notification-delivery-status.enum.js";
4
+ export {
5
+ NotificationChannel,
6
+ NotificationDeliveryStatus,
7
+ NotificationStatus
8
+ };
@@ -0,0 +1,8 @@
1
+ export declare enum NotificationChannel {
2
+ IN_APP = "IN_APP",
3
+ PUSH = "PUSH",
4
+ EMAIL = "EMAIL",
5
+ SMS = "SMS",
6
+ WHATSAPP = "WHATSAPP"
7
+ }
8
+ //# sourceMappingURL=notification-channel.enum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification-channel.enum.d.ts","sourceRoot":"","sources":["../../../src/notifications/enums/notification-channel.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,mBAAmB;IAC7B,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,KAAK,UAAU;IACf,GAAG,QAAQ;IACX,QAAQ,aAAa;CACtB"}
@@ -0,0 +1,11 @@
1
+ var NotificationChannel = /* @__PURE__ */ ((NotificationChannel2) => {
2
+ NotificationChannel2["IN_APP"] = "IN_APP";
3
+ NotificationChannel2["PUSH"] = "PUSH";
4
+ NotificationChannel2["EMAIL"] = "EMAIL";
5
+ NotificationChannel2["SMS"] = "SMS";
6
+ NotificationChannel2["WHATSAPP"] = "WHATSAPP";
7
+ return NotificationChannel2;
8
+ })(NotificationChannel || {});
9
+ export {
10
+ NotificationChannel
11
+ };
@@ -0,0 +1,9 @@
1
+ export declare enum NotificationDeliveryStatus {
2
+ PENDING = "PENDING",
3
+ PROCESSING = "PROCESSING",
4
+ SENT = "SENT",
5
+ DELIVERED = "DELIVERED",
6
+ FAILED = "FAILED",
7
+ CANCELED = "CANCELED"
8
+ }
9
+ //# sourceMappingURL=notification-delivery-status.enum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification-delivery-status.enum.d.ts","sourceRoot":"","sources":["../../../src/notifications/enums/notification-delivery-status.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,0BAA0B;IACpC,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,IAAI,SAAS;IACb,SAAS,cAAc;IACvB,MAAM,WAAW;IACjB,QAAQ,aAAa;CACtB"}
@@ -0,0 +1,12 @@
1
+ var NotificationDeliveryStatus = /* @__PURE__ */ ((NotificationDeliveryStatus2) => {
2
+ NotificationDeliveryStatus2["PENDING"] = "PENDING";
3
+ NotificationDeliveryStatus2["PROCESSING"] = "PROCESSING";
4
+ NotificationDeliveryStatus2["SENT"] = "SENT";
5
+ NotificationDeliveryStatus2["DELIVERED"] = "DELIVERED";
6
+ NotificationDeliveryStatus2["FAILED"] = "FAILED";
7
+ NotificationDeliveryStatus2["CANCELED"] = "CANCELED";
8
+ return NotificationDeliveryStatus2;
9
+ })(NotificationDeliveryStatus || {});
10
+ export {
11
+ NotificationDeliveryStatus
12
+ };
@@ -0,0 +1,10 @@
1
+ export declare enum NotificationStatus {
2
+ PENDING = "PENDING",
3
+ PROCESSING = "PROCESSING",
4
+ SENT = "SENT",
5
+ DELIVERED = "DELIVERED",
6
+ FAILED = "FAILED",
7
+ READ = "READ",
8
+ CANCELED = "CANCELED"
9
+ }
10
+ //# sourceMappingURL=notification-status.enum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification-status.enum.d.ts","sourceRoot":"","sources":["../../../src/notifications/enums/notification-status.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,kBAAkB;IAC5B,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,IAAI,SAAS;IACb,SAAS,cAAc;IACvB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,QAAQ,aAAa;CACtB"}
@@ -0,0 +1,13 @@
1
+ var NotificationStatus = /* @__PURE__ */ ((NotificationStatus2) => {
2
+ NotificationStatus2["PENDING"] = "PENDING";
3
+ NotificationStatus2["PROCESSING"] = "PROCESSING";
4
+ NotificationStatus2["SENT"] = "SENT";
5
+ NotificationStatus2["DELIVERED"] = "DELIVERED";
6
+ NotificationStatus2["FAILED"] = "FAILED";
7
+ NotificationStatus2["READ"] = "READ";
8
+ NotificationStatus2["CANCELED"] = "CANCELED";
9
+ return NotificationStatus2;
10
+ })(NotificationStatus || {});
11
+ export {
12
+ NotificationStatus
13
+ };
@@ -1,3 +1,6 @@
1
1
  export * from './email-templates';
2
- export * from './notification-tokens';
2
+ export * from './notifications';
3
+ export * from './notification-deliveries';
4
+ export * from './push-device-tokens';
5
+ export * from './enums';
3
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/notifications/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAElC,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/notifications/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAElC,cAAc,iBAAiB,CAAC;AAEhC,cAAc,2BAA2B,CAAC;AAE1C,cAAc,sBAAsB,CAAC;AAErC,cAAc,SAAS,CAAC"}
@@ -1,2 +1,5 @@
1
1
  export * from "./email-templates/index.js";
2
- export * from "./notification-tokens/index.js";
2
+ export * from "./notifications/index.js";
3
+ export * from "./notification-deliveries/index.js";
4
+ export * from "./push-device-tokens/index.js";
5
+ export * from "./enums/index.js";
@@ -0,0 +1,2 @@
1
+ export { NotificationDelivery } from './notification-delivery.entity';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/notifications/notification-deliveries/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { NotificationDelivery } from "./notification-delivery.entity.js";
2
+ export {
3
+ NotificationDelivery
4
+ };
@@ -0,0 +1,21 @@
1
+ import { NotificationChannel, NotificationDeliveryStatus } from '../enums';
2
+ import { Notification } from '../notifications';
3
+ export declare class NotificationDelivery {
4
+ id: string;
5
+ notificationId: string;
6
+ channel: NotificationChannel;
7
+ status: NotificationDeliveryStatus;
8
+ attempts: number;
9
+ scheduledAt: Date | null;
10
+ sentAt: Date | null;
11
+ deliveredAt: Date | null;
12
+ failedAt: Date | null;
13
+ providerMessageId: string | null;
14
+ lastErrorCode: string | null;
15
+ lastErrorMessage: string | null;
16
+ metadata: Record<string, unknown>;
17
+ createdAt: Date;
18
+ updatedAt: Date;
19
+ notification: Notification;
20
+ }
21
+ //# sourceMappingURL=notification-delivery.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification-delivery.entity.d.ts","sourceRoot":"","sources":["../../../src/notifications/notification-deliveries/notification-delivery.entity.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,qBASa,oBAAoB;IAI/B,EAAE,EAAE,MAAM,CAAC;IAOX,cAAc,EAAE,MAAM,CAAC;IAQvB,OAAO,EAAE,mBAAmB,CAAC;IAS7B,MAAM,EAAE,0BAA0B,CAAC;IAOnC,QAAQ,EAAE,MAAM,CAAC;IAQjB,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC;IAQzB,MAAM,EAAE,IAAI,GAAG,IAAI,CAAC;IAQpB,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC;IAQzB,QAAQ,EAAE,IAAI,GAAG,IAAI,CAAC;IAStB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IASjC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAQ7B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAOhC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAOlC,SAAS,EAAE,IAAI,CAAC;IAOhB,SAAS,EAAE,IAAI,CAAC;IAMhB,YAAY,EAAE,YAAY,CAAC;CAC5B"}
@@ -0,0 +1,159 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result) __defProp(target, key, result);
9
+ return result;
10
+ };
11
+ import {
12
+ Column,
13
+ CreateDateColumn,
14
+ Entity,
15
+ Index,
16
+ JoinColumn,
17
+ ManyToOne,
18
+ PrimaryGeneratedColumn,
19
+ UpdateDateColumn
20
+ } from "typeorm";
21
+ import { NotificationChannel, NotificationDeliveryStatus } from "../enums/index.js";
22
+ import { Notification } from "../notifications/index.js";
23
+ let NotificationDelivery = class {
24
+ };
25
+ __decorateClass([
26
+ PrimaryGeneratedColumn("uuid", {
27
+ comment: "Identificador \xFAnico da tentativa de entrega por canal."
28
+ })
29
+ ], NotificationDelivery.prototype, "id", 2);
30
+ __decorateClass([
31
+ Column({
32
+ name: "notification_id",
33
+ type: "uuid",
34
+ comment: "FK notifications.id."
35
+ })
36
+ ], NotificationDelivery.prototype, "notificationId", 2);
37
+ __decorateClass([
38
+ Column({
39
+ type: "enum",
40
+ enum: NotificationChannel,
41
+ enumName: "NotificationChannel",
42
+ comment: "Canal de entrega da notifica\xE7\xE3o."
43
+ })
44
+ ], NotificationDelivery.prototype, "channel", 2);
45
+ __decorateClass([
46
+ Column({
47
+ type: "enum",
48
+ enum: NotificationDeliveryStatus,
49
+ enumName: "NotificationDeliveryStatus",
50
+ default: NotificationDeliveryStatus.PENDING,
51
+ comment: "Status da entrega por canal."
52
+ })
53
+ ], NotificationDelivery.prototype, "status", 2);
54
+ __decorateClass([
55
+ Column({
56
+ type: "smallint",
57
+ default: 0,
58
+ comment: "N\xFAmero de tentativas de envio para o canal."
59
+ })
60
+ ], NotificationDelivery.prototype, "attempts", 2);
61
+ __decorateClass([
62
+ Column({
63
+ name: "scheduled_at",
64
+ type: "timestamptz",
65
+ nullable: true,
66
+ comment: "Data/hora em que o envio foi agendado."
67
+ })
68
+ ], NotificationDelivery.prototype, "scheduledAt", 2);
69
+ __decorateClass([
70
+ Column({
71
+ name: "sent_at",
72
+ type: "timestamptz",
73
+ nullable: true,
74
+ comment: "Data/hora em que o envio foi efetuado."
75
+ })
76
+ ], NotificationDelivery.prototype, "sentAt", 2);
77
+ __decorateClass([
78
+ Column({
79
+ name: "delivered_at",
80
+ type: "timestamptz",
81
+ nullable: true,
82
+ comment: "Data/hora em que o provedor confirmou entrega."
83
+ })
84
+ ], NotificationDelivery.prototype, "deliveredAt", 2);
85
+ __decorateClass([
86
+ Column({
87
+ name: "failed_at",
88
+ type: "timestamptz",
89
+ nullable: true,
90
+ comment: "Data/hora da \xFAltima falha de envio."
91
+ })
92
+ ], NotificationDelivery.prototype, "failedAt", 2);
93
+ __decorateClass([
94
+ Column({
95
+ name: "provider_message_id",
96
+ type: "varchar",
97
+ length: 128,
98
+ nullable: true,
99
+ comment: "Identificador retornado pelo provedor externo."
100
+ })
101
+ ], NotificationDelivery.prototype, "providerMessageId", 2);
102
+ __decorateClass([
103
+ Column({
104
+ name: "last_error_code",
105
+ type: "varchar",
106
+ length: 64,
107
+ nullable: true,
108
+ comment: "C\xF3digo da \xFAltima falha de envio."
109
+ })
110
+ ], NotificationDelivery.prototype, "lastErrorCode", 2);
111
+ __decorateClass([
112
+ Column({
113
+ name: "last_error_message",
114
+ type: "text",
115
+ nullable: true,
116
+ comment: "Mensagem da \xFAltima falha de envio."
117
+ })
118
+ ], NotificationDelivery.prototype, "lastErrorMessage", 2);
119
+ __decorateClass([
120
+ Column({
121
+ type: "jsonb",
122
+ default: () => "'{}'::jsonb",
123
+ comment: "Metadados do canal/provedor para troubleshooting."
124
+ })
125
+ ], NotificationDelivery.prototype, "metadata", 2);
126
+ __decorateClass([
127
+ CreateDateColumn({
128
+ name: "created_at",
129
+ type: "timestamptz",
130
+ comment: "Data/hora de cria\xE7\xE3o da entrega."
131
+ })
132
+ ], NotificationDelivery.prototype, "createdAt", 2);
133
+ __decorateClass([
134
+ UpdateDateColumn({
135
+ name: "updated_at",
136
+ type: "timestamptz",
137
+ comment: "Data/hora da \xFAltima atualiza\xE7\xE3o da entrega."
138
+ })
139
+ ], NotificationDelivery.prototype, "updatedAt", 2);
140
+ __decorateClass([
141
+ ManyToOne(() => Notification, (notification) => notification.deliveries, {
142
+ onDelete: "CASCADE"
143
+ }),
144
+ JoinColumn({ name: "notification_id" })
145
+ ], NotificationDelivery.prototype, "notification", 2);
146
+ NotificationDelivery = __decorateClass([
147
+ Entity("notification_deliveries"),
148
+ Index("UQ_notification_deliveries_notification_channel", ["notificationId", "channel"], {
149
+ unique: true
150
+ }),
151
+ Index("IDX_notification_deliveries_channel_status_scheduled", ["channel", "status", "scheduledAt"]),
152
+ Index("IDX_notification_deliveries_notification_status", ["notificationId", "status"]),
153
+ Index("IDX_notification_deliveries_provider_message", ["providerMessageId"], {
154
+ where: '"provider_message_id" IS NOT NULL'
155
+ })
156
+ ], NotificationDelivery);
157
+ export {
158
+ NotificationDelivery
159
+ };
@@ -0,0 +1,2 @@
1
+ export { Notification } from './notification.entity';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/notifications/notifications/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { Notification } from "./notification.entity.js";
2
+ export {
3
+ Notification
4
+ };
@@ -0,0 +1,22 @@
1
+ import { User } from '../../app-auth';
2
+ import { NotificationStatus } from '../enums';
3
+ import { NotificationDelivery } from '../notification-deliveries';
4
+ export declare class Notification {
5
+ id: string;
6
+ userId: string;
7
+ type: string;
8
+ title: string;
9
+ body: string;
10
+ payload: Record<string, unknown>;
11
+ status: NotificationStatus;
12
+ dedupeKey: string | null;
13
+ availableAt: Date | null;
14
+ expiresAt: Date | null;
15
+ readAt: Date | null;
16
+ createdAt: Date;
17
+ updatedAt: Date;
18
+ deletedAt: Date | null;
19
+ user: User;
20
+ deliveries: NotificationDelivery[];
21
+ }
22
+ //# sourceMappingURL=notification.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification.entity.d.ts","sourceRoot":"","sources":["../../../src/notifications/notifications/notification.entity.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,qBAYa,YAAY;IAIvB,EAAE,EAAE,MAAM,CAAC;IAOX,MAAM,EAAE,MAAM,CAAC;IAOf,IAAI,EAAE,MAAM,CAAC;IAOb,KAAK,EAAE,MAAM,CAAC;IAMd,IAAI,EAAE,MAAM,CAAC;IAOb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IASjC,MAAM,EAAE,kBAAkB,CAAC;IAS3B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAQzB,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC;IAQzB,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;IAQvB,MAAM,EAAE,IAAI,GAAG,IAAI,CAAC;IAOpB,SAAS,EAAE,IAAI,CAAC;IAOhB,SAAS,EAAE,IAAI,CAAC;IAQhB,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;IAIvB,IAAI,EAAE,IAAI,CAAC;IAGX,UAAU,EAAE,oBAAoB,EAAE,CAAC;CACpC"}
@@ -0,0 +1,154 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result) __defProp(target, key, result);
9
+ return result;
10
+ };
11
+ import {
12
+ Column,
13
+ CreateDateColumn,
14
+ DeleteDateColumn,
15
+ Entity,
16
+ Index,
17
+ JoinColumn,
18
+ ManyToOne,
19
+ OneToMany,
20
+ PrimaryGeneratedColumn,
21
+ UpdateDateColumn
22
+ } from "typeorm";
23
+ import { User } from "../../app-auth/index.js";
24
+ import { NotificationStatus } from "../enums/index.js";
25
+ import { NotificationDelivery } from "../notification-deliveries/index.js";
26
+ let Notification = class {
27
+ };
28
+ __decorateClass([
29
+ PrimaryGeneratedColumn("uuid", {
30
+ comment: "Identificador \xFAnico da notifica\xE7\xE3o."
31
+ })
32
+ ], Notification.prototype, "id", 2);
33
+ __decorateClass([
34
+ Column({
35
+ name: "user_id",
36
+ type: "uuid",
37
+ comment: "FK users.id."
38
+ })
39
+ ], Notification.prototype, "userId", 2);
40
+ __decorateClass([
41
+ Column({
42
+ type: "varchar",
43
+ length: 80,
44
+ comment: "Tipo funcional da notifica\xE7\xE3o."
45
+ })
46
+ ], Notification.prototype, "type", 2);
47
+ __decorateClass([
48
+ Column({
49
+ type: "varchar",
50
+ length: 160,
51
+ comment: "T\xEDtulo para exibi\xE7\xE3o in-app e canais externos."
52
+ })
53
+ ], Notification.prototype, "title", 2);
54
+ __decorateClass([
55
+ Column({
56
+ type: "text",
57
+ comment: "Corpo principal da notifica\xE7\xE3o."
58
+ })
59
+ ], Notification.prototype, "body", 2);
60
+ __decorateClass([
61
+ Column({
62
+ type: "jsonb",
63
+ default: () => "'{}'::jsonb",
64
+ comment: "Payload gen\xE9rico para dados complementares."
65
+ })
66
+ ], Notification.prototype, "payload", 2);
67
+ __decorateClass([
68
+ Column({
69
+ type: "enum",
70
+ enum: NotificationStatus,
71
+ enumName: "NotificationStatus",
72
+ default: NotificationStatus.PENDING,
73
+ comment: "Status de lifecycle unificado da notifica\xE7\xE3o."
74
+ })
75
+ ], Notification.prototype, "status", 2);
76
+ __decorateClass([
77
+ Column({
78
+ name: "dedupe_key",
79
+ type: "varchar",
80
+ length: 120,
81
+ nullable: true,
82
+ comment: "Chave opcional de deduplica\xE7\xE3o por usu\xE1rio."
83
+ })
84
+ ], Notification.prototype, "dedupeKey", 2);
85
+ __decorateClass([
86
+ Column({
87
+ name: "available_at",
88
+ type: "timestamptz",
89
+ nullable: true,
90
+ comment: "Data/hora a partir de quando pode ser exibida/processada."
91
+ })
92
+ ], Notification.prototype, "availableAt", 2);
93
+ __decorateClass([
94
+ Column({
95
+ name: "expires_at",
96
+ type: "timestamptz",
97
+ nullable: true,
98
+ comment: "Data/hora de expira\xE7\xE3o da notifica\xE7\xE3o."
99
+ })
100
+ ], Notification.prototype, "expiresAt", 2);
101
+ __decorateClass([
102
+ Column({
103
+ name: "read_at",
104
+ type: "timestamptz",
105
+ nullable: true,
106
+ comment: "Data/hora em que a notifica\xE7\xE3o foi lida na central in-app."
107
+ })
108
+ ], Notification.prototype, "readAt", 2);
109
+ __decorateClass([
110
+ CreateDateColumn({
111
+ name: "created_at",
112
+ type: "timestamptz",
113
+ comment: "Data/hora de cria\xE7\xE3o da notifica\xE7\xE3o."
114
+ })
115
+ ], Notification.prototype, "createdAt", 2);
116
+ __decorateClass([
117
+ UpdateDateColumn({
118
+ name: "updated_at",
119
+ type: "timestamptz",
120
+ comment: "Data/hora da \xFAltima atualiza\xE7\xE3o da notifica\xE7\xE3o."
121
+ })
122
+ ], Notification.prototype, "updatedAt", 2);
123
+ __decorateClass([
124
+ DeleteDateColumn({
125
+ name: "deleted_at",
126
+ type: "timestamptz",
127
+ nullable: true,
128
+ comment: "Data/hora de remo\xE7\xE3o l\xF3gica para preserva\xE7\xE3o de hist\xF3rico."
129
+ })
130
+ ], Notification.prototype, "deletedAt", 2);
131
+ __decorateClass([
132
+ ManyToOne(() => User, (user) => user.notifications, { onDelete: "CASCADE" }),
133
+ JoinColumn({ name: "user_id" })
134
+ ], Notification.prototype, "user", 2);
135
+ __decorateClass([
136
+ OneToMany(() => NotificationDelivery, (delivery) => delivery.notification)
137
+ ], Notification.prototype, "deliveries", 2);
138
+ Notification = __decorateClass([
139
+ Entity("notifications"),
140
+ Index("IDX_notifications_user_created", ["userId", "createdAt"]),
141
+ Index("IDX_notifications_user_status_created", ["userId", "status", "createdAt"]),
142
+ Index("IDX_notifications_user_unread", ["userId", "createdAt"], {
143
+ where: '"read_at" IS NULL AND "deleted_at" IS NULL'
144
+ }),
145
+ Index("IDX_notifications_available_at", ["availableAt"]),
146
+ Index("IDX_notifications_expires_at", ["expiresAt"]),
147
+ Index("UQ_notifications_user_dedupe_active", ["userId", "dedupeKey"], {
148
+ unique: true,
149
+ where: '"dedupe_key" IS NOT NULL AND "deleted_at" IS NULL'
150
+ })
151
+ ], Notification);
152
+ export {
153
+ Notification
154
+ };
@@ -0,0 +1,3 @@
1
+ export { PushTokenPlatform } from './push-token-platform.enum';
2
+ export { PushTokenProvider } from './push-token-provider.enum';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/notifications/push-device-tokens/enums/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { PushTokenPlatform } from "./push-token-platform.enum.js";
2
+ import { PushTokenProvider } from "./push-token-provider.enum.js";
3
+ export {
4
+ PushTokenPlatform,
5
+ PushTokenProvider
6
+ };
@@ -0,0 +1,7 @@
1
+ export declare enum PushTokenPlatform {
2
+ IOS = "IOS",
3
+ ANDROID = "ANDROID",
4
+ WEB = "WEB",
5
+ UNKNOWN = "UNKNOWN"
6
+ }
7
+ //# sourceMappingURL=push-token-platform.enum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"push-token-platform.enum.d.ts","sourceRoot":"","sources":["../../../../src/notifications/push-device-tokens/enums/push-token-platform.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,iBAAiB;IAC3B,GAAG,QAAQ;IACX,OAAO,YAAY;IACnB,GAAG,QAAQ;IACX,OAAO,YAAY;CACpB"}
@@ -0,0 +1,10 @@
1
+ var PushTokenPlatform = /* @__PURE__ */ ((PushTokenPlatform2) => {
2
+ PushTokenPlatform2["IOS"] = "IOS";
3
+ PushTokenPlatform2["ANDROID"] = "ANDROID";
4
+ PushTokenPlatform2["WEB"] = "WEB";
5
+ PushTokenPlatform2["UNKNOWN"] = "UNKNOWN";
6
+ return PushTokenPlatform2;
7
+ })(PushTokenPlatform || {});
8
+ export {
9
+ PushTokenPlatform
10
+ };
@@ -0,0 +1,4 @@
1
+ export declare enum PushTokenProvider {
2
+ FIREBASE = "FIREBASE"
3
+ }
4
+ //# sourceMappingURL=push-token-provider.enum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"push-token-provider.enum.d.ts","sourceRoot":"","sources":["../../../../src/notifications/push-device-tokens/enums/push-token-provider.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,iBAAiB;IAC3B,QAAQ,aAAa;CACtB"}
@@ -0,0 +1,7 @@
1
+ var PushTokenProvider = /* @__PURE__ */ ((PushTokenProvider2) => {
2
+ PushTokenProvider2["FIREBASE"] = "FIREBASE";
3
+ return PushTokenProvider2;
4
+ })(PushTokenProvider || {});
5
+ export {
6
+ PushTokenProvider
7
+ };
@@ -0,0 +1,3 @@
1
+ export { PushDeviceToken } from './push-device-token.entity';
2
+ export * from './enums';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/notifications/push-device-tokens/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,cAAc,SAAS,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { PushDeviceToken } from "./push-device-token.entity.js";
2
+ export * from "./enums/index.js";
3
+ export {
4
+ PushDeviceToken
5
+ };
@@ -0,0 +1,18 @@
1
+ import { User } from '../../app-auth';
2
+ import { PushTokenPlatform, PushTokenProvider } from './enums';
3
+ export declare class PushDeviceToken {
4
+ id: string;
5
+ userId: string;
6
+ provider: PushTokenProvider;
7
+ platform: PushTokenPlatform;
8
+ token: string;
9
+ tokenHash: string;
10
+ deviceId: string | null;
11
+ isActive: boolean;
12
+ lastSeenAt: Date;
13
+ createdAt: Date;
14
+ updatedAt: Date;
15
+ deletedAt: Date | null;
16
+ user: User;
17
+ }
18
+ //# sourceMappingURL=push-device-token.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"push-device-token.entity.d.ts","sourceRoot":"","sources":["../../../src/notifications/push-device-tokens/push-device-token.entity.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE/D,qBAWa,eAAe;IAI1B,EAAE,EAAE,MAAM,CAAC;IAOX,MAAM,EAAE,MAAM,CAAC;IAQf,QAAQ,EAAE,iBAAiB,CAAC;IAQ5B,QAAQ,EAAE,iBAAiB,CAAC;IAM5B,KAAK,EAAE,MAAM,CAAC;IAQd,SAAS,EAAE,MAAM,CAAC;IASlB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAQxB,QAAQ,EAAE,OAAO,CAAC;IAQlB,UAAU,EAAE,IAAI,CAAC;IAOjB,SAAS,EAAE,IAAI,CAAC;IAOhB,SAAS,EAAE,IAAI,CAAC;IAQhB,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;IAMvB,IAAI,EAAE,IAAI,CAAC;CACZ"}
@@ -0,0 +1,136 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result) __defProp(target, key, result);
9
+ return result;
10
+ };
11
+ import {
12
+ Column,
13
+ CreateDateColumn,
14
+ DeleteDateColumn,
15
+ Entity,
16
+ Index,
17
+ JoinColumn,
18
+ ManyToOne,
19
+ PrimaryGeneratedColumn,
20
+ UpdateDateColumn
21
+ } from "typeorm";
22
+ import { User } from "../../app-auth/index.js";
23
+ import { PushTokenPlatform, PushTokenProvider } from "./enums/index.js";
24
+ let PushDeviceToken = class {
25
+ };
26
+ __decorateClass([
27
+ PrimaryGeneratedColumn("uuid", {
28
+ comment: "Identificador unico do token de push por dispositivo."
29
+ })
30
+ ], PushDeviceToken.prototype, "id", 2);
31
+ __decorateClass([
32
+ Column({
33
+ name: "user_id",
34
+ type: "uuid",
35
+ comment: "FK users.id."
36
+ })
37
+ ], PushDeviceToken.prototype, "userId", 2);
38
+ __decorateClass([
39
+ Column({
40
+ type: "enum",
41
+ enum: PushTokenProvider,
42
+ enumName: "PushTokenProvider",
43
+ comment: "Provedor responsavel pelo token de push."
44
+ })
45
+ ], PushDeviceToken.prototype, "provider", 2);
46
+ __decorateClass([
47
+ Column({
48
+ type: "enum",
49
+ enum: PushTokenPlatform,
50
+ enumName: "PushTokenPlatform",
51
+ comment: "Plataforma/dispositivo de origem do token."
52
+ })
53
+ ], PushDeviceToken.prototype, "platform", 2);
54
+ __decorateClass([
55
+ Column({
56
+ type: "text",
57
+ comment: "Token bruto recebido do provedor."
58
+ })
59
+ ], PushDeviceToken.prototype, "token", 2);
60
+ __decorateClass([
61
+ Column({
62
+ name: "token_hash",
63
+ type: "char",
64
+ length: 64,
65
+ comment: "Hash do token para deduplicacao sem expor valor bruto."
66
+ })
67
+ ], PushDeviceToken.prototype, "tokenHash", 2);
68
+ __decorateClass([
69
+ Column({
70
+ name: "device_id",
71
+ type: "varchar",
72
+ length: 120,
73
+ nullable: true,
74
+ comment: "Identificador do dispositivo na aplicacao cliente."
75
+ })
76
+ ], PushDeviceToken.prototype, "deviceId", 2);
77
+ __decorateClass([
78
+ Column({
79
+ name: "is_active",
80
+ type: "boolean",
81
+ default: true,
82
+ comment: "Indica se o token esta ativo para novos envios."
83
+ })
84
+ ], PushDeviceToken.prototype, "isActive", 2);
85
+ __decorateClass([
86
+ Column({
87
+ name: "last_seen_at",
88
+ type: "timestamptz",
89
+ default: () => "now()",
90
+ comment: "Ultima vez em que o token foi validado/atualizado."
91
+ })
92
+ ], PushDeviceToken.prototype, "lastSeenAt", 2);
93
+ __decorateClass([
94
+ CreateDateColumn({
95
+ name: "created_at",
96
+ type: "timestamptz",
97
+ comment: "Data/hora de criacao do registro."
98
+ })
99
+ ], PushDeviceToken.prototype, "createdAt", 2);
100
+ __decorateClass([
101
+ UpdateDateColumn({
102
+ name: "updated_at",
103
+ type: "timestamptz",
104
+ comment: "Data/hora da ultima atualizacao do registro."
105
+ })
106
+ ], PushDeviceToken.prototype, "updatedAt", 2);
107
+ __decorateClass([
108
+ DeleteDateColumn({
109
+ name: "deleted_at",
110
+ type: "timestamptz",
111
+ nullable: true,
112
+ comment: "Data/hora de remocao logica do token."
113
+ })
114
+ ], PushDeviceToken.prototype, "deletedAt", 2);
115
+ __decorateClass([
116
+ ManyToOne(() => User, (user) => user.pushDeviceTokens, {
117
+ onDelete: "CASCADE"
118
+ }),
119
+ JoinColumn({ name: "user_id" })
120
+ ], PushDeviceToken.prototype, "user", 2);
121
+ PushDeviceToken = __decorateClass([
122
+ Entity("push_device_tokens"),
123
+ Index("UQ_push_device_tokens_provider_token_hash_active", ["provider", "tokenHash"], {
124
+ unique: true,
125
+ where: '"deleted_at" IS NULL'
126
+ }),
127
+ Index("IDX_push_device_tokens_user_active_updated", ["userId", "isActive", "updatedAt"]),
128
+ Index("IDX_push_device_tokens_last_seen_at", ["lastSeenAt"]),
129
+ Index("UQ_push_device_tokens_user_provider_device_active", ["userId", "provider", "deviceId"], {
130
+ unique: true,
131
+ where: '"device_id" IS NOT NULL AND "deleted_at" IS NULL'
132
+ })
133
+ ], PushDeviceToken);
134
+ export {
135
+ PushDeviceToken
136
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@natrave/shared-entities",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "description": "Entidades compartilhadass da NaTrave",
5
5
  "module": "dist/index.js",
6
6
  "main": "dist/index.js",
@@ -26,11 +26,11 @@
26
26
  "private": false,
27
27
  "devDependencies": {
28
28
  "@changesets/cli": "^2.29.8",
29
- "@eslint/js": "^9.38.0",
29
+ "@eslint/js": "^10.0.1",
30
30
  "@typescript-eslint/eslint-plugin": "^8.55.0",
31
31
  "@typescript-eslint/parser": "^8.55.0",
32
32
  "esbuild": "^0.27.3",
33
- "eslint": "^9.39.0",
33
+ "eslint": "^10.0.0",
34
34
  "eslint-config-prettier": "^10.1.8",
35
35
  "eslint-import-resolver-typescript": "^4.4.4",
36
36
  "eslint-plugin-import": "^2.32.0",
@@ -55,6 +55,7 @@
55
55
  "build:types": "tsc --emitDeclarationOnly",
56
56
  "build:js": "node build.js",
57
57
  "build": "pnpm run build:types && pnpm run build:js",
58
+ "changeset": "changeset",
58
59
  "clean": "rm -rf dist",
59
60
  "lint": "eslint src --ext .ts",
60
61
  "check:types": "tsc --noEmit",
@@ -1,6 +0,0 @@
1
- export declare enum NotificationPlatform {
2
- ANDROID = "android",
3
- IOS = "ios",
4
- WEB = "web"
5
- }
6
- //# sourceMappingURL=notification-platform.enum.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"notification-platform.enum.d.ts","sourceRoot":"","sources":["../../../../src/notifications/notification-tokens/enums/notification-platform.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,oBAAoB;IAC9B,OAAO,YAAY;IACnB,GAAG,QAAQ;IACX,GAAG,QAAQ;CACZ"}
@@ -1,9 +0,0 @@
1
- var NotificationPlatform = /* @__PURE__ */ ((NotificationPlatform2) => {
2
- NotificationPlatform2["ANDROID"] = "android";
3
- NotificationPlatform2["IOS"] = "ios";
4
- NotificationPlatform2["WEB"] = "web";
5
- return NotificationPlatform2;
6
- })(NotificationPlatform || {});
7
- export {
8
- NotificationPlatform
9
- };
@@ -1,3 +0,0 @@
1
- export { NotificationToken } from './notification-token.entity';
2
- export { NotificationPlatform } from './enums/notification-platform.enum';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/notifications/notification-tokens/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC"}
@@ -1,6 +0,0 @@
1
- import { NotificationToken } from "./notification-token.entity.js";
2
- import { NotificationPlatform } from "./enums/notification-platform.enum.js";
3
- export {
4
- NotificationPlatform,
5
- NotificationToken
6
- };
@@ -1,14 +0,0 @@
1
- import { User } from '../../app-auth';
2
- import { NotificationPlatform } from './enums/notification-platform.enum';
3
- export declare class NotificationToken {
4
- id: string;
5
- token: string;
6
- platform: NotificationPlatform;
7
- appVersion: string | null;
8
- isRevoked: boolean;
9
- createdAt: Date;
10
- lastSeenAt: Date;
11
- userId: string;
12
- user: User;
13
- }
14
- //# sourceMappingURL=notification-token.entity.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"notification-token.entity.d.ts","sourceRoot":"","sources":["../../../src/notifications/notification-tokens/notification-token.entity.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAY1E,qBAGa,iBAAiB;IAI5B,EAAE,EAAE,MAAM,CAAC;IAQX,KAAK,EAAE,MAAM,CAAC;IAOd,QAAQ,EAAE,oBAAoB,CAAC;IAS/B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAQ1B,SAAS,EAAE,OAAO,CAAC;IAOnB,SAAS,EAAE,IAAI,CAAC;IAOhB,UAAU,EAAE,IAAI,CAAC;IASjB,MAAM,EAAE,MAAM,CAAC;IAKf,IAAI,EAAE,IAAI,CAAC;CACZ"}
@@ -1,94 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __decorateClass = (decorators, target, key, kind) => {
4
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
- if (decorator = decorators[i])
7
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
- if (kind && result) __defProp(target, key, result);
9
- return result;
10
- };
11
- import {
12
- Column,
13
- CreateDateColumn,
14
- Entity,
15
- Index,
16
- ManyToOne,
17
- PrimaryGeneratedColumn,
18
- UpdateDateColumn
19
- } from "typeorm";
20
- import { User } from "../../app-auth/index.js";
21
- import { NotificationPlatform } from "./enums/notification-platform.enum.js";
22
- let NotificationToken = class {
23
- };
24
- __decorateClass([
25
- PrimaryGeneratedColumn("uuid", {
26
- comment: "Identificador \xFAnico do token (UUID)."
27
- })
28
- ], NotificationToken.prototype, "id", 2);
29
- __decorateClass([
30
- Column({
31
- name: "token",
32
- type: "varchar",
33
- length: 255,
34
- comment: "Registration token gerado pelo Firebase para o dispositivo."
35
- })
36
- ], NotificationToken.prototype, "token", 2);
37
- __decorateClass([
38
- Column({
39
- type: "enum",
40
- enum: NotificationPlatform,
41
- comment: "Plataforma do dispositivo."
42
- })
43
- ], NotificationToken.prototype, "platform", 2);
44
- __decorateClass([
45
- Column({
46
- name: "app_version",
47
- type: "varchar",
48
- length: 32,
49
- nullable: true,
50
- comment: "Vers\xE3o do app no momento do cadastro/refresh."
51
- })
52
- ], NotificationToken.prototype, "appVersion", 2);
53
- __decorateClass([
54
- Column({
55
- name: "is_revoked",
56
- type: "bool",
57
- default: false,
58
- comment: "Indica se o token foi revogado (logout, erro 404/410 do FCM)."
59
- })
60
- ], NotificationToken.prototype, "isRevoked", 2);
61
- __decorateClass([
62
- CreateDateColumn({
63
- name: "created_at",
64
- type: "timestamptz",
65
- comment: "Data de cria\xE7\xE3o do token."
66
- })
67
- ], NotificationToken.prototype, "createdAt", 2);
68
- __decorateClass([
69
- UpdateDateColumn({
70
- name: "last_seen_at",
71
- type: "timestamptz",
72
- comment: "\xDAltima vez que este token foi visto (refresh ou push bem-sucedido)."
73
- })
74
- ], NotificationToken.prototype, "lastSeenAt", 2);
75
- __decorateClass([
76
- Column({
77
- name: "user_id",
78
- type: "uuid",
79
- comment: "FK users.id"
80
- })
81
- ], NotificationToken.prototype, "userId", 2);
82
- __decorateClass([
83
- ManyToOne(() => User, (user) => user.notificationTokens, {
84
- onDelete: "CASCADE"
85
- })
86
- ], NotificationToken.prototype, "user", 2);
87
- NotificationToken = __decorateClass([
88
- Entity("notification_tokens"),
89
- Index("IDX_notification_tokens_token", ["token"], { unique: true }),
90
- Index("IDX_notification_tokens_user", ["userId"])
91
- ], NotificationToken);
92
- export {
93
- NotificationToken
94
- };