// Mirrors Rust's SerializedComponentArgumentValidator. // The `value` field is a JSON-serialized validator. type SerializedValidator = { type: "value"; value: string }; // These reflect server types. export type ComponentDefinitionExport = { name: string; // how will we figure this out? path: string; definitionType: { type: "childComponent"; name: string; }; childComponents: []; exports: { type: "branch"; branch: [] }; }; // These reflect server types. // type ComponentDefinitionType export type ComponentDefinitionType = { type: "childComponent"; name: string; args: [string, { type: "value"; value: string }][]; }; export type AppDefinitionType = { type: "app" }; type ComponentInstantiation = { name: string; // This is a ComponentPath. path: string; args: [string, { type: "value"; value: string }][] | null; env: [string, { type: "value"; value: string }][] | null; }; export type HttpMount = string; type ComponentExport = | { type: "branch"; branch: [string, ComponentExport][] } | { type: "leaf"; leaf: string }; // The type expected from the internal .export() // method of a component or app definition. export type ComponentDefinitionAnalysis = { name: string; definitionType: ComponentDefinitionType; childComponents: ComponentInstantiation[]; httpMounts: Record; exports: ComponentExport; envVars?: [string, SerializedValidator & { optional?: boolean }][]; }; export type AppDefinitionAnalysis = { definitionType: AppDefinitionType; // Top-level field (not inside definitionType) to match Rust's // SerializedComponentDefinitionMetadata.http_prefix field. httpPrefix?: string; childComponents: ComponentInstantiation[]; httpMounts: Record; exports: ComponentExport; envVars?: [string, SerializedValidator & { optional?: boolean }][]; };