Skip to content

Commit

Permalink
fix: update to prisma v5.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
LucianBuzzo committed Apr 10, 2024
1 parent ab3b28a commit 4aa0a92
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 89 deletions.
37 changes: 10 additions & 27 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

94 changes: 45 additions & 49 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,51 +1,47 @@
{
"name": "@cerebruminc/yates",
"version": "3.5.1",
"description": "Role based access control for Prisma Apps",
"main": "dist/index.js",
"files": [
"CHANGELOG.md",
"dist",
"images"
],
"scripts": {
"generate": "prisma generate",
"build": "rimraf dist && tsc -p tsconfig.build.json",
"test": "npm run lint",
"lint": "biome check .",
"lint:fix": "biome check . --apply",
"test:types": "tsc --noEmit",
"test:integration": "jest --runInBand test/integration",
"test:compose:integration": "docker compose -f docker-compose.yml --profile with-sut up db sut --exit-code-from sut",
"setup": "prisma generate && prisma migrate dev",
"prepublishOnly": "npm run build"
},
"author": "Cerebrum <hello@cerebrum.com> (https://cerebrum.com)",
"license": "MIT",
"devDependencies": {
"@biomejs/biome": "1.5.3",
"@prisma/client": "^5.0.0",
"@types/cls-hooked": "^4.3.3",
"@types/jest": "^29.2.6",
"@types/lodash": "^4.14.191",
"@types/uuid": "^9.0.0",
"cls-hooked": "^4.2.2",
"jest": "^29.3.1",
"prisma": "^5.0.0",
"rimraf": "^5.0.5",
"ts-jest": "^29.0.5",
"typescript": "^5.3.3",
"uuid": "^9.0.0"
},
"dependencies": {
"@types/debug": "^4.1.12",
"debug": "^4.3.4",
"lodash": "^4.17.21",
"node-sql-parser": "^4.12.0",
"type-fest": "^4.10.3"
},
"peerDependencies": {
"@prisma/client": "^5.0.0",
"prisma": "^5.0.0"
}
"name": "@cerebruminc/yates",
"version": "3.5.1",
"description": "Role based access control for Prisma Apps",
"main": "dist/index.js",
"files": ["CHANGELOG.md", "dist", "images"],
"scripts": {
"generate": "prisma generate",
"build": "rimraf dist && tsc -p tsconfig.build.json",
"test": "npm run lint",
"lint": "biome check .",
"lint:fix": "biome check . --apply",
"test:types": "tsc --noEmit",
"test:integration": "jest --runInBand test/integration",
"test:compose:integration": "docker compose -f docker-compose.yml --profile with-sut up db sut --exit-code-from sut",
"setup": "prisma generate && prisma migrate dev",
"prepublishOnly": "npm run build"
},
"author": "Cerebrum <hello@cerebrum.com> (https://cerebrum.com)",
"license": "MIT",
"devDependencies": {
"@biomejs/biome": "1.5.3",
"@prisma/client": "^5.11.0",
"@types/cls-hooked": "^4.3.3",
"@types/jest": "^29.2.6",
"@types/lodash": "^4.14.191",
"@types/uuid": "^9.0.0",
"cls-hooked": "^4.2.2",
"jest": "^29.3.1",
"prisma": "^5.0.0",
"rimraf": "^5.0.5",
"ts-jest": "^29.0.5",
"typescript": "^5.3.3",
"uuid": "^9.0.0"
},
"dependencies": {
"@types/debug": "^4.1.12",
"debug": "^4.3.4",
"lodash": "^4.17.21",
"node-sql-parser": "^4.12.0",
"type-fest": "^4.10.3"
},
"peerDependencies": {
"@prisma/client": "^5.11.0",
"prisma": "^5.11.0"
}
}
5 changes: 3 additions & 2 deletions test/integration/abilities.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe("abilities", () => {
operation: "SELECT",
expression: (_client, _row, _context) => {
return {
email: mail,
name: "John Doe",
};
},
},
Expand All @@ -48,7 +48,7 @@ describe("abilities", () => {
operation: "INSERT",
expression: (_client, _row, _context) => {
return {
email: mail,
name: "John Doe",
};
},
},
Expand All @@ -75,6 +75,7 @@ describe("abilities", () => {

const user = await client.user.create({
data: {
name: "John Doe",
email: mail,
},
});
Expand Down
1 change: 0 additions & 1 deletion test/integration/expressions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,6 @@ describe("expressions", () => {
expression: (client: PrismaClient, row) => {
return client.item.findFirst({
where: {
id: item.id,
value: row("id"),
},
});
Expand Down
12 changes: 7 additions & 5 deletions test/integration/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,13 @@ describe("setup", () => {
},
});

await client.post.delete({
where: {
id: postId2,
},
});
await expect(
client.post.delete({
where: {
id: postId2,
},
}),
).rejects.toThrow("Record to delete does not exist");

const exists2 = await adminClient.post.findUnique({
where: {
Expand Down
4 changes: 2 additions & 2 deletions test/integration/migrations.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ describe("migrations", () => {
prisma: initial,
customAbilities: {
Post: {
readWithTitle: {
readWithTitle_fa0xC: {
description: "Read posts with a special title",
operation: "SELECT",
expression: "title = 'Special title'",
Expand All @@ -125,7 +125,7 @@ describe("migrations", () => {
},
getRoles(abilities) {
return {
[role]: [abilities.Post.readWithTitle],
[role]: [abilities.Post.readWithTitle_fa0xC],
};
},
getContext: () => ({
Expand Down
8 changes: 5 additions & 3 deletions test/integration/rbac.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -464,9 +464,11 @@ describe("rbac", () => {
},
});

await client.post.delete({
where: { id: postId },
});
await expect(
client.post.delete({
where: { id: postId },
}),
).rejects.toThrow();

const post = await adminClient.post.findUnique({
where: { id: postId },
Expand Down

0 comments on commit 4aa0a92

Please sign in to comment.