Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
01b10f0
commit e1cb56a
Showing
38 changed files
with
813 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { PrismaClient } from '@prisma/client' |
40 changes: 40 additions & 0 deletions
40
src/packages/client/src/__tests__/types/accounts/index.test-d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { PrismaClient } from '.' | ||
import { expectError } from 'tsd' | ||
|
||
// tslint:disable | ||
|
||
const prisma = new PrismaClient({ | ||
datasources: { | ||
db: { | ||
url: 'file:dev.db', | ||
}, | ||
}, | ||
}) | ||
|
||
;(async () => { | ||
expectError( | ||
await prisma.userTest.findUnique({ | ||
where: { | ||
id: 'Example', | ||
}, | ||
select: { | ||
id: true, | ||
globalConfiguration: { | ||
select: { | ||
accounts: { | ||
select: { | ||
config: { | ||
select: { | ||
list: true, | ||
data: false, | ||
asd: true, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}), | ||
) | ||
})() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { PrismaClient } from '@prisma/client' |
90 changes: 90 additions & 0 deletions
90
src/packages/client/src/__tests__/types/aggregate/index.test-d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import { PrismaClient } from '.' | ||
import { expectError } from 'tsd' | ||
|
||
// tslint:disable | ||
|
||
const prisma = new PrismaClient({ | ||
datasources: { | ||
db: { | ||
url: 'file:dev.db', | ||
}, | ||
}, | ||
}) | ||
|
||
;(async () => { | ||
expectError( | ||
await prisma.user.aggregate({ | ||
cursor: { | ||
email: 'a@a.de', | ||
}, | ||
orderBy: { | ||
age: 'asc', | ||
}, | ||
skip: 12, | ||
take: 10, | ||
where: { | ||
age: { gt: 500, lt: '' }, | ||
}, | ||
count: true, | ||
avg: { | ||
age: true, | ||
followerCount: true, | ||
}, | ||
max: { | ||
age: true, | ||
followerCount: true, | ||
}, | ||
min: { | ||
age: true, | ||
followerCount: true, | ||
}, | ||
sum: { | ||
age: true, | ||
followerCount: true, | ||
}, | ||
}), | ||
) | ||
|
||
expectError( | ||
await prisma.user.aggregate({ | ||
cursor: { | ||
email: 'a@a.de', | ||
}, | ||
orderBy: { | ||
age: 'asc', | ||
}, | ||
skip: 12, | ||
take: 10, | ||
where: { | ||
AND: [ | ||
{ | ||
age: { gt: 500, lt: '' }, | ||
}, | ||
], | ||
OR: [ | ||
{ | ||
age: { gt: 500 }, | ||
}, | ||
], | ||
}, | ||
count: true, | ||
avg: { | ||
age: true, | ||
followerCount: true, | ||
}, | ||
max: { | ||
age: true, | ||
followerCount: true, | ||
}, | ||
min: { | ||
followerCount: true, | ||
}, | ||
sum: { | ||
age: true, | ||
followerCount: true, | ||
}, | ||
someField: {}, // TODO: fix types | ||
someRandomField: {}, // TODO: fix types | ||
}), | ||
) | ||
})() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { PrismaClient } from '@prisma/client' |
28 changes: 28 additions & 0 deletions
28
src/packages/client/src/__tests__/types/blog/index.test-d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { PrismaClient } from '.' | ||
import { expectError } from 'tsd' | ||
|
||
// tslint:disable | ||
|
||
const prisma = new PrismaClient({ | ||
datasources: { | ||
db: { | ||
url: 'file:dev.db', | ||
}, | ||
}, | ||
}) | ||
|
||
;(async () => { | ||
expectError(await prisma.$queryRaw(123)) | ||
expectError(await prisma.post.create({})) | ||
expectError( | ||
await prisma.post.update({ | ||
data: {}, | ||
}), | ||
) | ||
expectError(await prisma.post.updateMany({})) | ||
expectError( | ||
await prisma.post.count({ | ||
asd: true, | ||
}), | ||
) | ||
})() |
1 change: 1 addition & 0 deletions
1
src/packages/client/src/__tests__/types/connectOrCreate-disabled/index.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { PrismaClient } from '@prisma/client' |
32 changes: 32 additions & 0 deletions
32
src/packages/client/src/__tests__/types/connectOrCreate-disabled/index.test-d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { PrismaClient } from '.' | ||
import { expectError } from 'tsd' | ||
|
||
// tslint:disable | ||
|
||
const prisma = new PrismaClient({ | ||
datasources: { | ||
db: { | ||
url: 'file:dev.db', | ||
}, | ||
}, | ||
}) | ||
|
||
;(async () => { | ||
expectError( | ||
await prisma.user.update({ | ||
where: {}, | ||
data: { | ||
posts: { | ||
connectOrCreate: { | ||
where: { | ||
id: '123', | ||
}, | ||
create: { | ||
published: true, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}), | ||
) | ||
})() |
1 change: 1 addition & 0 deletions
1
src/packages/client/src/__tests__/types/connectOrCreate-enabled/index.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { PrismaClient } from '@prisma/client' |
32 changes: 32 additions & 0 deletions
32
src/packages/client/src/__tests__/types/connectOrCreate-enabled/index.test-d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { PrismaClient } from '.' | ||
import { expectError } from 'tsd' | ||
|
||
// tslint:disable | ||
|
||
const prisma = new PrismaClient({ | ||
datasources: { | ||
db: { | ||
url: 'file:dev.db', | ||
}, | ||
}, | ||
}) | ||
|
||
;(async () => { | ||
expectError( | ||
await prisma.user.update({ | ||
where: {}, | ||
data: { | ||
posts: { | ||
connectOrCreate: { | ||
where: { | ||
id: '123', | ||
}, | ||
create: { | ||
published: true, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}), | ||
) | ||
})() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { PrismaClient } from '@prisma/client' |
26 changes: 26 additions & 0 deletions
26
src/packages/client/src/__tests__/types/deleteMany/index.test-d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { PrismaClient } from '.' | ||
import { expectError } from 'tsd' | ||
|
||
// tslint:disable | ||
|
||
const prisma = new PrismaClient({ | ||
datasources: { | ||
db: { | ||
url: 'file:dev.db', | ||
}, | ||
}, | ||
}) | ||
|
||
;(async () => { | ||
expectError( | ||
await prisma.post.deleteMany({ | ||
where: { | ||
AND: { | ||
AND: { | ||
title: false, | ||
}, | ||
}, | ||
}, | ||
}), | ||
) | ||
})() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { PrismaClient, SortOrder, UserCreateArgs } from '@prisma/client' |
16 changes: 16 additions & 0 deletions
16
src/packages/client/src/__tests__/types/deprecation/index.test-d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { PrismaClient } from '.' | ||
import { expectDeprecated } from 'tsd' | ||
|
||
// tslint:disable | ||
|
||
const prisma = new PrismaClient({ | ||
datasources: { | ||
db: { | ||
url: 'file:dev.db', | ||
}, | ||
}, | ||
}) | ||
|
||
;(async () => { | ||
expectDeprecated(prisma.post.findOne) | ||
})() |
55 changes: 55 additions & 0 deletions
55
src/packages/client/src/__tests__/types/deprecation/schema.prisma
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
datasource db { | ||
provider = "postgres" | ||
url = env("SOME_DB") | ||
} | ||
|
||
generator client { | ||
provider = "prisma-client-js" | ||
output = "@prisma/client" | ||
} | ||
|
||
// / User model comment | ||
model User { | ||
id String @default(uuid()) @id | ||
email String @unique | ||
// / name comment | ||
name String? | ||
posts Post[] | ||
} | ||
|
||
model Post { | ||
id String @default(cuid()) @id | ||
createdAt DateTime @default(now()) | ||
updatedAt DateTime @updatedAt | ||
published Boolean | ||
title String | ||
content String? | ||
authorId String? | ||
author User? @relation(fields: [authorId], references: [id]) | ||
} | ||
|
||
enum Role { | ||
USER | ||
ADMIN | ||
} | ||
|
||
model MachineData { | ||
id String @default(cuid()) @id | ||
machineId String | ||
os String | ||
osVersion Float | ||
osArch String | ||
procFreq Float | ||
procCores Int | ||
ram Int | ||
} | ||
|
||
model Like { | ||
id String @default(cuid()) @id | ||
userId String | ||
user User @relation(fields: [userId], references: [id]) | ||
postId String | ||
post Post @relation(fields: [postId], references: [id]) | ||
@@unique([userId, postId]) | ||
} |
Oops, something went wrong.