import type { ApiBase, RedirectStatusCode } from '@toddledev/core/dist/api/apiTypes'; import type { Component, RouteDeclaration } from '@toddledev/core/dist/component/component.types'; import type { Formula } from '@toddledev/core/dist/formula/formula'; import type { PluginFormula } from '@toddledev/core/dist/formula/formulaTypes'; import type { OldTheme, Theme } from '@toddledev/core/dist/styling/theme'; export type FileGetter = (args: { package?: string; name: string; type: keyof ProjectFiles; }) => Promise | Route | Theme | ApiService>; export interface ToddleProject { name: string; description?: string | null; short_id: string; id: string; emoji?: string | null; type: 'app' | 'package'; thumbnail?: { path: string; } | null; } export interface ProjectFiles { components: Partial>; packages?: Record; actions?: Record; formulas?: Record>; routes?: Record; config?: { theme: OldTheme; meta?: { icon?: { formula: Formula; }; robots?: { formula: Formula; }; sitemap?: { formula: Formula; }; manifest?: { formula: Formula; }; serviceWorker?: { formula: Formula; }; }; }; themes?: Record; services?: Record; } interface BaseApiService { name: string; baseUrl?: Formula; docsUrl?: Formula; apiKey?: Formula; meta?: Record; } interface SupabaseApiService extends BaseApiService { type: 'supabase'; meta?: { projectUrl?: Formula; }; } interface XanoApiService extends BaseApiService { type: 'xano'; } interface CustomApiService extends BaseApiService { type: 'custom'; } export type ApiService = SupabaseApiService | XanoApiService | CustomApiService; export type InstalledPackage = Pick & { manifest: { name: string; commit: string; }; }; export interface PluginAction { name: string; description?: string; version?: 2 | never; arguments: Array<{ name: string; formula: Formula; }>; variableArguments: boolean | null; handler: string; exported?: boolean; } interface BaseRoute { source: RouteDeclaration; destination: ApiBase; } export interface RewriteRoute extends BaseRoute { type: 'rewrite'; } export interface RedirectRoute extends BaseRoute { type: 'redirect'; status?: RedirectStatusCode; } export type Route = RewriteRoute | RedirectRoute; export {};