Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

691 B
Raw Blame
import type { RefusedWorkbenchProject } from './projectContracts';

import { isRecord, loadCanvasState } from './canvasMigration';

const asString = (value: unknown): string => (typeof value === 'string' ? value : '');

/** Refuses a project before migrations can rewrite an unsupported live canvas. */
export const gateProjectCanvases = (raw: unknown): RefusedWorkbenchProject | null => {
  if (!isRecord(raw)) {
    return null;
  }
  const canvas = loadCanvasState(raw.canvas);
  if (canvas.status !== 'loaded') {
    return {
      projectId: asString(raw.id),
      projectName: asString(raw.name),
      raw,
      refusal: canvas,
      source: 'canvas',
    };
  }
  return null;
};