vintasend 0.2.3 → 0.4.0

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 (133) hide show
  1. package/README.md +227 -12
  2. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/next.config.d.ts +1 -1
  3. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/next.config.js +9 -4
  4. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/forgot-password/forgot-password-notification-context.d.ts +6 -6
  5. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/forgot-password/forgot-password-notification-context.js +16 -17
  6. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/forgot-password/route.d.ts +7 -5
  7. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/forgot-password/route.js +105 -79
  8. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/login/route.d.ts +4 -5
  9. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/login/route.js +96 -66
  10. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/reset-password/route.d.ts +7 -5
  11. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/reset-password/route.js +95 -71
  12. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/signup/email-verification-notification-context.d.ts +6 -6
  13. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/signup/email-verification-notification-context.js +18 -18
  14. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/signup/route.d.ts +4 -5
  15. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/signup/route.js +124 -96
  16. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/verify-email/route.d.ts +7 -5
  17. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/verify-email/route.js +94 -70
  18. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/auth/login/page.d.ts +1 -1
  19. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/auth/login/page.js +67 -55
  20. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/auth/reset-password/[token]/page.d.ts +1 -1
  21. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/auth/reset-password/[token]/page.js +76 -63
  22. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/auth/signup/page.d.ts +1 -1
  23. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/auth/signup/page.js +87 -63
  24. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/auth/verify-email/[token]/page.d.ts +1 -1
  25. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/auth/verify-email/[token]/page.js +50 -35
  26. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/auth/verify-email-sent/page.d.ts +1 -1
  27. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/auth/verify-email-sent/page.js +12 -12
  28. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/layout.d.ts +7 -5
  29. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/layout.js +15 -16
  30. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/page.d.ts +1 -1
  31. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/page.js +65 -21
  32. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/AuthLayout.d.ts +7 -4
  33. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/AuthLayout.js +7 -8
  34. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/accordion.d.ts +18 -6
  35. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/accordion.js +86 -48
  36. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/alert-dialog.d.ts +58 -14
  37. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/alert-dialog.js +135 -53
  38. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/alert.d.ts +21 -7
  39. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/alert.js +85 -49
  40. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/avatar.d.ts +14 -5
  41. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/avatar.js +77 -40
  42. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/button.d.ts +25 -9
  43. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/button.js +80 -58
  44. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/card.d.ts +19 -7
  45. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/card.js +98 -48
  46. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/checkbox.d.ts +6 -3
  47. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/checkbox.js +66 -42
  48. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/collapsible.d.ts +10 -4
  49. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/collapsible.js +48 -35
  50. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/dialog.d.ts +40 -13
  51. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/dialog.js +116 -50
  52. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/dropdown-menu.d.ts +83 -19
  53. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/dropdown-menu.js +170 -68
  54. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/form.d.ts +53 -21
  55. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/form.js +137 -83
  56. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/input.d.ts +8 -2
  57. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/input.js +60 -37
  58. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/label.d.ts +10 -4
  59. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/label.js +61 -40
  60. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/menubar.d.ts +77 -23
  61. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/menubar.js +188 -64
  62. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/select.d.ts +48 -12
  63. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/select.js +148 -66
  64. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/textarea.d.ts +8 -2
  65. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/textarea.js +59 -37
  66. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/api-clients/auth.d.ts +10 -10
  67. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/api-clients/auth.js +54 -55
  68. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/api-clients/core.d.ts +14 -11
  69. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/api-clients/core.js +1 -2
  70. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/email.js +0 -1
  71. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/logger.d.ts +3 -3
  72. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/logger.js +9 -10
  73. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/schemas/auth.d.ts +66 -32
  74. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/schemas/auth.js +74 -54
  75. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/services/auth.js +7 -8
  76. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/services/notifications-with-queue.d.ts +14 -4
  77. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/services/notifications-with-queue.js +14 -10
  78. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/services/notifications.d.ts +11 -7
  79. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/services/notifications.js +39 -26
  80. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/services/temporal-queue-service.d.ts +11 -8
  81. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/services/temporal-queue-service.js +14 -15
  82. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/temporal.d.ts +1 -1
  83. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/temporal.js +9 -10
  84. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/utils.d.ts +1 -1
  85. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/utils.js +4 -5
  86. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/workers/notifications/activities.d.ts +6 -5
  87. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/workers/notifications/activities.js +14 -14
  88. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/workers/notifications/config.d.ts +1 -1
  89. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/workers/notifications/config.js +2 -3
  90. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/workers/notifications/constants.d.ts +1 -1
  91. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/workers/notifications/constants.js +1 -2
  92. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/workers/notifications/worker.js +20 -22
  93. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/workers/notifications/workflows.d.ts +3 -2
  94. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/workers/notifications/workflows.js +10 -9
  95. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/tailwind.config.d.ts +74 -74
  96. package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/tailwind.config.js +80 -81
  97. package/dist/implementations/vintasend-nodemailer/src/index.js +6 -4
  98. package/dist/implementations/vintasend-nodemailer/src/nodemailer-notification-adapter.d.ts +36 -14
  99. package/dist/implementations/vintasend-nodemailer/src/nodemailer-notification-adapter.js +26 -28
  100. package/dist/implementations/vintasend-prisma/src/index.js +6 -4
  101. package/dist/implementations/vintasend-prisma/src/prisma-notification-backend.d.ts +232 -138
  102. package/dist/implementations/vintasend-prisma/src/prisma-notification-backend.js +275 -262
  103. package/dist/implementations/vintasend-pug/src/index.js +6 -4
  104. package/dist/implementations/vintasend-pug/src/pug-email-template-renderer.d.ts +18 -7
  105. package/dist/implementations/vintasend-pug/src/pug-email-template-renderer.js +19 -21
  106. package/dist/implementations/vintasend-winston/src/index.js +6 -4
  107. package/dist/implementations/vintasend-winston/src/winston-logger.d.ts +6 -6
  108. package/dist/implementations/vintasend-winston/src/winston-logger.js +65 -50
  109. package/dist/index.d.ts +13 -5
  110. package/dist/index.js +13 -1
  111. package/dist/services/attachment-manager/base-attachment-manager.d.ts +42 -0
  112. package/dist/services/attachment-manager/base-attachment-manager.js +115 -0
  113. package/dist/services/attachment-manager/local-file-attachment-manager.d.ts +58 -0
  114. package/dist/services/attachment-manager/local-file-attachment-manager.js +192 -0
  115. package/dist/services/notification-adapters/base-notification-adapter.d.ts +36 -4
  116. package/dist/services/notification-adapters/base-notification-adapter.js +73 -4
  117. package/dist/services/notification-backends/base-notification-backend.d.ts +54 -11
  118. package/dist/services/notification-backends/base-notification-backend.js +12 -0
  119. package/dist/services/notification-context-generators-map.d.ts +1 -1
  120. package/dist/services/notification-context-registry.d.ts +14 -9
  121. package/dist/services/notification-context-registry.js +30 -31
  122. package/dist/services/notification-queue-service/base-notification-queue-service.d.ts +1 -1
  123. package/dist/services/notification-service.d.ts +73 -13
  124. package/dist/services/notification-service.js +125 -8
  125. package/dist/services/notification-template-renderers/base-email-template-renderer.d.ts +3 -3
  126. package/dist/services/notification-template-renderers/base-notification-template-renderer.d.ts +2 -2
  127. package/dist/types/attachment.d.ts +42 -0
  128. package/dist/types/attachment.js +7 -0
  129. package/dist/types/notification-type-config.d.ts +2 -2
  130. package/dist/types/notification.d.ts +21 -0
  131. package/dist/types/one-off-notification.d.ts +72 -0
  132. package/dist/types/one-off-notification.js +2 -0
  133. package/package.json +13 -11
