Skip to content

Commit

Permalink
Release 0.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
dennemark committed Aug 8, 2024
1 parent 055f7ed commit e795fbe
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@


## [0.4.2](https://github.com/dennemark/prisma-extension-casl/compare/0.4.1...0.4.2) (2024-08-08)


### Bug Fixes

* :bug: apply rule relations even if no include or select exist ([055f7ed](https://github.com/dennemark/prisma-extension-casl/commit/055f7ed738f9dafa77dddef6b51bd1758ee9b0f8))

## [0.4.1](https://github.com/dennemark/prisma-extension-casl/compare/0.4.0...0.4.1) (2024-08-07)


Expand Down
9 changes: 8 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,14 @@ function applyRuleRelationsQuery(args, abilities, action, model) {
}));
const ast = d4(ability, action, model);
const queryRelations = getRuleRelationsQuery(model, ast);
return mergeArgsAndRelationQuery(args, queryRelations);
if (!("select" in args) && !("include" in args)) {
args.include = {};
}
const result = mergeArgsAndRelationQuery(args, queryRelations);
if ("include" in result.args && Object.keys(result.args.include).length === 0) {
delete result.args.include;
}
return result;
}

// src/applyCaslToQuery.ts
Expand Down
9 changes: 8 additions & 1 deletion dist/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,14 @@ function applyRuleRelationsQuery(args, abilities, action, model) {
}));
const ast = d4(ability, action, model);
const queryRelations = getRuleRelationsQuery(model, ast);
return mergeArgsAndRelationQuery(args, queryRelations);
if (!("select" in args) && !("include" in args)) {
args.include = {};
}
const result = mergeArgsAndRelationQuery(args, queryRelations);
if ("include" in result.args && Object.keys(result.args.include).length === 0) {
delete result.args.include;
}
return result;
}

// src/applyCaslToQuery.ts
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "prisma-extension-casl",
"version": "0.4.1",
"version": "0.4.2",
"description": "Enforce casl abilities on prisma client ",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down

0 comments on commit e795fbe

Please sign in to comment.