Rename uniqueIdentifier to universalIdentifier (#14201)

This commit is contained in:
Weiko
2025-09-01 12:33:59 +02:00
committed by GitHub
parent 58a38769bd
commit 80347b7b38
76 changed files with 556 additions and 552 deletions
@@ -28,7 +28,7 @@ export class WorkspaceAgentComparator {
}: WorkspaceAgentComparatorArgs): AgentComparatorResult[] {
const results: AgentComparatorResult[] = [];
const keyFactory = (agent: FlatAgent) => agent.uniqueIdentifier;
const keyFactory = (agent: FlatAgent) => agent.universalIdentifier;
const fromAgentMap = transformMetadataForComparison(fromFlatAgents, {
shouldIgnoreProperty: (property) =>
@@ -45,12 +45,12 @@ export class WorkspaceAgentComparator {
const agentDifferences = diff(fromAgentMap, toAgentMap);
for (const difference of agentDifferences) {
const uniqueIdentifier = difference.path[0] as string;
const universalIdentifier = difference.path[0] as string;
switch (difference.type) {
case 'CREATE': {
const toAgent = toFlatAgents.find(
(agent) => keyFactory(agent) === uniqueIdentifier,
(agent) => keyFactory(agent) === universalIdentifier,
);
if (toAgent) {
@@ -63,10 +63,10 @@ export class WorkspaceAgentComparator {
}
case 'CHANGE': {
const fromAgent = fromFlatAgents.find(
(agent) => keyFactory(agent) === uniqueIdentifier,
(agent) => keyFactory(agent) === universalIdentifier,
);
const toAgent = toFlatAgents.find(
(agent) => keyFactory(agent) === uniqueIdentifier,
(agent) => keyFactory(agent) === universalIdentifier,
);
if (fromAgent && toAgent) {
@@ -82,7 +82,7 @@ export class WorkspaceAgentComparator {
}
case 'REMOVE': {
const fromAgent = fromFlatAgents.find(
(agent) => keyFactory(agent) === uniqueIdentifier,
(agent) => keyFactory(agent) === universalIdentifier,
);
if (fromAgent && difference.path.length === 1) {
@@ -65,12 +65,12 @@ export class WorkspaceRoleComparator {
const roleDifferences = diff(fromRoleMap, toRoleMap);
for (const difference of roleDifferences) {
const uniqueIdentifier = difference.path[0] as string;
const universalIdentifier = difference.path[0] as string;
switch (difference.type) {
case 'CREATE': {
const toRole = toFlatRoles.find(
(role) => keyFactory(role) === uniqueIdentifier,
(role) => keyFactory(role) === universalIdentifier,
);
if (toRole) {
@@ -84,10 +84,10 @@ export class WorkspaceRoleComparator {
}
case 'CHANGE': {
const fromRole = fromFlatRoles.find(
(role) => keyFactory(role) === uniqueIdentifier,
(role) => keyFactory(role) === universalIdentifier,
);
const toRole = toFlatRoles.find(
(role) => keyFactory(role) === uniqueIdentifier,
(role) => keyFactory(role) === universalIdentifier,
);
if (fromRole && toRole) {
@@ -101,7 +101,7 @@ export class WorkspaceRoleComparator {
}
case 'REMOVE': {
const fromRole = fromFlatRoles.find(
(role) => keyFactory(role) === uniqueIdentifier,
(role) => keyFactory(role) === universalIdentifier,
);
if (fromRole && difference.path.length === 1) {
@@ -30,12 +30,12 @@ export class StandardAgentFactory {
computedAgents.push({
...flatAgent,
id: existingAgent.id,
uniqueIdentifier: agentDefinition.standardId,
universalIdentifier: agentDefinition.standardId,
});
} else {
computedAgents.push({
...flatAgent,
uniqueIdentifier: agentDefinition.standardId,
universalIdentifier: agentDefinition.standardId,
});
}
}
@@ -30,12 +30,12 @@ export class StandardRoleFactory {
computedRoles.push({
...flatRole,
id: existingRole.id,
uniqueIdentifier: roleDefinition.standardId || existingRole.id,
universalIdentifier: roleDefinition.standardId || existingRole.id,
});
} else {
computedRoles.push({
...flatRole,
uniqueIdentifier: roleDefinition.standardId,
universalIdentifier: roleDefinition.standardId,
});
}
}
@@ -66,7 +66,7 @@ export class WorkspaceSyncAgentService {
const agentToCreate = agentComparatorResult.object;
const flatAgentData = removePropertiesFromRecord(agentToCreate, [
'uniqueIdentifier',
'universalIdentifier',
'id',
]);
@@ -97,7 +97,7 @@ export class WorkspaceSyncAgentService {
const flatAgentData = removePropertiesFromRecord(agentToUpdate, [
'id',
'uniqueIdentifier',
'universalIdentifier',
'workspaceId',
]);
@@ -53,7 +53,7 @@ export class WorkspaceSyncRoleService {
const roleToCreate = roleComparatorResult.toFlatRole;
const flatRoleData = removePropertiesFromRecord(roleToCreate, [
'uniqueIdentifier',
'universalIdentifier',
'id',
]);
@@ -69,7 +69,7 @@ export class WorkspaceSyncRoleService {
const flatRoleData = removePropertiesFromRecord(roleToUpdate, [
'id',
'uniqueIdentifier',
'universalIdentifier',
'workspaceId',
]);
@@ -2,7 +2,7 @@ import { type FlatAgent } from 'src/engine/metadata-modules/flat-agent/types/fla
export type StandardAgentDefinition = Omit<
FlatAgent,
'id' | 'workspaceId' | 'uniqueIdentifier' | 'standardId'
'id' | 'workspaceId' | 'universalIdentifier' | 'standardId'
> & {
standardId: string;
};
@@ -2,7 +2,7 @@ import { type FlatRole } from 'src/engine/metadata-modules/flat-role/types/flat-
export type StandardRoleDefinition = Omit<
FlatRole,
'id' | 'workspaceId' | 'uniqueIdentifier' | 'standardId'
'id' | 'workspaceId' | 'universalIdentifier' | 'standardId'
> & {
standardId: string;
};