@backstage/plugin-permission-common
Advanced tools
Comparing version 0.0.0-nightly-20220211021943 to 0.0.0-nightly-20220212022325
# @backstage/plugin-permission-common | ||
## 0.0.0-nightly-20220211021943 | ||
## 0.0.0-nightly-20220212022325 | ||
### Minor Changes | ||
- 8c646beb24: **BREAKING** `PermissionCriteria` now requires at least one condition in `anyOf` and `allOf` arrays. This addresses some ambiguous behavior outlined in #9280. | ||
### Patch Changes | ||
@@ -9,3 +13,3 @@ | ||
- Updated dependencies | ||
- @backstage/errors@0.0.0-nightly-20220211021943 | ||
- @backstage/errors@0.0.0-nightly-20220212022325 | ||
@@ -12,0 +16,0 @@ ## 0.4.0 |
@@ -56,3 +56,3 @@ 'use strict'; | ||
params: zod.z.array(zod.z.unknown()) | ||
}).or(zod.z.object({ anyOf: zod.z.array(permissionCriteriaSchema) })).or(zod.z.object({ allOf: zod.z.array(permissionCriteriaSchema) })).or(zod.z.object({ not: permissionCriteriaSchema }))); | ||
}).strict().or(zod.z.object({ anyOf: zod.z.array(permissionCriteriaSchema).nonempty() }).strict()).or(zod.z.object({ allOf: zod.z.array(permissionCriteriaSchema).nonempty() }).strict()).or(zod.z.object({ not: permissionCriteriaSchema }).strict())); | ||
const responseSchema = zod.z.object({ | ||
@@ -59,0 +59,0 @@ items: zod.z.array(zod.z.object({ |
@@ -96,13 +96,33 @@ import { Config } from '@backstage/config'; | ||
/** | ||
* Composes several {@link PermissionCondition}s as criteria with a nested AND/OR structure. | ||
* Utility type to represent an array with 1 or more elements. | ||
* @ignore | ||
*/ | ||
declare type NonEmptyArray<T> = [T, ...T[]]; | ||
/** | ||
* Represnts a logical AND for the provided criteria. | ||
* @public | ||
*/ | ||
declare type PermissionCriteria<TQuery> = { | ||
allOf: PermissionCriteria<TQuery>[]; | ||
} | { | ||
anyOf: PermissionCriteria<TQuery>[]; | ||
} | { | ||
declare type AllOfCriteria<TQuery> = { | ||
allOf: NonEmptyArray<PermissionCriteria<TQuery>>; | ||
}; | ||
/** | ||
* Represnts a logical OR for the provided criteria. | ||
* @public | ||
*/ | ||
declare type AnyOfCriteria<TQuery> = { | ||
anyOf: NonEmptyArray<PermissionCriteria<TQuery>>; | ||
}; | ||
/** | ||
* Represents a negation of the provided criteria. | ||
* @public | ||
*/ | ||
declare type NotCriteria<TQuery> = { | ||
not: PermissionCriteria<TQuery>; | ||
} | TQuery; | ||
}; | ||
/** | ||
* Composes several {@link PermissionCondition}s as criteria with a nested AND/OR structure. | ||
* @public | ||
*/ | ||
declare type PermissionCriteria<TQuery> = AllOfCriteria<TQuery> | AnyOfCriteria<TQuery> | NotCriteria<TQuery> | TQuery; | ||
/** | ||
* An individual authorization response from {@link PermissionClient#authorize}. | ||
@@ -187,2 +207,2 @@ * @public | ||
export { AuthorizeDecision, AuthorizeQuery, AuthorizeRequest, AuthorizeRequestOptions, AuthorizeResponse, AuthorizeResult, DiscoveryApi, Identified, Permission, PermissionAttributes, PermissionAuthorizer, PermissionClient, PermissionCondition, PermissionCriteria, isCreatePermission, isDeletePermission, isReadPermission, isUpdatePermission }; | ||
export { AllOfCriteria, AnyOfCriteria, AuthorizeDecision, AuthorizeQuery, AuthorizeRequest, AuthorizeRequestOptions, AuthorizeResponse, AuthorizeResult, DiscoveryApi, Identified, NotCriteria, Permission, PermissionAttributes, PermissionAuthorizer, PermissionClient, PermissionCondition, PermissionCriteria, isCreatePermission, isDeletePermission, isReadPermission, isUpdatePermission }; |
@@ -29,3 +29,3 @@ import { ResponseError } from '@backstage/errors'; | ||
params: z.array(z.unknown()) | ||
}).or(z.object({ anyOf: z.array(permissionCriteriaSchema) })).or(z.object({ allOf: z.array(permissionCriteriaSchema) })).or(z.object({ not: permissionCriteriaSchema }))); | ||
}).strict().or(z.object({ anyOf: z.array(permissionCriteriaSchema).nonempty() }).strict()).or(z.object({ allOf: z.array(permissionCriteriaSchema).nonempty() }).strict()).or(z.object({ not: permissionCriteriaSchema }).strict())); | ||
const responseSchema = z.object({ | ||
@@ -32,0 +32,0 @@ items: z.array(z.object({ |
{ | ||
"name": "@backstage/plugin-permission-common", | ||
"description": "Isomorphic types and client for Backstage permissions and authorization", | ||
"version": "0.0.0-nightly-20220211021943", | ||
"version": "0.0.0-nightly-20220212022325", | ||
"main": "dist/index.cjs.js", | ||
@@ -42,3 +42,3 @@ "types": "dist/index.d.ts", | ||
"@backstage/config": "^0.1.13", | ||
"@backstage/errors": "^0.0.0-nightly-20220211021943", | ||
"@backstage/errors": "^0.0.0-nightly-20220212022325", | ||
"cross-fetch": "^3.1.5", | ||
@@ -49,3 +49,3 @@ "uuid": "^8.0.0", | ||
"devDependencies": { | ||
"@backstage/cli": "^0.0.0-nightly-20220211021943", | ||
"@backstage/cli": "^0.0.0-nightly-20220212022325", | ||
"@types/jest": "^26.0.7", | ||
@@ -52,0 +52,0 @@ "msw": "^0.35.0" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44479
426