UNPKG

@dasch-swiss/dsp-js

Version:

JavaScript library that handles API requests to Knora

32 lines (31 loc) 1.28 kB
import { Observable } from "rxjs"; import { V2Endpoint } from "../api/v2/v2-endpoint"; import { ListNodeV2 } from "../models/v2/lists/list-node-v2"; import { GenericCache } from "./GenericCache"; /** * Caches list nodes obtained from Knora. * As an optimization, the whole list is requested and cached (all of its nodes) once a list node has been rquested. */ export declare class ListNodeV2Cache extends GenericCache<ListNodeV2> { private v2Endpoint; constructor(v2Endpoint: V2Endpoint); /** * Given a list node IRI, gets it from the cache. * * The root node of a list should not be requested using this method. * This should be left to dependency handling to optimize caching. * * @param nodeIri the IRI of the list node to be returned. */ getNode(nodeIri: string): Observable<ListNodeV2>; /** * Public method to access the reloadItem method * * @param key the id of the information to be returned. * @return the item */ reloadCachedItem(key: string): Observable<ListNodeV2>; protected getKeyOfItem(item: ListNodeV2): string; protected requestItemFromKnora(key: string, isDependency: boolean): Observable<ListNodeV2[]>; protected getDependenciesOfItem(item: ListNodeV2): string[]; }