@@ -144,10 +144,15 @@ type PrismaNotificationWhereInput<NotificationIdType, UserIdType> = {
144144 sentAt ?: PrismaDateRangeFilter ;
145145} ;
146146
147- export interface NotificationPrismaClientInterface < NotificationIdType , UserIdType > {
148- $transaction < R > (
149- fn : ( prisma : NotificationPrismaClientInterface < NotificationIdType , UserIdType > ) => Promise < R > ,
150- ) : Promise < R > ;
147+ type AwaitedTuple < T extends readonly unknown [ ] > = {
148+ [ K in keyof T ] : Awaited < T [ K ] > ;
149+ } ;
150+
151+ type PrismaTransactionOptions = {
152+ isolationLevel ?: unknown ;
153+ } ;
154+
155+ interface NotificationPrismaDelegates < NotificationIdType , UserIdType > {
151156 notification : {
152157 findMany ( args ?: {
153158 where ?: PrismaNotificationWhereInput < NotificationIdType , UserIdType > ;
@@ -232,6 +237,27 @@ export interface NotificationPrismaClientInterface<NotificationIdType, UserIdTyp
232237 } ;
233238}
234239
240+ export interface NotificationPrismaTransactionClientInterface < NotificationIdType , UserIdType >
241+ extends NotificationPrismaDelegates < NotificationIdType , UserIdType > { }
242+
243+ export interface NotificationPrismaClientInterface < NotificationIdType , UserIdType > {
244+ $transaction : {
245+ < R > (
246+ fn : (
247+ prisma : NotificationPrismaTransactionClientInterface < NotificationIdType , UserIdType > ,
248+ ) => Promise < R > ,
249+ options ?: PrismaTransactionOptions ,
250+ ) : Promise < R > ;
251+ < P extends readonly unknown [ ] > (
252+ arg : [ ...P ] ,
253+ options ?: PrismaTransactionOptions ,
254+ ) : Promise < AwaitedTuple < P > > ;
255+ } ;
256+ }
257+
258+ export interface NotificationPrismaClientInterface < NotificationIdType , UserIdType >
259+ extends NotificationPrismaDelegates < NotificationIdType , UserIdType > { }
260+
235261// cause typescript not to expand types and preserve names
236262type NoExpand < T > = T extends unknown ? T : never ;
237263
@@ -835,7 +861,10 @@ export class PrismaNotificationBackend<
835861 * @private
836862 */
837863 private async getOrCreateFileRecordForUploadInTransaction (
838- tx : NotificationPrismaClientInterface < Config [ 'NotificationIdType' ] , Config [ 'UserIdType' ] > ,
864+ tx : NotificationPrismaTransactionClientInterface <
865+ Config [ 'NotificationIdType' ] ,
866+ Config [ 'UserIdType' ]
867+ > ,
839868 att : Extract < NotificationAttachment , { file : unknown } > ,
840869 ) : Promise < AttachmentFileRecord > {
841870 const manager = this . getAttachmentManager ( ) ;
@@ -866,7 +895,10 @@ export class PrismaNotificationBackend<
866895 * @private `
867896 */
868897 private async createNotificationAttachmentLinkInTransaction (
869- tx : NotificationPrismaClientInterface < Config [ 'NotificationIdType' ] , Config [ 'UserIdType' ] > ,
898+ tx : NotificationPrismaTransactionClientInterface <
899+ Config [ 'NotificationIdType' ] ,
900+ Config [ 'UserIdType' ]
901+ > ,
870902 notificationId : Config [ 'NotificationIdType' ] ,
871903 fileId : string ,
872904 description ?: string | null ,
@@ -885,7 +917,10 @@ export class PrismaNotificationBackend<
885917 * @private
886918 */
887919 private async getAttachmentFileInTransaction (
888- tx : NotificationPrismaClientInterface < Config [ 'NotificationIdType' ] , Config [ 'UserIdType' ] > ,
920+ tx : NotificationPrismaTransactionClientInterface <
921+ Config [ 'NotificationIdType' ] ,
922+ Config [ 'UserIdType' ]
923+ > ,
889924 fileId : string ,
890925 ) : Promise < AttachmentFileRecord | null > {
891926 const file = await tx . attachmentFile . findUnique ( {
@@ -902,7 +937,10 @@ export class PrismaNotificationBackend<
902937 * @private
903938 */
904939 private async findAttachmentFileByChecksumInTransaction (
905- tx : NotificationPrismaClientInterface < Config [ 'NotificationIdType' ] , Config [ 'UserIdType' ] > ,
940+ tx : NotificationPrismaTransactionClientInterface <
941+ Config [ 'NotificationIdType' ] ,
942+ Config [ 'UserIdType' ]
943+ > ,
906944 checksum : string ,
907945 ) : Promise < AttachmentFileRecord | null > {
908946 const file = await tx . attachmentFile . findUnique ( {
@@ -1613,7 +1651,10 @@ export class PrismaNotificationBackend<
16131651 * @private
16141652 */
16151653 private async processAndStoreAttachmentsInTransaction (
1616- tx : NotificationPrismaClientInterface < Config [ 'NotificationIdType' ] , Config [ 'UserIdType' ] > ,
1654+ tx : NotificationPrismaTransactionClientInterface <
1655+ Config [ 'NotificationIdType' ] ,
1656+ Config [ 'UserIdType' ]
1657+ > ,
16171658 notificationId : Config [ 'NotificationIdType' ] ,
16181659 attachments : NotificationAttachment [ ] ,
16191660 ) : Promise < void > {
0 commit comments