UNPKG

@openfga/frontend-utils

Version:

Exposes helpful utilities for building authoring experiences of OpenFGA Models.

27 lines (26 loc) 1.09 kB
import type { OpenFgaApi, TupleKey } from "@openfga/sdk"; import { GraphDefinition, ResolutionTree } from "./graph.typings"; export declare class TreeBuilder { private readonly openFgaApi; private readonly capturedTuple; private readonly storeId; private readonly existingTree?; private readonly authorizationModelId?; private currentTree?; private readonly expandedTuples; constructor(openFgaApi: Pick<OpenFgaApi, "expand">, capturedTuple: Required<Omit<TupleKey, "user">>, storeId: string, existingTree?: ResolutionTree | undefined, authorizationModelId?: string | undefined); private addParent; private expandTuple; private walkDirectUser; private walkDirectUsers; private walkComputedUserSet; private walkTupleToUserset; private getNodeType; private walkNode; private walk; private deleteHangingNodes; get tree(): ResolutionTree | undefined; buildTree(): Promise<void>; fillActivePath(targetUser: string): ResolutionTree; buildGraph(targetUser?: string, onlyInActivePath?: boolean): GraphDefinition; }