# Introduction Following https://github.com/twentyhq/twenty/pull/12068 Related with https://github.com/twentyhq/core-team-issues/issues/975 We're enabling `noImplicitAny` handled few use case manually, added a `ts-expect-error` to the others, we should plan to handle them in the future
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import {
|
|
FindManyFieldsMetadataFactoryInput,
|
|
findManyFieldsMetadataQueryFactory,
|
|
} from 'test/integration/metadata/suites/field-metadata/utils/find-many-fields-metadata-query-factory.util';
|
|
import { makeMetadataAPIRequest } from 'test/integration/metadata/suites/utils/make-metadata-api-request.util';
|
|
import { PerformMetadataQueryParams } from 'test/integration/metadata/types/perform-metadata-query.type';
|
|
import { warnIfNoErrorButExpectedToFail } from 'test/integration/metadata/utils/warn-if-no-error-but-expected-to-fail.util';
|
|
|
|
export const findManyFieldsMetadata = async ({
|
|
input,
|
|
gqlFields,
|
|
expectToFail = false,
|
|
}: PerformMetadataQueryParams<FindManyFieldsMetadataFactoryInput>) => {
|
|
const graphqlOperation = findManyFieldsMetadataQueryFactory({
|
|
input,
|
|
gqlFields,
|
|
});
|
|
|
|
const response = await makeMetadataAPIRequest(graphqlOperation);
|
|
|
|
if (expectToFail) {
|
|
warnIfNoErrorButExpectedToFail({
|
|
response,
|
|
errorMessage: 'Field Metadata retrieval should have failed but did not',
|
|
});
|
|
}
|
|
|
|
// @ts-expect-error legacy noImplicitAny
|
|
return response.body.data.fields.edges.map((edge) => edge.node);
|
|
};
|