permission-common: add MetadataResponseSerializedRule from permission-node
Signed-off-by: MT Lewis <mtlewis@users.noreply.github.com>
This commit is contained in:
@@ -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.
|
||||
@@ -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>;
|
||||
|
||||
@@ -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>;
|
||||
};
|
||||
Reference in New Issue
Block a user