import type { ApiBase, RedirectStatusCode } from '@nordcraft/core/dist/api/apiTypes'; import type { Component, RouteDeclaration } from '@nordcraft/core/dist/component/component.types'; import type { Formula } from '@nordcraft/core/dist/formula/formula'; import type { PluginFormula } from '@nordcraft/core/dist/formula/formulaTypes'; import type { OldTheme, Theme } from '@nordcraft/core/dist/styling/theme'; import type { PluginAction } from '@nordcraft/core/dist/types'; 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; type: 'app' | 'package'; thumbnail?: { path: string; } | null; } export interface ProjectFiles { components: Partial>; packages?: Partial>; actions?: Record; formulas?: Record>; routes?: Record; config?: { runtimeVersion?: string; 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 DatoCmsApiService extends BaseApiService { type: 'datocms'; } interface UmbracoApiService extends BaseApiService { type: 'umbraco'; } interface ContentfulApiService extends BaseApiService { type: 'contentful'; } interface CustomApiService extends BaseApiService { type: 'custom'; } export type ApiService = ContentfulApiService | CustomApiService | DatoCmsApiService | SupabaseApiService | UmbracoApiService | XanoApiService; export type InstalledPackage = Pick & { manifest: { name: string; commit: string; }; }; interface BaseRoute { source: RouteDeclaration; destination: ApiBase; enabled?: { formula: Formula; }; } export interface RewriteRoute extends BaseRoute { type: 'rewrite'; } export interface RedirectRoute extends BaseRoute { type: 'redirect'; status?: RedirectStatusCode; } export type Route = RewriteRoute | RedirectRoute; export {};