@@ -1,159 +1,253 @@
1
1
  import type { BaseNotificationBackend } from 'vintasend/src/services/notification-backends/base-notification-backend';
2
2
  import type { ContextGenerator } from 'vintasend/src/services/notification-context-registry';
3
+ import type { Identifier } from 'vintasend/src/types/identifier';
3
4
  import type { InputJsonValue, JsonValue } from 'vintasend/src/types/json-values';
4
5
  import type { Notification, NotificationInput } from 'vintasend/src/types/notification';
5
6
  import type { NotificationStatus } from 'vintasend/src/types/notification-status';
6
7
  import type { NotificationType } from 'vintasend/src/types/notification-type';
7
- import type { Identifier } from 'vintasend/src/types/identifier';
8
8
  export declare const NotificationStatusEnum: {
9
- readonly PENDING_SEND: "PENDING_SEND";
10
- readonly SENT: "SENT";
11
- readonly FAILED: "FAILED";
12
- readonly READ: "READ";
13
- readonly CANCELLED: "CANCELLED";
9
+ readonly PENDING_SEND: 'PENDING_SEND';
10
+ readonly SENT: 'SENT';
11
+ readonly FAILED: 'FAILED';
12
+ readonly READ: 'READ';
13
+ readonly CANCELLED: 'CANCELLED';
14
14
  };
