@backstage/plugin-permission-common 0.7.0-next.2 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +37 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# @backstage/plugin-permission-common
|
|
2
2
|
|
|
3
|
+
## 0.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 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.
|
|
8
|
+
|
|
9
|
+
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...
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
createPermissionRule({
|
|
13
|
+
apply: (resource, foo, bar) => true,
|
|
14
|
+
toQuery: (foo, bar) => {},
|
|
15
|
+
});
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The API has now changed to expect the parameters as a single object
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
createPermissionRule({
|
|
22
|
+
paramSchema: z.object({
|
|
23
|
+
foo: z.string().describe('Foo value to match'),
|
|
24
|
+
bar: z.string().describe('Bar value to match'),
|
|
25
|
+
}),
|
|
26
|
+
apply: (resource, { foo, bar }) => true,
|
|
27
|
+
toQuery: ({ foo, bar }) => {},
|
|
28
|
+
});
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
One final change made is to limit the possible values for a parameter to primitives and arrays of primitives.
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- Updated dependencies
|
|
36
|
+
- @backstage/config@1.0.3
|
|
37
|
+
- @backstage/errors@1.1.2
|
|
38
|
+
- @backstage/types@1.0.0
|
|
39
|
+
|
|
3
40
|
## 0.7.0-next.2
|
|
4
41
|
|
|
5
42
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-permission-common",
|
|
3
3
|
"description": "Isomorphic types and client for Backstage permissions and authorization",
|
|
4
|
-
"version": "0.7.0
|
|
4
|
+
"version": "0.7.0",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"publishConfig": {
|
|
@@ -41,15 +41,15 @@
|
|
|
41
41
|
"url": "https://github.com/backstage/backstage/issues"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@backstage/config": "^1.0.3
|
|
45
|
-
"@backstage/errors": "^1.1.2
|
|
44
|
+
"@backstage/config": "^1.0.3",
|
|
45
|
+
"@backstage/errors": "^1.1.2",
|
|
46
46
|
"@backstage/types": "^1.0.0",
|
|
47
47
|
"cross-fetch": "^3.1.5",
|
|
48
48
|
"uuid": "^8.0.0",
|
|
49
49
|
"zod": "^3.11.6"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@backstage/cli": "^0.20.0
|
|
52
|
+
"@backstage/cli": "^0.20.0",
|
|
53
53
|
"msw": "^0.47.0"
|
|
54
54
|
},
|
|
55
55
|
"module": "dist/index.esm.js"
|