twenty / packages /twenty-shared /src /logic-function /is-record-array-schema.ts
Jules
Initial clean CRM deployment with prebuilt assets
d9494a5
Raw
History Blame Contribute Delete
563 Bytes
import { isNonEmptyString } from '@sniptt/guards';
import { isRecordObjectSchema } from '@/logic-function/is-record-object-schema';
type RecordArraySchema = {
type?: string;
objectUniversalIdentifier?: string;
items?: {
type?: string;
objectUniversalIdentifier?: string;
} | null;
};
export const isRecordArraySchema = (
schema: RecordArraySchema | null | undefined,
): boolean =>
(schema?.type === 'records' &&
isNonEmptyString(schema.objectUniversalIdentifier)) ||
(schema?.type === 'array' && isRecordObjectSchema(schema?.items));