1895 extensibility v1 application tokens (#16365)
First PR to implement application tokens - add new application role in twenty-server - move duplicated constants and types to twenty-shared - will add role configuration utils into twenty-sdk in another PR
This commit is contained in:
+17
@@ -0,0 +1,17 @@
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
import { type FlatEntityMaps } from 'src/engine/metadata-modules/flat-entity/types/flat-entity-maps.type';
|
||||
import { type FlatEntity } from 'src/engine/metadata-modules/flat-entity/types/flat-entity.type';
|
||||
|
||||
export const getFlatEntityByUniversalIdentifier = <T extends FlatEntity>(
|
||||
maps: FlatEntityMaps<T>,
|
||||
universalIdentifier: string,
|
||||
): T | undefined => {
|
||||
const flatEntityId = maps.idByUniversalIdentifier[universalIdentifier];
|
||||
|
||||
if (!isDefined(flatEntityId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
return maps.byId[flatEntityId];
|
||||
};
|
||||
Reference in New Issue
Block a user