browser-acl
browser-acl copied to clipboard
Add support to async functions in Policies
I have a use case where (sometimes) I need to access the DB to get some info about what a user can do. That's not possible without async functions in policies. I had to rewrite some things to make it work.
I think adding native support to async functions in Policies would be a nice new feature.
Would you be interested in making a PR for this feature?
You would need to update the return type of this function and then the implementation of the few places that it is used.
https://github.com/mblarsen/browser-acl/blob/master/types/index.d.ts#L31
For some() and every() you can use Promise.all()
Hello again,
I'm interested in making a PR for this feature but I don't have much experience with TypeScript.
Also, in order to call await Promise.all(), we would need to make some() and every() async functions as well. It would break existing applications.
beforeAll() in particular, depends on the return value of the promise to return or call another function.
We can make all functions asynchronous in a new version or make brand new async functions to handle it.
Any sugestions?
Hi @Yudikubota the linked PR implements async for all functions. However, I have to think about support for vue-browser-acl.
Do you mind doing a review of the PR. Just scan through the async parts: beforeAll, some, every.
(all tests updated and passing)