stalniy/casl

Wrong peer dependencies in @casl/mongoose@8.x

jestupinanb opened this issue · 2 comments

Describe the bug
The @casl/mongoose version 8.x are not compatible with "@casl/ability": "^6.3.2" but it should be based on the peer dependencies, the file: @casl/mongoose/dist/es6m/index.mjs is importing:
import { rulesToQuery, AccessibleFields } from '@casl/ability/extra';
And it's not possible to import AccessibleFields in @casl/ability": "^6.3.2

node_modules/@casl/mongoose/dist/es6m/index.mjs
Attempted import error: 'AccessibleFields' is not exported from '@casl/ability/extra' (imported as 'AccessibleFields').

To Reproduce

  1. Create a project with @casl/mongoose@8.x
  2. And @casl/ability@6.3.2
  3. Create a project that uses accessibleBy, try to run it

Expected behavior
It should work without any issue because it is meeting the peer dependencies, but It's going to throw an error because @casl/mongoose is going to be trying to import AccessibleFields from @casl/ability, but that is not possible

CASL Version

@casl/ability@6.3.2
@casl/mongoose@8.x

Environment:
Nodejs 20
es6m

Nice catch!

closed in #925