fix IndexFieldMetadata availability in IndexMetadata/ObjectMetadata in front (#12886)

Context : 
- IndexFieldMetadata was no longer available on 'objects' gql query
([since this PR](https://github.com/twentyhq/twenty/pull/12785)). Then,
unicity checks on import do not work anymore.

Fix : 
- Add a dataloader logic in indexFieldMetadata
- Add extra check in unicity hook on import
This commit is contained in:
Etienne
2025-06-27 13:12:14 +02:00
committed by GitHub
parent c3f8a25d25
commit b80762b3e1
20 changed files with 225 additions and 71 deletions

View File

@ -1,31 +0,0 @@
import { lowercaseDomainAndRemoveTrailingSlash } from 'src/engine/api/graphql/workspace-query-runner/utils/query-runner-links.util';
describe('queryRunner LINKS util', () => {
it('should leave lowcased domain unchanged', () => {
const primaryLinkUrl = 'https://www.example.com/test';
const result = lowercaseDomainAndRemoveTrailingSlash(primaryLinkUrl);
expect(result).toBe('https://www.example.com/test');
});
it('should lowercase the domain of the primary link url', () => {
const primaryLinkUrl = 'htTps://wwW.exAmple.coM/TEST';
const result = lowercaseDomainAndRemoveTrailingSlash(primaryLinkUrl);
expect(result).toBe('https://www.example.com/TEST');
});
it('should not add a trailing slash', () => {
const primaryLinkUrl = 'https://www.example.com';
const result = lowercaseDomainAndRemoveTrailingSlash(primaryLinkUrl);
expect(result).toBe('https://www.example.com');
});
it('should not add a trailing slash', () => {
const primaryLinkUrl = 'https://www.example.com/toto/';
const result = lowercaseDomainAndRemoveTrailingSlash(primaryLinkUrl);
expect(result).toBe('https://www.example.com/toto');
});
});

View File

@ -1,7 +0,0 @@
export const lowercaseDomainAndRemoveTrailingSlash = (url: string) => {
try {
return new URL(url).toString().replace(/\/$/, '');
} catch {
return url;
}
};