import { Repository, Document } from '../interfaces'; import { Subject } from './Subject'; import { Resource } from './Resource'; /** * union of subclasses for inherited method signatures */ export declare type HierarchyNode = Subject | Resource; export declare type DocumentData = string | Document; export declare type PermOpts = { assertionFn?: () => boolean; }; /** * Abstract base class from which all gracl hierachy nodes inherit. */ export declare class Node { doc: Document; static displayName: string; static permissionPropertyKey: string; /** * String indicating the property on this nodes document that contains the id(s) of its parent. */ static parentId: string; /** * The id property within the document contained by this node type, defaults to 'id' */ static id: string; /** * The repository for this node type, provides async getter function. Must follow the Repository interface spec. */ static repository: Repository; /** * Retrieve all class names in the hierarchy of nodes stemming from this class */ static getHierarchyClassNames(): string[]; static getNodeDepth(): number; /** * Ensure that a given class inherits from Node */ static assertNodeClass(nodeClass: typeof Node): void; /** * Constructor, simply assigns the given document as a property */ constructor(doc: Document); /** * Get the name of this node */ getName(): string; /** * Pretty printing */ toString(): string; /** * Check if this node is a particular Node subclass */ isNodeType(nc: typeof Node): boolean; /** * Get the relative super class constructor of this instance */ getParentClass(): typeof Node; /** * Get the class of this instance */ getClass(): typeof Node; /** * Check if this class direcly inherits from HierarchyNode by checking if the class two levels up is Node */ hierarchyRoot(): boolean; /** * Get the id value on the document contained in this node */ getId(): string; /** * Get the repository for this class */ getRepository(): Repository; /** * Check if a node is allowed access to this node. Must be overridden by subclasses. */ isAllowed(node: HierarchyNode, permissionType: string, options: PermOpts): Promise; /** * Get the parent objects of an instance of this node. Must be overriden by subclass unless the static parentId is defined. */ getParents(): Promise; /** * Given an id of a parent of this node, create a Node instance of that object. @param data Either the id of the object, or the raw document itself. */ getParentNode(data: DocumentData): Promise; /** * Determine what subclass of node this node is. */ getNodeSubclass(): typeof Node; /** * Determine what subclass of node this node is. */ getNodeDepth(): number; /** * Retrieve all ids in the hierarchy of nodes steming from this instance */ getHierarchyIds(): Promise; /** * Instance version of static method */ getHierarchyClassNames(): string[]; }