MCPcopy Create free account
hub / github.com/alephdata/aleph / selectEntity

Function selectEntity

ui/src/selectors.js:219–252  ·  view source on GitHub ↗
(state, entityId)

Source from the content-addressed store, hash-verified

217}
218
219export function selectEntity(state, entityId) {
220 const entity = selectObject(state, state.entities, entityId);
221 const lastViewed = getRecentlyViewedItem(entityId);
222
223 if (!entity.selectorCache) {
224 const model = selectModel(state);
225 if (!entity.schema || !model) {
226 return entity;
227 }
228 entity.selectorCache = model.getEntity(entity);
229 }
230
231 const result = entity.selectorCache;
232 result.safeHtml = entity.safeHtml;
233 result.collection = entity.collection;
234 result.role = entity.role;
235 result.createdAt = entity.created_at;
236 result.updatedAt = entity.updated_at;
237 result.highlight = entity.highlight;
238 result.latinized = entity.latinized;
239 result.isPending = !!entity.isPending;
240 result.isError = !!entity.isError;
241 result.shouldLoad = !!entity.shouldLoad;
242 result.shouldLoadDeep = !!entity.shouldLoadDeep;
243 result.shallow = !!entity.shallow;
244 result.error = entity.error;
245 result.links = entity.links;
246 result.profileId = entity.profile_id;
247 result.lastViewed = lastViewed;
248 result.writeable = entity.writeable;
249 result.bookmarked = entity.bookmarked;
250
251 return result;
252}
253
254export function selectEntityDirectionality(state, entity) {
255 const isRtl = isEntityRtl(entity, selectLocale(state), selectModel(state));

Callers 11

mapStateToPropsFunction · 0.90
mapStateToPropsFunction · 0.90
mapStateToPropsFunction · 0.90
mapStateToPropsFunction · 0.90
mapStateToPropsFunction · 0.90
mapStateToPropsFunction · 0.90
selectEntitySetItemFunction · 0.85
selectEntityReferencesFunction · 0.85
selectEntityViewFunction · 0.85
selectSimilarResultFunction · 0.85

Calls 4

getRecentlyViewedItemFunction · 0.90
selectObjectFunction · 0.85
selectModelFunction · 0.85
getEntityMethod · 0.45

Tested by

no test coverage detected