diff --git a/CHANGELOG.md b/CHANGELOG.md index c356826..efa1265 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ +## [0.6.3](https://github.com/dennemark/prisma-extension-casl/compare/0.6.2...0.6.3) (2024-09-26) + + +### Bug Fixes + +* :bug: store permission on null not possible ([3a57167](https://github.com/dennemark/prisma-extension-casl/commit/3a5716789f72cbd2557a88582f5d2234c7e29c9d)) + ## [0.6.2](https://github.com/dennemark/prisma-extension-casl/compare/0.6.1...0.6.2) (2024-09-25) diff --git a/dist/index.js b/dist/index.js index 3729a25..cbf6e88 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1275,12 +1275,14 @@ function storePermissions(result, abilities, model, prop) { } const actions = ["create", "read", "update", "delete"]; const storeProp = (entry) => { - entry[prop] = []; - actions.forEach((action) => { - if (abilities.can(action, getSubject(model, entry))) { - entry[prop].push(action); - } - }); + if (entry) { + entry[prop] = []; + actions.forEach((action) => { + if (abilities.can(action, getSubject(model, entry))) { + entry[prop].push(action); + } + }); + } return entry; }; if (Array.isArray(result)) { diff --git a/dist/index.mjs b/dist/index.mjs index c8087a5..a234d9a 100644 --- a/dist/index.mjs +++ b/dist/index.mjs @@ -1250,12 +1250,14 @@ function storePermissions(result, abilities, model, prop) { } const actions = ["create", "read", "update", "delete"]; const storeProp = (entry) => { - entry[prop] = []; - actions.forEach((action) => { - if (abilities.can(action, getSubject(model, entry))) { - entry[prop].push(action); - } - }); + if (entry) { + entry[prop] = []; + actions.forEach((action) => { + if (abilities.can(action, getSubject(model, entry))) { + entry[prop].push(action); + } + }); + } return entry; }; if (Array.isArray(result)) { diff --git a/package.json b/package.json index 90555e7..ff026bd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "prisma-extension-casl", - "version": "0.6.2", + "version": "0.6.3", "description": "Enforce casl abilities on prisma client ", "main": "dist/index.js", "types": "dist/index.d.ts",