[BREAKING_CHANGE] Deprecate remaining entities standardId (#17639)
# Introduction Following https://github.com/twentyhq/twenty/pull/17632 and https://github.com/twentyhq/twenty/pull/17572 This PR deprecates the agent, skill, field metadata and role `standardId` in favor of the `universalIdentifier` usage ## Note - Removed previous standard ids declaration modules - Twenty-sdk now re-exports the `STANDARD_OBJECTS` universalIdentifier hashmap constant - deleted some sync-metadata deadcode too ( mainly types )
This commit is contained in:
-32
@@ -1,32 +0,0 @@
|
||||
import { createHash } from 'crypto';
|
||||
|
||||
export function createDeterministicUuid(
|
||||
uuidOrUuids: string[] | string,
|
||||
): string {
|
||||
const inputForHash = Array.isArray(uuidOrUuids)
|
||||
? uuidOrUuids.join('-')
|
||||
: uuidOrUuids;
|
||||
const hash = createHash('sha256').update(inputForHash).digest('hex');
|
||||
|
||||
return `20202020-${hash.substring(0, 4)}-4${hash.substring(
|
||||
4,
|
||||
7,
|
||||
)}-8${hash.substring(7, 10)}-${hash.substring(10, 22)}`;
|
||||
}
|
||||
|
||||
type UuidPair = {
|
||||
objectId: string;
|
||||
standardId: string;
|
||||
};
|
||||
|
||||
export const createRelationDeterministicUuid = (uuidPair: UuidPair): string => {
|
||||
// Chaging the order in the array will result in different UUIDs
|
||||
return createDeterministicUuid([uuidPair.objectId, uuidPair.standardId]);
|
||||
};
|
||||
|
||||
export const createForeignKeyDeterministicUuid = (
|
||||
uuidPair: UuidPair,
|
||||
): string => {
|
||||
// Chaging the order in the array will result in different UUIDs
|
||||
return createDeterministicUuid([uuidPair.standardId, uuidPair.objectId]);
|
||||
};
|
||||
Reference in New Issue
Block a user