diff --git a/packages/twenty-server/src/engine/api/graphql/graphql-query-runner/graphql-query-runner.service.ts b/packages/twenty-server/src/engine/api/graphql/graphql-query-runner/graphql-query-runner.service.ts index be58bb6b7122..b79137ab822e 100644 --- a/packages/twenty-server/src/engine/api/graphql/graphql-query-runner/graphql-query-runner.service.ts +++ b/packages/twenty-server/src/engine/api/graphql/graphql-query-runner/graphql-query-runner.service.ts @@ -343,7 +343,7 @@ export class GraphqlQueryRunnerService { results, objectMetadataItemWithFieldMaps, authContext.workspace.id, - options.objectMetadataMap, + options.objectMetadataMaps, ); const resultWithGettersArray = Array.isArray(resultWithGetters) diff --git a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/interfaces/query-result-field-value.ts b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/interfaces/query-result-field-value.ts index 8c900618ebdc..5a15e7369c2e 100644 --- a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/interfaces/query-result-field-value.ts +++ b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/interfaces/query-result-field-value.ts @@ -1,4 +1,4 @@ -import { Record as ObjectRecord } from 'src/engine/api/graphql/workspace-query-builder/interfaces/record.interface'; +import { ObjectRecord } from 'src/engine/api/graphql/workspace-query-builder/interfaces/object-record.interface'; import { IConnection } from 'src/engine/api/graphql/workspace-query-runner/interfaces/connection.interface'; export type QueryResultFieldValue = diff --git a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/interfaces/query-result-getter-handler.interface.ts b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/interfaces/query-result-getter-handler.interface.ts index 2326ab069303..4e1edc25d675 100644 --- a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/interfaces/query-result-getter-handler.interface.ts +++ b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/interfaces/query-result-getter-handler.interface.ts @@ -1,4 +1,4 @@ -import { Record as ObjectRecord } from 'src/engine/api/graphql/workspace-query-builder/interfaces/record.interface'; +import { ObjectRecord } from 'src/engine/api/graphql/workspace-query-builder/interfaces/object-record.interface'; export interface QueryResultGetterHandlerInterface { handle( diff --git a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/query-result-getters.factory.ts b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/query-result-getters.factory.ts index 0ed6b8f7f23a..6b855d858198 100644 --- a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/query-result-getters.factory.ts +++ b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/query-result-getters.factory.ts @@ -1,6 +1,6 @@ import { Injectable, Logger } from '@nestjs/common'; -import { Record as ObjectRecord } from 'src/engine/api/graphql/workspace-query-builder/interfaces/record.interface'; +import { ObjectRecord } from 'src/engine/api/graphql/workspace-query-builder/interfaces/object-record.interface'; import { QueryResultFieldValue } from 'src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/interfaces/query-result-field-value'; import { QueryResultGetterHandlerInterface } from 'src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/interfaces/query-result-getter-handler.interface'; import { IConnection } from 'src/engine/api/graphql/workspace-query-runner/interfaces/connection.interface'; @@ -17,7 +17,7 @@ import { isQueryResultFieldValueARecordArray } from 'src/engine/api/graphql/work import { isQueryResultFieldValueARecord } from 'src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/utils/is-query-result-field-value-a-record.guard'; import { CompositeInputTypeDefinitionFactory } from 'src/engine/api/graphql/workspace-schema-builder/factories/composite-input-type-definition.factory'; import { FileService } from 'src/engine/core-modules/file/services/file.service'; -import { ObjectMetadataMap } from 'src/engine/metadata-modules/utils/generate-object-metadata-map.util'; +import { ObjectMetadataMaps } from 'src/engine/metadata-modules/types/object-metadata-maps'; import { isRelationFieldMetadataType } from 'src/engine/utils/is-relation-field-metadata-type.util'; import { isDefined } from 'src/utils/is-defined'; @@ -51,7 +51,7 @@ export class QueryResultGettersFactory { private async processConnection( connection: IConnection, objectMetadataItemId: string, - objectMetadataMap: ObjectMetadataMap, + objectMetadataMaps: ObjectMetadataMaps, workspaceId: string, ): Promise> { return { @@ -62,7 +62,7 @@ export class QueryResultGettersFactory { node: await this.processRecord( edge.node, objectMetadataItemId, - objectMetadataMap, + objectMetadataMaps, workspaceId, ), })), @@ -73,7 +73,7 @@ export class QueryResultGettersFactory { private async processNestedRecordArray( result: { records: ObjectRecord[] }, objectMetadataItemId: string, - objectMetadataMap: ObjectMetadataMap, + objectMetadataMaps: ObjectMetadataMaps, workspaceId: string, ) { return { @@ -84,7 +84,7 @@ export class QueryResultGettersFactory { await this.processRecord( record, objectMetadataItemId, - objectMetadataMap, + objectMetadataMaps, workspaceId, ), ), @@ -95,7 +95,7 @@ export class QueryResultGettersFactory { private async processRecordArray( recordArray: ObjectRecord[], objectMetadataItemId: string, - objectMetadataMap: ObjectMetadataMap, + objectMetadataMaps: ObjectMetadataMaps, workspaceId: string, ) { return await Promise.all( @@ -104,7 +104,7 @@ export class QueryResultGettersFactory { await this.processRecord( record, objectMetadataItemId, - objectMetadataMap, + objectMetadataMaps, workspaceId, ), ), @@ -114,10 +114,10 @@ export class QueryResultGettersFactory { private async processRecord( record: ObjectRecord, objectMetadataItemId: string, - objectMetadataMap: ObjectMetadataMap, + objectMetadataMaps: ObjectMetadataMaps, workspaceId: string, ): Promise { - const objectMetadataMapItem = objectMetadataMap[objectMetadataItemId]; + const objectMetadataMapItem = objectMetadataMaps.byId[objectMetadataItemId]; const handler = this.getHandler(objectMetadataMapItem.nameSingular); @@ -151,7 +151,7 @@ export class QueryResultGettersFactory { : relationMetadata.fromObjectMetadataId; const relationObjectMetadataItem = - objectMetadataMap[relationObjectMetadataItemId]; + objectMetadataMaps.byId[relationObjectMetadataItemId]; if (!isDefined(relationObjectMetadataItem)) { throw new Error( @@ -163,7 +163,7 @@ export class QueryResultGettersFactory { await this.processQueryResultField( record[relationField.name], relationObjectMetadataItem.id, - objectMetadataMap, + objectMetadataMaps, workspaceId, ); } @@ -184,35 +184,35 @@ export class QueryResultGettersFactory { private async processQueryResultField( queryResultField: QueryResultFieldValue, objectMetadataItemId: string, - objectMetadataMap: ObjectMetadataMap, + objectMetadataMaps: ObjectMetadataMaps, workspaceId: string, ) { if (isQueryResultFieldValueAConnection(queryResultField)) { return await this.processConnection( queryResultField, objectMetadataItemId, - objectMetadataMap, + objectMetadataMaps, workspaceId, ); } else if (isQueryResultFieldValueANestedRecordArray(queryResultField)) { return await this.processNestedRecordArray( queryResultField, objectMetadataItemId, - objectMetadataMap, + objectMetadataMaps, workspaceId, ); } else if (isQueryResultFieldValueARecordArray(queryResultField)) { return await this.processRecordArray( queryResultField, objectMetadataItemId, - objectMetadataMap, + objectMetadataMaps, workspaceId, ); } else if (isQueryResultFieldValueARecord(queryResultField)) { return await this.processRecord( queryResultField, objectMetadataItemId, - objectMetadataMap, + objectMetadataMaps, workspaceId, ); } else { @@ -229,12 +229,12 @@ export class QueryResultGettersFactory { result: QueryResultFieldValue, objectMetadataItem: ObjectMetadataInterface, workspaceId: string, - objectMetadataMap: ObjectMetadataMap, + objectMetadataMaps: ObjectMetadataMaps, ): Promise { return await this.processQueryResultField( result, objectMetadataItem.id, - objectMetadataMap, + objectMetadataMaps, workspaceId, ); } diff --git a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/utils/is-query-result-field-value-a-connection.guard.ts b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/utils/is-query-result-field-value-a-connection.guard.ts index 4931dacc3252..e6861f360316 100644 --- a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/utils/is-query-result-field-value-a-connection.guard.ts +++ b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/utils/is-query-result-field-value-a-connection.guard.ts @@ -1,4 +1,4 @@ -import { Record as ObjectRecord } from 'src/engine/api/graphql/workspace-query-builder/interfaces/record.interface'; +import { ObjectRecord } from 'src/engine/api/graphql/workspace-query-builder/interfaces/object-record.interface'; import { QueryResultFieldValue } from 'src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/interfaces/query-result-field-value'; import { IConnection } from 'src/engine/api/graphql/workspace-query-runner/interfaces/connection.interface'; import { IEdge } from 'src/engine/api/graphql/workspace-query-runner/interfaces/edge.interface'; diff --git a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/utils/is-query-result-field-value-a-nested-record-array.guard.ts b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/utils/is-query-result-field-value-a-nested-record-array.guard.ts index 048d84f18e63..cac0b4178a3e 100644 --- a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/utils/is-query-result-field-value-a-nested-record-array.guard.ts +++ b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/utils/is-query-result-field-value-a-nested-record-array.guard.ts @@ -1,4 +1,4 @@ -import { Record as ObjectRecord } from 'src/engine/api/graphql/workspace-query-builder/interfaces/record.interface'; +import { ObjectRecord } from 'src/engine/api/graphql/workspace-query-builder/interfaces/object-record.interface'; import { QueryResultFieldValue } from 'src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/interfaces/query-result-field-value'; export const isQueryResultFieldValueANestedRecordArray = ( diff --git a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/utils/is-query-result-field-value-a-record-array.guard.ts b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/utils/is-query-result-field-value-a-record-array.guard.ts index ff7aef258fca..1ffc4a7fab2f 100644 --- a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/utils/is-query-result-field-value-a-record-array.guard.ts +++ b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/utils/is-query-result-field-value-a-record-array.guard.ts @@ -1,4 +1,4 @@ -import { Record as ObjectRecord } from 'src/engine/api/graphql/workspace-query-builder/interfaces/record.interface'; +import { ObjectRecord } from 'src/engine/api/graphql/workspace-query-builder/interfaces/object-record.interface'; import { QueryResultFieldValue } from 'src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/interfaces/query-result-field-value'; export const isQueryResultFieldValueARecordArray = ( diff --git a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/utils/is-query-result-field-value-a-record.guard.ts b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/utils/is-query-result-field-value-a-record.guard.ts index 7023a7dca6ce..3b6e646b4b4f 100644 --- a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/utils/is-query-result-field-value-a-record.guard.ts +++ b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/utils/is-query-result-field-value-a-record.guard.ts @@ -1,4 +1,4 @@ -import { Record as ObjectRecord } from 'src/engine/api/graphql/workspace-query-builder/interfaces/record.interface'; +import { ObjectRecord } from 'src/engine/api/graphql/workspace-query-builder/interfaces/object-record.interface'; import { QueryResultFieldValue } from 'src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/interfaces/query-result-field-value'; export const isQueryResultFieldValueARecord = (