15
15
  export declare const NotificationTypeEnum: {
16
- readonly EMAIL: "EMAIL";
17
- readonly PUSH: "PUSH";
18
- readonly SMS: "SMS";
19
- readonly IN_APP: "IN_APP";
16
+ readonly EMAIL: 'EMAIL';
17
+ readonly PUSH: 'PUSH';
18
+ readonly SMS: 'SMS';
19
+ readonly IN_APP: 'IN_APP';
20
20
  };
21
21
  export interface PrismaNotificationModel<IdType, UserId> {
22
- id: IdType;
23
- userId: UserId;
24
- notificationType: NotificationType;
25
- title: string | null;
26
- bodyTemplate: string;
27
- contextName: string;
28
- contextParameters: JsonValue;
29
- sendAfter: Date | null;
30
- subjectTemplate: string | null;
31
- status: NotificationStatus;
32
- contextUsed: JsonValue | null;
33
- extraParams: JsonValue | null;
34
- adapterUsed: string | null;
35
- sentAt: Date | null;
36
- readAt: Date | null;
37
- createdAt: Date;
38
- updatedAt: Date;
39
- user?: {
40
- email: string;
41
- };
22
+ id: IdType;
23
+ userId: UserId;
24
+ notificationType: NotificationType;
25
+ title: string | null;
26
+ bodyTemplate: string;
27
+ contextName: string;
28
+ contextParameters: JsonValue;
29
+ sendAfter: Date | null;
30
+ subjectTemplate: string | null;
31
+ status: NotificationStatus;
32
+ contextUsed: JsonValue | null;
33
+ extraParams: JsonValue | null;
34
+ adapterUsed: string | null;
35
+ sentAt: Date | null;
36
+ readAt: Date | null;
37
+ createdAt: Date;
38
+ updatedAt: Date;
39
+ user?: {
40
+ email: string;
41
+ };
42
42
  }
