UNPKG

@dasch-swiss/dsp-js

Version:
40 lines 1.06 kB
import { map } from 'rxjs'; import { GenericCache } from './GenericCache'; /** * Caches user information obtained from Knora. */ export class UserCache extends GenericCache { constructor(knoraApiConnection) { super(); this.knoraApiConnection = knoraApiConnection; } /** * Gets a user identified by its Iri. * * @param iri the Iri identifying the user. */ getUser(iri) { return this.getItem(iri); } /** * Public method to access the reloadItem method * * @param key the id of the information to be returned. * @return the item */ reloadCachedItem(key) { return this.reloadItem(key); } requestItemFromKnora(key, isDependency) { return this.knoraApiConnection.admin.usersEndpoint.getUser('iri', key).pipe(map((response) => { return [response.body]; })); } getKeyOfItem(item) { return item.user.id; } getDependenciesOfItem(item) { return []; } } //# sourceMappingURL=UserCache.js.map