@mazaventures/valentine
Version:
Toolkit for Venture Capital firms to run their back office efficiently and openly
93 lines • 3.08 kB
TypeScript
import { Update, Metric } from '../models/types';
/**
* Service for managing portfolio company updates and metrics.
* Handles tracking of company performance metrics, periodic updates, and historical data.
*
* @example
* ```typescript
* const updates = new UpdatesService();
*
* // Create a company update
* const update = await updates.createUpdate({
* companyId: "company-1",
* date: new Date(),
* type: "MONTHLY",
* metrics: [{
* name: "MRR",
* value: 100000,
* date: new Date()
* }]
* });
* ```
*/
export declare class UpdatesService {
private updates;
/**
* Initializes the updates service.
*/
constructor();
/**
* Creates a new company update with metrics.
*
* @param update - Update information without ID
* @returns Newly created update with generated ID
* @throws {Error} If validation fails
*/
createUpdate(update: Omit<Update, 'id'>): Promise<Update>;
/**
* Retrieves a specific update by ID.
*
* @param id - Update ID
* @returns Update information or undefined if not found
*/
getUpdate(id: string): Promise<Update | undefined>;
/**
* Lists updates with optional filtering.
*
* @param params - Optional filter parameters
* @param params.companyId - Filter by company ID
* @param params.type - Filter by update type (MONTHLY, QUARTERLY, etc.)
* @param params.startDate - Filter updates after this date
* @param params.endDate - Filter updates before this date
* @returns Array of updates sorted by date (newest first)
*/
listUpdates(params?: {
companyId?: string;
type?: Update['type'];
startDate?: Date;
endDate?: Date;
}): Promise<Update[]>;
/**
* Gets the most recent value for each metric for a company.
*
* @param companyId - Company ID to get metrics for
* @returns Array of most recent metrics
*/
getLatestMetrics(companyId: string): Promise<Metric[]>;
/**
* Retrieves historical values for a specific metric.
*
* @param params - Query parameters
* @param params.companyId - Company ID to get metric history for
* @param params.metricName - Name of the metric to track
* @param params.startDate - Optional start date for history
* @param params.endDate - Optional end date for history
* @returns Array of metrics sorted by date (oldest first)
*/
getMetricHistory(params: {
companyId: string;
metricName: string;
startDate?: Date;
endDate?: Date;
}): Promise<Metric[]>;
/**
* Adds new metrics to an existing update.
*
* @param updateId - ID of the update to add metrics to
* @param metrics - Array of metrics to add (date will be set to update date)
* @returns Updated update information
* @throws {Error} If update not found or validation fails
*/
addMetricsToUpdate(updateId: string, metrics: Omit<Metric, 'date'>[]): Promise<Update>;
}
//# sourceMappingURL=updates.d.ts.map