vintasend-prisma 0.1.12 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { PrismaNotificationBackendFactory } from './prisma-notification-backend';
|
|
2
|
+
export type { PrismaNotificationBackend } from './prisma-notification-backend';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.PrismaNotificationBackendFactory = void 0;
|
|
4
4
|
var prisma_notification_backend_1 = require("./prisma-notification-backend");
|
|
5
|
-
Object.defineProperty(exports, "
|
|
5
|
+
Object.defineProperty(exports, "PrismaNotificationBackendFactory", { enumerable: true, get: function () { return prisma_notification_backend_1.PrismaNotificationBackendFactory; } });
|
|
@@ -145,9 +145,9 @@ export declare class PrismaNotificationBackend<Client extends NotificationPrisma
|
|
|
145
145
|
getFutureNotificationsFromUser(userId: NonNullable<Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>>['userId']): Promise<DatabaseNotification<Config>[]>;
|
|
146
146
|
persistNotification(notification: NotificationInput<Config>): Promise<DatabaseNotification<Config>>;
|
|
147
147
|
persistNotificationUpdate(notificationId: NonNullable<Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>>['id'], notification: Partial<Omit<DatabaseNotification<Config>, 'id'>>): Promise<DatabaseNotification<Config>>;
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
148
|
+
markAsSent(notificationId: NonNullable<Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>>['id'], checkIsPending?: boolean): Promise<DatabaseNotification<Config>>;
|
|
149
|
+
markAsFailed(notificationId: NonNullable<Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>>['id'], checkIsPending?: boolean): Promise<DatabaseNotification<Config>>;
|
|
150
|
+
markAsRead(notificationId: NonNullable<Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>>['id'], checkIsSent?: boolean): Promise<DatabaseNotification<Config>>;
|
|
151
151
|
cancelNotification(notificationId: NonNullable<Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>>['id']): Promise<void>;
|
|
152
152
|
getNotification(notificationId: NonNullable<Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>>['id'], _forUpdate: boolean): Promise<DatabaseNotification<Config> | null>;
|
|
153
153
|
filterAllInAppUnreadNotifications(userId: NonNullable<Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>>['userId']): Promise<DatabaseNotification<Config>[]>;
|
|
@@ -155,4 +155,7 @@ export declare class PrismaNotificationBackend<Client extends NotificationPrisma
|
|
|
155
155
|
getUserEmailFromNotification(notificationId: NonNullable<Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>>['id']): Promise<string | undefined>;
|
|
156
156
|
storeContextUsed(notificationId: NonNullable<Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>>['id'], context: InputJsonValue): Promise<void>;
|
|
157
157
|
}
|
|
158
|
+
export declare class PrismaNotificationBackendFactory<Config extends BaseNotificationTypeConfig> {
|
|
159
|
+
create<Client extends NotificationPrismaClientInterface<Config['NotificationIdType'], Config['UserIdType']>>(prismaClient: Client): PrismaNotificationBackend<Client, Config>;
|
|
160
|
+
}
|
|
158
161
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PrismaNotificationBackend = exports.NotificationTypeEnum = exports.NotificationStatusEnum = void 0;
|
|
3
|
+
exports.PrismaNotificationBackendFactory = exports.PrismaNotificationBackend = exports.NotificationTypeEnum = exports.NotificationStatusEnum = void 0;
|
|
4
4
|
exports.NotificationStatusEnum = {
|
|
5
5
|
PENDING_SEND: 'PENDING_SEND',
|
|
6
6
|
SENT: 'SENT',
|
|
@@ -170,10 +170,11 @@ class PrismaNotificationBackend {
|
|
|
170
170
|
data: this.deserializeNotificationForUpdate(notification),
|
|
171
171
|
}));
|
|
172
172
|
}
|
|
173
|
-
async
|
|
173
|
+
async markAsSent(notificationId, checkIsPending = true) {
|
|
174
174
|
return this.serializeNotification(await this.prismaClient.notification.update({
|
|
175
175
|
where: {
|
|
176
176
|
id: notificationId,
|
|
177
|
+
...(checkIsPending ? { status: exports.NotificationStatusEnum.PENDING_SEND } : {}),
|
|
177
178
|
},
|
|
178
179
|
data: {
|
|
179
180
|
status: exports.NotificationStatusEnum.SENT,
|
|
@@ -181,10 +182,11 @@ class PrismaNotificationBackend {
|
|
|
181
182
|
},
|
|
182
183
|
}));
|
|
183
184
|
}
|
|
184
|
-
async
|
|
185
|
+
async markAsFailed(notificationId, checkIsPending = true) {
|
|
185
186
|
return this.serializeNotification(await this.prismaClient.notification.update({
|
|
186
187
|
where: {
|
|
187
188
|
id: notificationId,
|
|
189
|
+
...(checkIsPending ? { status: exports.NotificationStatusEnum.PENDING_SEND } : {}),
|
|
188
190
|
},
|
|
189
191
|
data: {
|
|
190
192
|
status: exports.NotificationStatusEnum.FAILED,
|
|
@@ -192,10 +194,11 @@ class PrismaNotificationBackend {
|
|
|
192
194
|
},
|
|
193
195
|
}));
|
|
194
196
|
}
|
|
195
|
-
async
|
|
197
|
+
async markAsRead(notificationId, checkIsSent = true) {
|
|
196
198
|
return this.serializeNotification(await this.prismaClient.notification.update({
|
|
197
199
|
where: {
|
|
198
200
|
id: notificationId,
|
|
201
|
+
...(checkIsSent ? { status: exports.NotificationStatusEnum.SENT } : {}),
|
|
199
202
|
},
|
|
200
203
|
data: {
|
|
201
204
|
status: 'READ',
|
|
@@ -270,3 +273,9 @@ class PrismaNotificationBackend {
|
|
|
270
273
|
}
|
|
271
274
|
}
|
|
272
275
|
exports.PrismaNotificationBackend = PrismaNotificationBackend;
|
|
276
|
+
class PrismaNotificationBackendFactory {
|
|
277
|
+
create(prismaClient) {
|
|
278
|
+
return new PrismaNotificationBackend(prismaClient);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
exports.PrismaNotificationBackendFactory = PrismaNotificationBackendFactory;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vintasend-prisma",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"description": "VintaSend Backend implementation for Prisma",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@prisma/client": "^6.3.1",
|
|
20
20
|
"prisma": "^6.3.1",
|
|
21
|
-
"vintasend": "^0.1.
|
|
21
|
+
"vintasend": "^0.1.14"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/jest": "^29.5.14",
|