vintasend-prisma 0.1.6 → 0.1.8

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.
@@ -1,7 +1,7 @@
1
1
  import type { BaseNotificationBackend } from 'vintasend/dist/services/notification-backends/base-notification-backend';
2
2
  import type { ContextGenerator } from 'vintasend/dist/services/notification-context-registry';
3
3
  import type { InputJsonValue, JsonValue } from 'vintasend/dist/types/json-values';
4
- import type { Notification, NotificationInput } from 'vintasend/dist/types/notification';
4
+ import type { DatabaseNotification, Notification, NotificationInput } from 'vintasend/dist/types/notification';
5
5
  import type { NotificationStatus } from 'vintasend/dist/types/notification-status';
6
6
  import type { NotificationType } from 'vintasend/dist/types/notification-type';
7
7
  import type { Identifier } from 'vintasend/dist/types/identifier';
@@ -135,24 +135,24 @@ export interface BaseNotificationUpdateInput<UserIdType> {
135
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
136
  private prismaClient;
137
137
  constructor(prismaClient: Client);
138
- serializeNotification(notification: NonNullable<Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>>): Notification<AvailableContexts, NotificationIdType, UserIdType>;
138
+ serializeNotification(notification: NonNullable<Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>>): DatabaseNotification<AvailableContexts, NotificationIdType, UserIdType>;
139
139
  deserializeNotification(notification: NotificationInput<AvailableContexts, UserIdType>): BaseNotificationCreateInput<UserIdType>;
140
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>>;
141
+ getAllPendingNotifications(): Promise<DatabaseNotification<AvailableContexts, NotificationIdType, UserIdType>[]>;
142
+ getPendingNotifications(): Promise<DatabaseNotification<AvailableContexts, NotificationIdType, UserIdType>[]>;
143
+ getAllFutureNotifications(): Promise<DatabaseNotification<AvailableContexts, NotificationIdType, UserIdType>[]>;
144
+ getFutureNotifications(): Promise<DatabaseNotification<AvailableContexts, NotificationIdType, UserIdType>[]>;
145
+ getAllFutureNotificationsFromUser(userId: NonNullable<Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>>['userId']): Promise<DatabaseNotification<AvailableContexts, NotificationIdType, UserIdType>[]>;
146
+ getFutureNotificationsFromUser(userId: NonNullable<Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>>['userId']): Promise<DatabaseNotification<AvailableContexts, NotificationIdType, UserIdType>[]>;
147
+ persistNotification(notification: NotificationInput<AvailableContexts, UserIdType>): Promise<DatabaseNotification<AvailableContexts, NotificationIdType, UserIdType>>;
148
+ persistNotificationUpdate(notificationId: NonNullable<Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>>['id'], notification: Partial<Omit<DatabaseNotification<AvailableContexts, NotificationIdType, UserIdType>, 'id'>>): Promise<DatabaseNotification<AvailableContexts, NotificationIdType, UserIdType>>;
149
+ markPendingAsSent(notificationId: NonNullable<Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>>['id']): Promise<DatabaseNotification<AvailableContexts, NotificationIdType, UserIdType>>;
150
+ markPendingAsFailed(notificationId: NonNullable<Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>>['id']): Promise<DatabaseNotification<AvailableContexts, NotificationIdType, UserIdType>>;
151
+ markSentAsRead(notificationId: NonNullable<Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>>['id']): Promise<DatabaseNotification<AvailableContexts, NotificationIdType, UserIdType>>;
152
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>[]>;
153
+ getNotification(notificationId: NonNullable<Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>>['id'], _forUpdate: boolean): Promise<DatabaseNotification<AvailableContexts, NotificationIdType, UserIdType> | null>;
154
+ filterAllInAppUnreadNotifications(userId: NonNullable<Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>>['userId']): Promise<DatabaseNotification<AvailableContexts, NotificationIdType, UserIdType>[]>;
155
+ filterInAppUnreadNotifications(userId: NonNullable<Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>>['userId'], page: number, pageSize: number): Promise<DatabaseNotification<AvailableContexts, NotificationIdType, UserIdType>[]>;
156
156
  getUserEmailFromNotification(notificationId: NonNullable<Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>>['id']): Promise<string | undefined>;
157
157
  storeContextUsed(notificationId: NonNullable<Awaited<ReturnType<typeof this.prismaClient.notification.findUnique>>>['id'], context: InputJsonValue): Promise<void>;
158
158
  }
@@ -15,7 +15,7 @@ exports.NotificationTypeEnum = {
15
15
  IN_APP: 'IN_APP',
16
16
  };
17
17
  function convertJsonValueToRecord(jsonValue) {
18
- if (typeof jsonValue === 'object' && !Array.isArray(jsonValue) && jsonValue !== null) {
18
+ if (typeof jsonValue === 'object' && !Array.isArray(jsonValue)) {
19
19
  return jsonValue;
20
20
  }
21
21
  throw new Error('Invalid JSON value. It should be an object.');
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "vintasend-prisma",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "VintaSend Backend implementation for Prisma",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
7
7
  "build": "tsc",
8
- "prepublishOnly": "npm run build"
8
+ "prepublishOnly": "npm run build",
9
+ "test": "jest",
10
+ "test:watch": "jest --watch",
11
+ "test:coverage": "jest --coverage"
9
12
  },
10
13
  "files": [
11
14
  "dist"
@@ -15,9 +18,12 @@
15
18
  "dependencies": {
16
19
  "@prisma/client": "^6.3.1",
17
20
  "prisma": "^6.3.1",
18
- "vintasend": "^0.1.6"
21
+ "vintasend": "^0.1.8"
19
22
  },
20
23
  "devDependencies": {
24
+ "@types/jest": "^29.5.14",
25
+ "jest": "^29.7.0",
26
+ "ts-jest": "^29.2.6",
21
27
  "typescript": "^5.8.2"
22
28
  }
23
29
  }