permission-common: add MetadataResponseSerializedRule from permission-node

Signed-off-by: MT Lewis <mtlewis@users.noreply.github.com>
This commit is contained in:
MT Lewis
2024-07-28 14:00:10 +01:00
parent 2bae52597d
commit 137fa342b4
6 changed files with 48 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-permission-common': patch
---
Add the MetadataResponseSerializedRule type from @backstage/plugin-permission-node, since this type might be used in frontend code.
+9
View File
@@ -5,6 +5,7 @@
```ts
import { Config } from '@backstage/config';
import { JsonPrimitive } from '@backstage/types';
import zodToJsonSchema from 'zod-to-json-schema';
// @public
export type AllOfCriteria<TQuery> = {
@@ -125,6 +126,14 @@ export function isResourcePermission<T extends string = string>(
// @public
export function isUpdatePermission(permission: Permission): boolean;
// @public
export type MetadataResponseSerializedRule = {
name: string;
description: string;
resourceType: string;
paramsSchema?: ReturnType<typeof zodToJsonSchema>;
};
// @public
export type NotCriteria<TQuery> = {
not: PermissionCriteria<TQuery>;
+2 -1
View File
@@ -53,7 +53,8 @@
"@backstage/types": "workspace:^",
"cross-fetch": "^4.0.0",
"uuid": "^9.0.0",
"zod": "^3.22.4"
"zod": "^3.22.4",
"zod-to-json-schema": "^3.20.4"
},
"devDependencies": {
"@backstage/cli": "workspace:^",
@@ -40,6 +40,7 @@ export type {
NotCriteria,
} from './api';
export type { DiscoveryApi } from './discovery';
export type { MetadataResponseSerializedRule } from './integration';
export type {
BasicPermission,
PermissionAttributes,
@@ -0,0 +1,30 @@
/*
* Copyright 2024 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import zodToJsonSchema from 'zod-to-json-schema';
/**
* Serialized permission rules, with the paramsSchema
* converted from a ZodSchema to a JsonSchema.
*
* @public
*/
export type MetadataResponseSerializedRule = {
name: string;
description: string;
resourceType: string;
paramsSchema?: ReturnType<typeof zodToJsonSchema>;
};
+1
View File
@@ -6723,6 +6723,7 @@ __metadata:
msw: ^1.0.0
uuid: ^9.0.0
zod: ^3.22.4
zod-to-json-schema: ^3.20.4
languageName: unknown
linkType: soft