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.

929 B
Raw Blame
import { listLibraryWorkflows as listLibraryWorkflowsApi, type ListWorkflowsParams } from './data/api';

export interface WorkflowLibraryItem {
  workflowId: string;
  name: string;
  description: string;
  category: 'user' | 'default';
  tags?: string;
}

export interface WorkflowLibraryPage {
  items: WorkflowLibraryItem[];
  page: number;
  pages: number;
  total: number;
}

/** Cancellable workflow-library read used by deferred cross-feature search surfaces. */
export const listLibraryWorkflows = async (params: ListWorkflowsParams): Promise<WorkflowLibraryPage> => {
  const body = await listLibraryWorkflowsApi(params);

  return {
    items: body.items.map((item) => ({
      category: item.category,
      description: item.description,
      name: item.name,
      tags: item.tags ?? undefined,
      workflowId: item.workflow_id,
    })),
    page: body.page,
    pages: body.pages,
    total: body.total,
  };
};