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