@mitm/common
Advanced tools
Comparing version 1.6.0 to 1.6.1
{ | ||
"name": "@mitm/common", | ||
"version": "1.6.0", | ||
"version": "1.6.1", | ||
"peerDependencies": { | ||
@@ -5,0 +5,0 @@ "rxjs": "^7.4.0" |
@@ -0,3 +1,6 @@ | ||
declare type Writable<T> = { | ||
-readonly [K in keyof T]: T[K]; | ||
}; | ||
export interface RolesMap { | ||
[role: string]: string[]; | ||
readonly [role: string]: readonly string[]; | ||
} | ||
@@ -34,3 +37,3 @@ /** | ||
readonly flatHierarchy: Map<string, Set<string>>; | ||
readonly flatHierarchyObject: RolesMap; | ||
readonly flatHierarchyObject: Writable<RolesMap>; | ||
constructor(hierarchy: RolesMap); | ||
@@ -40,7 +43,7 @@ /** | ||
*/ | ||
reachableRolesFrom(roles: string[]): Set<string>; | ||
reachableRolesFrom(roles: readonly string[]): Set<string>; | ||
/** | ||
* Given an array of roles, check if a userRole is reachable from them (directly inherited or not). | ||
*/ | ||
canReachRoleFrom(targetRole: string, availableRoles: string[]): boolean; | ||
canReachRoleFrom(targetRole: string, availableRoles: readonly string[]): boolean; | ||
/** | ||
@@ -53,3 +56,3 @@ * Determines whether an array of roles is a superset of another array of roles or not. | ||
*/ | ||
isSuperset(superset: string[], subset: string[]): boolean; | ||
isSuperset(superset: readonly string[], subset: readonly string[]): boolean; | ||
/** | ||
@@ -61,1 +64,2 @@ * Finds all the reachable roles from a userRole, recursively exploring the inherited roles. | ||
} | ||
export {}; |
50113
1242