Migrate agent v2 (#16214)
# Introduction Closes https://github.com/twentyhq/core-team-issues/issues/1980 In this PR we migrate the agent from v1 to v2. ## New FlatRoleTargetByAgentIdMaps Derivated the `flatRoleTargetMaps` to be building a `flatRoleTargetByAgentIdMaps` to ease retrieving a roleId to associate to an agent ## Coverage Added strong coverage on both failing and successful CRU agents operations --------- Co-authored-by: Weiko <corentin@twenty.com>
This commit is contained in:
+9
@@ -2,6 +2,7 @@ import { type AllMetadataName } from 'twenty-shared/metadata';
|
||||
|
||||
import { FLAT_CRON_TRIGGER_EDITABLE_PROPERTIES } from 'src/engine/metadata-modules/cron-trigger/constants/flat-cron-trigger-editable-properties.constant';
|
||||
import { FLAT_DATABASE_EVENT_TRIGGER_EDITABLE_PROPERTIES } from 'src/engine/metadata-modules/database-event-trigger/constants/flat-database-event-trigger-editable-properties.constant';
|
||||
import { FLAT_AGENT_EDITABLE_PROPERTIES } from 'src/engine/metadata-modules/flat-agent/constants/flat-agent-editable-properties.constant';
|
||||
import { type MetadataFlatEntity } from 'src/engine/metadata-modules/flat-entity/types/metadata-flat-entity.type';
|
||||
import { FLAT_FIELD_METADATA_EDITABLE_PROPERTIES } from 'src/engine/metadata-modules/flat-field-metadata/constants/flat-field-metadata-editable-properties.constant';
|
||||
import { FLAT_OBJECT_METADATA_EDITABLE_PROPERTIES } from 'src/engine/metadata-modules/flat-object-metadata/constants/flat-object-metadata-editable-properties.constant';
|
||||
@@ -97,6 +98,14 @@ export const ALL_FLAT_ENTITY_PROPERTIES_TO_COMPARE_AND_STRINGIFY = {
|
||||
propertiesToCompare: [...FLAT_ROLE_TARGET_EDITABLE_PROPERTIES],
|
||||
propertiesToStringify: [],
|
||||
},
|
||||
agent: {
|
||||
propertiesToCompare: [...FLAT_AGENT_EDITABLE_PROPERTIES],
|
||||
propertiesToStringify: [
|
||||
'responseFormat',
|
||||
'modelConfiguration',
|
||||
'evaluationInputs',
|
||||
],
|
||||
},
|
||||
} as const satisfies {
|
||||
[P in AllMetadataName]: OneFlatEntityConfiguration<P>;
|
||||
};
|
||||
|
||||
+1
@@ -112,4 +112,5 @@ export const ALL_METADATA_RELATED_METADATA_BY_FOREIGN_KEY = {
|
||||
flatEntityForeignKeyAggregator: 'roleTargetIds',
|
||||
},
|
||||
},
|
||||
agent: {},
|
||||
} as const satisfies MetadataNameAndRelations;
|
||||
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
export const ALL_METADATA_NAME = {
|
||||
fieldMetadata: 'fieldMetadata',
|
||||
objectMetadata: 'objectMetadata',
|
||||
view: 'view',
|
||||
viewField: 'viewField',
|
||||
viewGroup: 'viewGroup',
|
||||
index: 'index',
|
||||
serverlessFunction: 'serverlessFunction',
|
||||
cronTrigger: 'cronTrigger',
|
||||
databaseEventTrigger: 'databaseEventTrigger',
|
||||
routeTrigger: 'routeTrigger',
|
||||
viewFilter: 'viewFilter',
|
||||
role: 'role',
|
||||
roleTarget: 'roleTarget',
|
||||
} as const;
|
||||
+1
@@ -53,4 +53,5 @@ export const ALL_METADATA_REQUIRED_METADATA_FOR_VALIDATION = {
|
||||
roleTarget: {
|
||||
role: true,
|
||||
},
|
||||
agent: {},
|
||||
} as const satisfies MetadataRequiredForValidation;
|
||||
|
||||
Reference in New Issue
Block a user