Skip to content

The open alternative to Salesforce, designed for AI.

450 B
Raw Blame
import { parseCanonicalTipTapJsonDocument } from 'twenty-shared/utils';

export const isAgentChatDraftsByThreadId = (
  value: unknown,
): value is Record<string, string> => {
  if (typeof value !== 'object' || value === null || Array.isArray(value)) {
    return false;
  }

  return Object.values(value).every(
    (draft) =>
      typeof draft === 'string' &&
      (draft === '' || parseCanonicalTipTapJsonDocument(draft) !== undefined),
  );
};