This refactor makes the createPermissionIntegration system much more
flexible by splitting it up into a few different helpers with different
responsibilities. This frees up plugin authors to connect together the
different parts of the permission integration in whatever way is
convenient for them, and makes the process of registering additional
permission rules a bit more explicit, by requiring them to be passed
in when constructing the systems for transforming or applying
conditions.
Signed-off-by: Mike Lewis <mtlewis@users.noreply.github.com>
Co-authored-by: Joon Park <joonp@spotify.com>
Co-authored-by: Tim Hansen <timbonicus@gmail.com>
PermissionCriteria<TQuery> is a union type which already includes
TQuery itself, so we don't need a second union here.
Signed-off-by: Mike Lewis <mtlewis@users.noreply.github.com>
`unknown` doesn't satisfy the (recently added) `extends unknown[]`
constraint. In these two cases, we can remove the parameter entirely and
rely instead on the default of `unknown[]`.
Signed-off-by: Mike Lewis <mtlewis@users.noreply.github.com>