Version Packages (next)
This commit is contained in:
@@ -1,5 +1,42 @@
|
||||
# @backstage/plugin-permission-common
|
||||
|
||||
## 0.7.0-next.2
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 46b4a72cee: **BREAKING**: When defining permission rules, it's now necessary to provide a [ZodSchema](https://github.com/colinhacks/zod) that specifies the parameters the rule expects. This has been added to help better describe the parameters in the response of the metadata endpoint and to validate the parameters before a rule is executed.
|
||||
|
||||
To help with this, we have also made a change to the API of permission rules. Before, the permission rules `toQuery` and `apply` signature expected parameters to be separate arguments, like so...
|
||||
|
||||
```ts
|
||||
createPermissionRule({
|
||||
apply: (resource, foo, bar) => true,
|
||||
toQuery: (foo, bar) => {},
|
||||
});
|
||||
```
|
||||
|
||||
The API has now changed to expect the parameters as a single object
|
||||
|
||||
```ts
|
||||
createPermissionRule({
|
||||
paramSchema: z.object({
|
||||
foo: z.string().describe('Foo value to match'),
|
||||
bar: z.string().describe('Bar value to match'),
|
||||
}),
|
||||
apply: (resource, { foo, bar }) => true,
|
||||
toQuery: ({ foo, bar }) => {},
|
||||
});
|
||||
```
|
||||
|
||||
One final change made is to limit the possible values for a parameter to primitives and arrays of primitives.
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @backstage/config@1.0.3-next.2
|
||||
- @backstage/errors@1.1.2-next.2
|
||||
- @backstage/types@1.0.0
|
||||
|
||||
## 0.6.5-next.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@backstage/plugin-permission-common",
|
||||
"description": "Isomorphic types and client for Backstage permissions and authorization",
|
||||
"version": "0.6.5-next.1",
|
||||
"version": "0.7.0-next.2",
|
||||
"main": "src/index.ts",
|
||||
"types": "src/index.ts",
|
||||
"publishConfig": {
|
||||
|
||||
Reference in New Issue
Block a user