UNPKG

@mazaventures/valentine

Version:

Toolkit for Venture Capital firms to run their back office efficiently and openly

99 lines 3.27 kB
import { Company, Investment } from '../models/types'; import Decimal from 'decimal.js'; /** * Service for managing portfolio companies and investments. * Handles company information, investment tracking, and ownership calculations. * * @example * ```typescript * const portfolio = new PortfolioService(); * * // Add a company * const company = await portfolio.addCompany({ * name: "TechCo", * sector: "SaaS", * stage: "SERIES_A", * founded: new Date("2024-01-01") * }); * ``` */ export declare class PortfolioService { private companies; private investments; /** * Initializes a new instance of the PortfolioService class. * * @description Creates a new PortfolioService instance with empty company and investment maps. */ constructor(); /** * Adds a new company to the portfolio. * * @param company - Company information without ID * @returns Newly created company with generated ID * @throws {Error} If company data validation fails */ addCompany(company: Omit<Company, 'id'>): Promise<Company>; /** * Retrieves a company by its ID. * * @param id - Company ID * @returns Company information or undefined if not found */ getCompany(id: string): Promise<Company | undefined>; /** * Updates an existing company's information. * * @param id - Company ID * @param updates - Partial company information to update * @returns Updated company information * @throws {Error} If company not found or validation fails */ updateCompany(id: string, updates: Partial<Omit<Company, 'id'>>): Promise<Company>; /** * Lists all companies in the portfolio. * * @returns Array of all companies */ listCompanies(): Promise<Company[]>; /** * Records a new investment in a portfolio company. * * @param investment - Investment information without ID * @returns Newly created investment with generated ID * @throws {Error} If company not found or validation fails */ addInvestment(investment: Omit<Investment, 'id'>): Promise<Investment>; /** * Retrieves an investment by its ID. * * @param id - Investment ID * @returns Investment information or undefined if not found */ getInvestment(id: string): Promise<Investment | undefined>; /** * Lists investments, optionally filtered by company. * * @param companyId - Optional company ID to filter investments * @returns Array of investments */ listInvestments(companyId?: string): Promise<Investment[]>; /** * Calculates total invested amount, optionally for a specific company. * * @param companyId - Optional company ID to calculate total for * @returns Object containing total amount and currency */ getTotalInvested(companyId?: string): Promise<{ amount: Decimal; currency: string; }>; /** * Calculates total ownership percentage in a company. * * @param companyId - Company ID to calculate ownership for * @returns Total ownership percentage as a decimal */ getOwnership(companyId: string): Promise<Decimal>; } //# sourceMappingURL=portfolio.d.ts.map