Skip to content

fix(roles): update types #2691

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

leeroyrose
Copy link

@leeroyrose leeroyrose commented Jul 14, 2025

Summary

Update role types to reflect documentation and better reflect return values from the api.

Description

Adds string to the ContentModel type so it can accept the value "all". When retrieving roles using the apis, the ContentModel is set to "all" but when creating them, you are forced to use an array - ["all"].

Adds an action type to allow better typing and support for the "access" action. Exports the type as it's quite useful. Renamed it to prevent clashes/make it clear what it's used for.

Also, there is some confusion about the not operator. In the documentation here, it says "You can specify nested constraints for and, or, not". When referencing the table of examples, it states that not can only accept one constraint as an argument. I have personally concluded that not can be used for both, would it be possible to confirm this and possibly update the documentation?

Motivation and Context

This change fixes a bug wth the ContentModel permission not accepting a string and adds access as an action type for writting environment based policies.

Checklist (check all before merging)

  • Both unit and integration tests are passing
  • There are no breaking changes
  • Changes are reflected in the documentation

When adding a new method:

  • The new method is exported through the default and plain CMA client
  • All new public types are exported from ./lib/export-types.ts
  • Added a unit test for the new method
  • Added an integration test for the new method
  • The new method is added to the documentation

@leeroyrose leeroyrose requested a review from a team as a code owner July 14, 2025 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant