@dasch-swiss/dsp-js
Version:
JavaScript library that handles API requests to Knora
59 lines • 2.19 kB
JavaScript
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
import { map } from "rxjs";
import { GenericCache } from "./GenericCache";
/**
* Caches user information obtained from Knora.
*/
var ListAdminCache = /** @class */ (function (_super) {
__extends(ListAdminCache, _super);
function ListAdminCache(adminEndpoint) {
var _this = _super.call(this) || this;
_this.adminEndpoint = adminEndpoint;
return _this;
}
/**
* Requests a whole list from the admin API.
*
* @param listIri IRI of the list.
*/
ListAdminCache.prototype.getList = function (listIri) {
return this.getItem(listIri);
};
/**
* Public method to access the reloadItem method
*
* @param key the id of the information to be returned.
* @return the item
*/
ListAdminCache.prototype.reloadCachedItem = function (key) {
return this.reloadItem(key);
};
ListAdminCache.prototype.requestItemFromKnora = function (key, isDependency) {
return this.adminEndpoint.listsEndpoint.getList(key).pipe(map(function (response) {
return [response.body];
}));
};
ListAdminCache.prototype.getKeyOfItem = function (item) {
return item.list.listinfo.id;
};
ListAdminCache.prototype.getDependenciesOfItem = function (item) {
return [];
};
return ListAdminCache;
}(GenericCache));
export { ListAdminCache };
//# sourceMappingURL=ListAdminCache.js.map