43
43
  export interface NotificationPrismaClientInterface<NotificationIdType, UserIdType> {
44
- notification: {
45
- findMany(args: {
46
- where?: {
47
- status?: NotificationStatus | {
48
- not: NotificationStatus;
49
- };
50
- sendAfter?: {
51
- lte: Date;
52
- } | null;
53
- userId?: UserIdType;
54
- readAt?: null;
55
- };
56
- skip?: number;
57
- take?: number;
58
- include?: {
59
- user?: boolean;
60
- };
61
- }): Promise<PrismaNotificationModel<NotificationIdType, UserIdType>[]>;
62
- create(args: {
63
- data: BaseNotificationCreateInput<UserIdType>;
64
- include?: {
65
- user?: boolean;
66
- };
67
- }): Promise<PrismaNotificationModel<NotificationIdType, UserIdType>>;
68
- update(args: {
69
- where: {
70
- id: NotificationIdType;
71
- };
72
- data: Partial<BaseNotificationUpdateInput<UserIdType>>;
73
- include?: {
74
- user?: boolean;
75
- };
76
- }): Promise<PrismaNotificationModel<NotificationIdType, UserIdType>>;
77
- findUnique(args: {
78
- where: {
79
- id: NotificationIdType;
80
- };
81
- include?: {
82
- user?: boolean;
44
+ notification: {
45
+ findMany(args: {
46
+ where?: {
47
+ status?:
48
+ | NotificationStatus
49
+ | {
50
+ not: NotificationStatus;
83
51
  };
84
- }): Promise<PrismaNotificationModel<NotificationIdType, UserIdType> | null>;
85
- };
52
+ sendAfter?: {
53
+ lte: Date;
54
+ } | null;
55
+ userId?: UserIdType;
56
+ readAt?: null;
57
+ };
58
+ skip?: number;
59
+ take?: number;
60
+ include?: {
61
+ user?: boolean;
62
+ };
63
+ }): Promise<PrismaNotificationModel<NotificationIdType, UserIdType>[]>;
64
+ create(args: {
65
+ data: BaseNotificationCreateInput<UserIdType>;
66
+ include?: {
67
+ user?: boolean;
68
+ };
69
+ }): Promise<PrismaNotificationModel<NotificationIdType, UserIdType>>;
70
+ update(args: {
71
+ where: {
72
+ id: NotificationIdType;
73
+ };
74
+ data: Partial<BaseNotificationUpdateInput<UserIdType>>;
75
+ include?: {
76
+ user?: boolean;
77
+ };
78
+ }): Promise<PrismaNotificationModel<NotificationIdType, UserIdType>>;
79
+ findUnique(args: {
80
+ where: {
81
+ id: NotificationIdType;
82
+ };
83
+ include?: {
84
+ user?: boolean;
85
+ };
86
+ }): Promise<PrismaNotificationModel<NotificationIdType, UserIdType> | null>;
87
+ };
86
88
  }
87
89
  type NoExpand<T> = T extends unknown ? T : never;
88
- type AtLeast<O extends object, K extends string> = NoExpand<O extends unknown ? (K extends keyof O ? {
89
- [P in K]: O[P];
90
- } & O : O) | ({
91
- [P in keyof O as P extends K ? K : never]-?: O[P];
92
- } & O) : never>;
90
+ type AtLeast<O extends object, K extends string> = NoExpand<
91
+ O extends unknown
92
+ ?
93
+ | (K extends keyof O
94
+ ? {
95
+ [P in K]: O[P];
96
+ } & O
97
+ : O)
98
+ | ({
99
+ [P in keyof O as P extends K ? K : never]-?: O[P];
100
+ } & O)
101
+ : never
102
+ >;
93
103
  export interface BaseNotificationCreateInput<UserIdType> {
94
- user: {
95
- connect?: AtLeast<{
96
- id?: UserIdType;
97
- email?: string;
98
- }, 'id' | 'email'>;
99
- };
100
- notificationType: NotificationType;
101
- title?: string | null;
102
- bodyTemplate: string;
103
- contextName: string;
104
- contextParameters: InputJsonValue;
105
- sendAfter?: Date | null;
106
- subjectTemplate?: string | null;
107
- status?: NotificationStatus;
108
- contextUsed?: InputJsonValue;
109
- extraParams?: InputJsonValue;
110
- adapterUsed?: string | null;
111
- sentAt?: Date | null;
112
- readAt?: Date | null;
104
+ user: {
105
+ connect?: AtLeast<
106
+ {
107
+ id?: UserIdType;
108
+ email?: string;
109
+ },
110
+ 'id' | 'email'
111
+ >;
112
+ };
113
+ notificationType: NotificationType;
114
+ title?: string | null;
115
+ bodyTemplate: string;
116
+ contextName: string;
117
+ contextParameters: InputJsonValue;
118
+ sendAfter?: Date | null;
119
+ subjectTemplate?: string | null;
120
+ status?: NotificationStatus;
121
+ contextUsed?: InputJsonValue;
122
+ extraParams?: InputJsonValue;
123
+ adapterUsed?: string | null;
124
+ sentAt?: Date | null;
125
+ readAt?: Date | null;
113
126
  }
114
127
  export interface BaseNotificationUpdateInput<UserIdType> {
115
- user: {
116
- connect?: AtLeast<{
117
- id?: UserIdType;
118
- email?: string;
119
- }, 'id' | 'email'>;
120
- };
121
- notificationType?: NotificationType;
122
- title?: string | null;
123
- bodyTemplate?: string;
124
- contextName?: string;
125
- contextParameters?: InputJsonValue;
126
- sendAfter?: Date | null;
127
- subjectTemplate?: string | null;
128
- status?: NotificationStatus;
129
- contextUsed?: InputJsonValue;
130
- extraParams?: InputJsonValue;
131
- adapterUsed?: string | null;
132
- sentAt?: Date | null;
133
- readAt?: Date | null;
128
+ user: {
129
+ connect?: AtLeast<
130
+ {
131
+ id?: UserIdType;
132
+ email?: string;
133
+ },
134
+ 'id' | 'email'
135
+ >;
136
+ };
137
+ notificationType?: NotificationType;
138
+ title?: string | null;
139
+ bodyTemplate?: string;
140
+ contextName?: string;
141
+ contextParameters?: InputJsonValue;
142
+ sendAfter?: Date | null;
143
+ subjectTemplate?: string | null;
144
+ status?: NotificationStatus;
145
+ contextUsed?: InputJsonValue;
146
+ extraParams?: InputJsonValue;
147
+ adapterUsed?: string | null;
148
+ sentAt?: Date | null;
149
+ readAt?: Date | null;
134
150
  }
135
- export declare class PrismaNotificationBackend<Client extends NotificationPrismaClientInterface<NotificationIdType, UserIdType>, AvailableContexts extends Record<string, ContextGenerator>, NotificationIdType extends Identifier = Identifier, UserIdType extends Identifier = Identifier> implements BaseNotificationBackend<AvailableContexts, NotificationIdType, UserIdType> {
136
- private prismaClient;
137
- constructor(prismaClient: Client);
138
- serializeNotification(notification: NonNullable<Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>>): Notification<AvailableContexts, NotificationIdType, UserIdType>;
139
- deserializeNotification(notification: NotificationInput<AvailableContexts, UserIdType>): BaseNotificationCreateInput<UserIdType>;
140
- deserializeNotificationForUpdate(notification: Partial<Notification<AvailableContexts, NotificationIdType, UserIdType>>): Partial<Parameters<typeof this.prismaClient.notification.update>[0]['data']>;
141
- getAllPendingNotifications(): Promise<Notification<AvailableContexts, NotificationIdType, UserIdType>[]>;
142
- getPendingNotifications(): Promise<Notification<AvailableContexts, NotificationIdType, UserIdType>[]>;
143
- getAllFutureNotifications(): Promise<Notification<AvailableContexts, NotificationIdType, UserIdType>[]>;
144
- getFutureNotifications(): Promise<Notification<AvailableContexts, NotificationIdType, UserIdType>[]>;
145
- getAllFutureNotificationsFromUser(userId: NonNullable<Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>>['userId']): Promise<Notification<AvailableContexts, NotificationIdType, UserIdType>[]>;
146
- getFutureNotificationsFromUser(userId: NonNullable<Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>>['userId']): Promise<Notification<AvailableContexts, NotificationIdType, UserIdType>[]>;
147
- persistNotification(notification: NotificationInput<AvailableContexts, UserIdType>): Promise<Notification<AvailableContexts, NotificationIdType, UserIdType>>;
148
- persistNotificationUpdate(notificationId: NonNullable<Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>>['id'], notification: Partial<Omit<Notification<AvailableContexts, NotificationIdType, UserIdType>, 'id'>>): Promise<Notification<AvailableContexts, NotificationIdType, UserIdType>>;
149
- markPendingAsSent(notificationId: NonNullable<Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>>['id']): Promise<Notification<AvailableContexts, NotificationIdType, UserIdType>>;
150
- markPendingAsFailed(notificationId: NonNullable<Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>>['id']): Promise<Notification<AvailableContexts, NotificationIdType, UserIdType>>;
151
- markSentAsRead(notificationId: NonNullable<Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>>['id']): Promise<Notification<AvailableContexts, NotificationIdType, UserIdType>>;
152
- cancelNotification(notificationId: NonNullable<Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>>['id']): Promise<void>;
153
- getNotification(notificationId: NonNullable<Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>>['id'], _forUpdate: boolean): Promise<Notification<AvailableContexts, NotificationIdType, UserIdType> | null>;
154
- filterAllInAppUnreadNotifications(userId: NonNullable<Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>>['userId']): Promise<Notification<AvailableContexts, NotificationIdType, UserIdType>[]>;
155
- filterInAppUnreadNotifications(userId: NonNullable<Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>>['userId'], page: number, pageSize: number): Promise<Notification<AvailableContexts, NotificationIdType, UserIdType>[]>;
156
- getUserEmailFromNotification(notificationId: NonNullable<Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>>['id']): Promise<string | undefined>;
157
- storeContextUsed(notificationId: NonNullable<Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>>['id'], context: InputJsonValue): Promise<void>;
151
+ export declare class PrismaNotificationBackend<
152
+ Client extends NotificationPrismaClientInterface<NotificationIdType, UserIdType>,
153
+ AvailableContexts extends Record<string, ContextGenerator>,
154
+ NotificationIdType extends Identifier = Identifier,
155
+ UserIdType extends Identifier = Identifier,
156
+ > implements BaseNotificationBackend<AvailableContexts, NotificationIdType, UserIdType>
157
+ {
158
+ private prismaClient;
159
+ constructor(prismaClient: Client);
160
+ serializeNotification(
161
+ notification: NonNullable<
162
+ Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>
163
+ >,
164
+ ): Notification<AvailableContexts, NotificationIdType, UserIdType>;
165
+ deserializeNotification(
166
+ notification: NotificationInput<AvailableContexts, UserIdType>,
167
+ ): BaseNotificationCreateInput<UserIdType>;
168
+ deserializeNotificationForUpdate(
169
+ notification: Partial<Notification<AvailableContexts, NotificationIdType, UserIdType>>,
170
+ ): Partial<Parameters<typeof this.prismaClient.notification.update>[0]['data']>;
171
+ getAllPendingNotifications(): Promise<
172
+ Notification<AvailableContexts, NotificationIdType, UserIdType>[]
173
+ >;
174
+ getPendingNotifications(): Promise<
175
+ Notification<AvailableContexts, NotificationIdType, UserIdType>[]
176
+ >;
177
+ getAllFutureNotifications(): Promise<
178
+ Notification<AvailableContexts, NotificationIdType, UserIdType>[]
179
+ >;
180
+ getFutureNotifications(): Promise<
181
+ Notification<AvailableContexts, NotificationIdType, UserIdType>[]
182
+ >;
183
+ getAllFutureNotificationsFromUser(
184
+ userId: NonNullable<
185
+ Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>
186
+ >['userId'],
187
+ ): Promise<Notification<AvailableContexts, NotificationIdType, UserIdType>[]>;
188
+ getFutureNotificationsFromUser(
189
+ userId: NonNullable<
190
+ Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>
191
+ >['userId'],
192
+ ): Promise<Notification<AvailableContexts, NotificationIdType, UserIdType>[]>;
193
+ persistNotification(
194
+ notification: NotificationInput<AvailableContexts, UserIdType>,
195
+ ): Promise<Notification<AvailableContexts, NotificationIdType, UserIdType>>;
196
+ persistNotificationUpdate(
197
+ notificationId: NonNullable<
198
+ Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>
199
+ >['id'],
200
+ notification: Partial<
201
+ Omit<Notification<AvailableContexts, NotificationIdType, UserIdType>, 'id'>
202
+ >,
203
+ ): Promise<Notification<AvailableContexts, NotificationIdType, UserIdType>>;
204
+ markPendingAsSent(
205
+ notificationId: NonNullable<
206
+ Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>
207
+ >['id'],
208
+ ): Promise<Notification<AvailableContexts, NotificationIdType, UserIdType>>;
209
+ markPendingAsFailed(
210
+ notificationId: NonNullable<
211
+ Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>
212
+ >['id'],
213
+ ): Promise<Notification<AvailableContexts, NotificationIdType, UserIdType>>;
214
+ markSentAsRead(
215
+ notificationId: NonNullable<
216
+ Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>
217
+ >['id'],
218
+ ): Promise<Notification<AvailableContexts, NotificationIdType, UserIdType>>;
219
+ cancelNotification(
220
+ notificationId: NonNullable<
221
+ Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>
222
+ >['id'],
223
+ ): Promise<void>;
224
+ getNotification(
225
+ notificationId: NonNullable<
226
+ Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>
227
+ >['id'],
228
+ _forUpdate: boolean,
229
+ ): Promise<Notification<AvailableContexts, NotificationIdType, UserIdType> | null>;
230
+ filterAllInAppUnreadNotifications(
231
+ userId: NonNullable<
232
+ Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>
233
+ >['userId'],
234
+ ): Promise<Notification<AvailableContexts, NotificationIdType, UserIdType>[]>;
235
+ filterInAppUnreadNotifications(
236
+ userId: NonNullable<
237
+ Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>
238
+ >['userId'],
239
+ page: number,
240
+ pageSize: number,
241
+ ): Promise<Notification<AvailableContexts, NotificationIdType, UserIdType>[]>;
242
+ getUserEmailFromNotification(
243
+ notificationId: NonNullable<
244
+ Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>
245
+ >['id'],
246
+ ): Promise<string | undefined>;
247
+ storeContextUsed(
248
+ notificationId: NonNullable<
249
+ Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>
250
+ >['id'],
251
+ context: InputJsonValue,
252
+ ): Promise<void>;
158
253
  }
159
- export {};