UNPKG

credl-parser-evaluator

Version:

TypeScript-based CREDL Parser and Evaluator that processes CREDL files and outputs complete Intermediate Representations

382 lines 10 kB
/** * TypeScript type definitions for CREDL (Commercial Real Estate Domain Language) v0.2 * * This file contains all interfaces and types needed to represent CREDL constructs * including core blocks, extension blocks, and intermediate representations. */ export declare enum AssumptionType { FIXED = "fixed", DISTRIBUTION = "distribution", EXPRESSION = "expression", TABLE = "table" } export declare enum SpaceType { OFFICE = "office", RETAIL = "retail", INDUSTRIAL = "industrial", RESIDENTIAL = "residential" } export declare enum PropertyType { OFFICE = "Office", RETAIL = "Retail", INDUSTRIAL = "Industrial", RESIDENTIAL = "Residential", MIXED_USE = "Mixed Use", HOSPITALITY = "Hospitality", HEALTHCARE = "Healthcare" } export declare enum LeaseType { GROSS = "gross", NNN = "NNN", MODIFIED_GROSS = "modified_gross" } export declare enum LeaseStatus { LEASED = "leased", VACANT = "vacant" } export declare enum ModelType { DETERMINISTIC = "deterministic", STOCHASTIC = "stochastic" } export declare enum SimulationType { MONTE_CARLO = "monte_carlo" } export declare enum DistributionType { NORMAL = "normal", UNIFORM = "uniform", TRIANGULAR = "triangular", LOGNORMAL = "lognormal" } export declare enum OutputFormat { JSON = "json", CSV = "csv", EXCEL = "excel", PDF = "pdf" } export interface Metadata { version: string; name: string; description: string; analysis_start_date: string; created_date: string; modified_date?: string; author?: string; } export interface Building { id: string; name: string; floors?: number; total_area_sf?: number; year_built?: number; } export interface Asset { id: string; name: string; property_type: PropertyType; location: string; total_area_sf: number; buildings: Building[]; acquisition_date?: string; acquisition_price?: number; } export interface Lease { status: LeaseStatus; tenant?: string; rent_psf: number; lease_type: LeaseType; start_date?: string; end_date?: string; escalation_rate?: number; security_deposit?: number; tenant_improvements?: number; leasing_commissions?: number; renewal_probability?: number; } export interface LeaseAssumptions { rent_psf: number; lease_type: LeaseType; expected_turnover_months?: number; absorption_sf_per_month?: number; renewal_probability?: number; } export interface Space { id: string; parent_building: string; parent_asset?: string; type: SpaceType; area_sf: number; lease?: Lease; lease_assumptions?: LeaseAssumptions; delivery_date?: string; preset_lease?: string; preset_expenses?: string; source_template?: string; } export interface FixedAssumption { name: string; type: AssumptionType.FIXED; value: number; scope?: string; tags?: string[]; description?: string; } export interface DistributionParameters { mean?: number; stddev?: number; min?: number; max?: number; mode?: number; } export interface DistributionAssumption { name: string; type: AssumptionType.DISTRIBUTION; distribution: DistributionType; parameters: DistributionParameters; scope?: string; tags?: string[]; description?: string; } export interface ExpressionAssumption { name: string; type: AssumptionType.EXPRESSION; formula: string; scope?: string; tags?: string[]; description?: string; } export interface TableValue { name: string; amount_per_sf?: number; amount?: number; percentage?: number; [key: string]: any; } export interface TableAssumption { name: string; type: AssumptionType.TABLE; values: TableValue[]; scope?: string; tags?: string[]; description?: string; } export type Assumption = FixedAssumption | DistributionAssumption | ExpressionAssumption | TableAssumption; export interface Model { name: string; type: ModelType; duration_years: number; steps_per_year: number; inputs: string[]; outputs: string[]; description?: string; } export interface SimulationProcess { method: string; parameters: Record<string, any>; } export interface SimulationOutputs { summary_metrics: string[]; } export interface Simulation { type: SimulationType; iterations: number; processes: Record<string, SimulationProcess>; outputs: SimulationOutputs; } export interface Output { format: OutputFormat; metrics: string[]; tables?: string[]; charts?: string[]; } export interface ScenarioOverride { [assumptionName: string]: Partial<Assumption>; } export interface ScenarioTrigger { condition: string; } export interface ScenarioAction { type: string; template?: string; count?: number; parent_building?: string; [key: string]: any; } export interface Scenario { name: string; description: string; overrides?: ScenarioOverride; triggers?: ScenarioTrigger[]; actions?: ScenarioAction[]; } export interface WaterfallTier { hurdle: number; promote: number; tier?: number; description?: string; } export interface Waterfall { tiers: WaterfallTier[]; enabled?: boolean; } export interface Extensions { scenarios?: Scenario[]; waterfall?: Waterfall; } export interface PresetProfile { [key: string]: any; } export interface Presets { lease_profiles?: Record<string, PresetProfile>; expense_profiles?: Record<string, PresetProfile>; [category: string]: Record<string, PresetProfile> | undefined; } export interface TemplateSpace { id_prefix: string; type: SpaceType; area_sf: number; lease_profile?: string; expense_profile?: string; count: number; [key: string]: any; } export interface Template { spaces: TemplateSpace[]; } export interface Templates { [templateName: string]: Template; } export interface UseTemplate { template: string; parent_building: string; parent_asset?: string; start_index?: number; [key: string]: any; } export interface CREDLFile { metadata: Metadata; assets: Asset[]; spaces: Space[]; assumptions: Assumption[]; models: Model[]; simulation: Simulation; outputs: Output; scenarios?: Scenario[]; waterfall?: Waterfall; extensions?: Extensions; presets?: Presets; templates?: Templates; use_templates?: UseTemplate[]; } export interface ValidationError { field: string; message: string; help?: string; line?: number; column?: number; severity: 'error' | 'warning'; } export interface ValidationResult { isValid: boolean; errors: ValidationError[]; warnings: ValidationError[]; } export interface ParseResult<T> { success: boolean; data?: T; errors: ValidationError[]; warnings: ValidationError[]; } export interface ResolvedSpace { id: string; parent_building: string; parent_asset?: string; type: SpaceType; area_sf: number; lease?: Lease; lease_assumptions?: LeaseAssumptions; delivery_date?: string; resolved_lease?: Lease | LeaseAssumptions; resolved_expenses?: Record<string, any>; source_template?: string; } export type ResolvedAssumption = Assumption & { resolved_value?: any; source_preset?: string; }; export interface DependencyNode { id: string; type: 'assumption' | 'model' | 'output' | 'scenario'; name: string; dependencies: string[]; dependents: string[]; depth: number; } export interface CrossReferenceMap { assumption_to_models: Record<string, string[]>; model_to_assumptions: Record<string, string[]>; model_to_outputs: Record<string, string[]>; output_to_models: Record<string, string[]>; simulation_to_outputs: string[]; available_outputs: string[]; scenario_to_assumptions: Record<string, string[]>; assumption_to_scenarios: Record<string, string[]>; } export interface ResolutionMetadata { dependency_graph: DependencyNode[]; cross_references: CrossReferenceMap; resolution_order: string[]; circular_dependencies: string[][]; orphaned_elements: { assumptions: string[]; outputs: string[]; models: string[]; }; coverage_analysis: { assumption_coverage: number; output_coverage: number; model_utilization: number; }; } export interface PartialProcessingStatus { completed_steps: string[]; failed_steps: Array<{ step: string; error: string; recovery_attempted: boolean; }>; recovery_actions: Array<{ step: string; action: string; success: boolean; details: string; }>; processing_summary: string; } export interface IR { metadata: Metadata; assets: Asset[]; spaces: ResolvedSpace[]; assumptions: ResolvedAssumption[]; models: Model[]; simulation: Simulation; outputs: Output; scenarios?: Scenario[]; waterfall?: Waterfall; resolution_order: string[]; template_generated_spaces: string[]; preset_applications: Record<string, string[]>; cross_reference_resolution: ResolutionMetadata; validation: ValidationResult; partial_processing_status?: PartialProcessingStatus; generated_at: string; generator_version: string; } export type AssumptionName = string; export type SpaceId = string; export type AssetId = string; export type BuildingId = string; export declare const isFixedAssumption: (assumption: Assumption) => assumption is FixedAssumption; export declare const isDistributionAssumption: (assumption: Assumption) => assumption is DistributionAssumption; export declare const isExpressionAssumption: (assumption: Assumption) => assumption is ExpressionAssumption; export declare const isTableAssumption: (assumption: Assumption) => assumption is TableAssumption; //# sourceMappingURL=CREDLTypes.d.ts.map