import { Node } from './Node'; import { Subject } from './Subject'; import { Resource } from './Resource'; import { Repository } from '../interfaces'; export interface SchemaNode { name: string; repository: Repository; id?: string; parent?: string; parentId?: string; permissionProperty?: string; getParents?: typeof Node.prototype.getParents; getPermission?: typeof Resource.prototype.getPermission; } export declare type Schema = { resources: SchemaNode[]; subjects: SchemaNode[]; }; /** Class for building Resource/Subject class hierarchy based on schema */ export declare class Graph { schema: Schema; /** * Build map of nodeName -> ResourceClass for gracl hierarchy NOTE: unfortunately we need to duplicate this function for subjects due to limitations of the way type parameters are handled See: https://github.com/Microsoft/TypeScript/issues/4890 */ static buildResourceHierachy(schemaNodes: SchemaNode[]): Map; /** * Build map of nodeName -> SubjectClass for gracl hierarchy NOTE: this is a duplicate of buildResourceHierachy that is necessary for reasons explained above due to limitations in the type system. */ static buildSubjectHierachy(schemaNodes: SchemaNode[]): Map; static resolveNodeName(node: string | typeof Node): string; /** Properties to contain generated classes */ resources: Map; subjects: Map; subjectChildMap: Map>; resourceChildMap: Map>; constructor(schema: Schema); /** * Extract a node class from the graph if it exists */ getClass(node: string | typeof Node, type: 'subject' | 'resource'): typeof Resource | typeof Subject; /** * Extract a resource class from the graph if it exists */ getResource(node: string | typeof Node): typeof Resource; /** * Extract a subject class from the graph if it exists */ getSubject(node: string | typeof Node): typeof Subject; getChildResources(node: string | typeof Node): Array; getChildSubjects(node: string | typeof Node): Array; getParentResources(node: string | typeof Node): Array; getParentSubjects(node: string | typeof Node): Array; }