UNPKG

captan

Version:

Captan — Command your ownership. A tiny, hackable CLI cap table tool.

620 lines 18.8 kB
import { z } from 'zod'; export type UUID = string; export type Kind = 'COMMON' | 'PREF' | 'OPTION_POOL'; export type EntityType = 'C_CORP' | 'S_CORP' | 'LLC'; export declare const ISODateSchema: z.ZodEffects<z.ZodString, string, string>; export declare const UUIDSchema: z.ZodString; export declare const PrefixedIdSchema: z.ZodString; export declare const CurrencyCodeSchema: z.ZodString; export declare const EmailSchema: z.ZodString; export declare const PercentageSchema: z.ZodNumber; export declare const VestingSchema: z.ZodObject<{ start: z.ZodEffects<z.ZodString, string, string>; monthsTotal: z.ZodNumber; cliffMonths: z.ZodNumber; }, "strip", z.ZodTypeAny, { start: string; monthsTotal: number; cliffMonths: number; }, { start: string; monthsTotal: number; cliffMonths: number; }>; export type Vesting = z.infer<typeof VestingSchema>; export declare const StakeholderSchema: z.ZodObject<{ id: z.ZodString; type: z.ZodEnum<["person", "entity"]>; name: z.ZodString; email: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { type: "person" | "entity"; id: string; name: string; email?: string | undefined; }, { type: "person" | "entity"; id: string; name: string; email?: string | undefined; }>; export type Stakeholder = z.infer<typeof StakeholderSchema>; export declare const SecurityClassSchema: z.ZodObject<{ id: z.ZodString; kind: z.ZodEnum<["COMMON", "PREF", "OPTION_POOL"]>; label: z.ZodString; parValue: z.ZodOptional<z.ZodNumber>; authorized: z.ZodNumber; }, "strip", z.ZodTypeAny, { id: string; kind: "COMMON" | "PREF" | "OPTION_POOL"; label: string; authorized: number; parValue?: number | undefined; }, { id: string; kind: "COMMON" | "PREF" | "OPTION_POOL"; label: string; authorized: number; parValue?: number | undefined; }>; export type SecurityClass = z.infer<typeof SecurityClassSchema>; export declare const IssuanceSchema: z.ZodObject<{ id: z.ZodString; securityClassId: z.ZodString; stakeholderId: z.ZodString; qty: z.ZodNumber; pps: z.ZodOptional<z.ZodNumber>; date: z.ZodEffects<z.ZodString, string, string>; cert: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { id: string; securityClassId: string; stakeholderId: string; qty: number; date: string; pps?: number | undefined; cert?: string | undefined; }, { id: string; securityClassId: string; stakeholderId: string; qty: number; date: string; pps?: number | undefined; cert?: string | undefined; }>; export type Issuance = z.infer<typeof IssuanceSchema>; export declare const OptionGrantSchema: z.ZodObject<{ id: z.ZodString; stakeholderId: z.ZodString; qty: z.ZodNumber; exercise: z.ZodNumber; grantDate: z.ZodEffects<z.ZodString, string, string>; vesting: z.ZodOptional<z.ZodObject<{ start: z.ZodEffects<z.ZodString, string, string>; monthsTotal: z.ZodNumber; cliffMonths: z.ZodNumber; }, "strip", z.ZodTypeAny, { start: string; monthsTotal: number; cliffMonths: number; }, { start: string; monthsTotal: number; cliffMonths: number; }>>; }, "strip", z.ZodTypeAny, { id: string; stakeholderId: string; qty: number; exercise: number; grantDate: string; vesting?: { start: string; monthsTotal: number; cliffMonths: number; } | undefined; }, { id: string; stakeholderId: string; qty: number; exercise: number; grantDate: string; vesting?: { start: string; monthsTotal: number; cliffMonths: number; } | undefined; }>; export type OptionGrant = z.infer<typeof OptionGrantSchema>; export declare const SAFESchema: z.ZodObject<{ id: z.ZodString; stakeholderId: z.ZodString; amount: z.ZodNumber; date: z.ZodEffects<z.ZodString, string, string>; cap: z.ZodOptional<z.ZodNumber>; discount: z.ZodOptional<z.ZodNumber>; type: z.ZodOptional<z.ZodEnum<["pre", "post"]>>; note: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { id: string; stakeholderId: string; date: string; amount: number; type?: "pre" | "post" | undefined; cap?: number | undefined; discount?: number | undefined; note?: string | undefined; }, { id: string; stakeholderId: string; date: string; amount: number; type?: "pre" | "post" | undefined; cap?: number | undefined; discount?: number | undefined; note?: string | undefined; }>; export type SAFE = z.infer<typeof SAFESchema>; export declare const ValuationSchema: z.ZodObject<{ id: z.ZodString; date: z.ZodEffects<z.ZodString, string, string>; type: z.ZodEnum<["409a", "common", "preferred", "series_a", "series_b", "series_c", "other"]>; preMoney: z.ZodOptional<z.ZodNumber>; postMoney: z.ZodOptional<z.ZodNumber>; sharePrice: z.ZodOptional<z.ZodNumber>; methodology: z.ZodOptional<z.ZodString>; provider: z.ZodOptional<z.ZodString>; note: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { type: "409a" | "common" | "preferred" | "series_a" | "series_b" | "series_c" | "other"; id: string; date: string; note?: string | undefined; preMoney?: number | undefined; postMoney?: number | undefined; sharePrice?: number | undefined; methodology?: string | undefined; provider?: string | undefined; }, { type: "409a" | "common" | "preferred" | "series_a" | "series_b" | "series_c" | "other"; id: string; date: string; note?: string | undefined; preMoney?: number | undefined; postMoney?: number | undefined; sharePrice?: number | undefined; methodology?: string | undefined; provider?: string | undefined; }>; export type Valuation = z.infer<typeof ValuationSchema>; export declare const AuditEntrySchema: z.ZodObject<{ ts: z.ZodString; by: z.ZodString; action: z.ZodString; data: z.ZodAny; }, "strip", z.ZodTypeAny, { ts: string; by: string; action: string; data?: any; }, { ts: string; by: string; action: string; data?: any; }>; export type AuditEntry = z.infer<typeof AuditEntrySchema>; export declare const FileModelSchema: z.ZodObject<{ version: z.ZodNumber; company: z.ZodObject<{ id: z.ZodString; name: z.ZodString; formationDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>; entityType: z.ZodOptional<z.ZodEnum<["C_CORP", "S_CORP", "LLC"]>>; jurisdiction: z.ZodOptional<z.ZodString>; currency: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { id: string; name: string; formationDate?: string | undefined; entityType?: "C_CORP" | "S_CORP" | "LLC" | undefined; jurisdiction?: string | undefined; currency?: string | undefined; }, { id: string; name: string; formationDate?: string | undefined; entityType?: "C_CORP" | "S_CORP" | "LLC" | undefined; jurisdiction?: string | undefined; currency?: string | undefined; }>; stakeholders: z.ZodArray<z.ZodObject<{ id: z.ZodString; type: z.ZodEnum<["person", "entity"]>; name: z.ZodString; email: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { type: "person" | "entity"; id: string; name: string; email?: string | undefined; }, { type: "person" | "entity"; id: string; name: string; email?: string | undefined; }>, "many">; securityClasses: z.ZodArray<z.ZodObject<{ id: z.ZodString; kind: z.ZodEnum<["COMMON", "PREF", "OPTION_POOL"]>; label: z.ZodString; parValue: z.ZodOptional<z.ZodNumber>; authorized: z.ZodNumber; }, "strip", z.ZodTypeAny, { id: string; kind: "COMMON" | "PREF" | "OPTION_POOL"; label: string; authorized: number; parValue?: number | undefined; }, { id: string; kind: "COMMON" | "PREF" | "OPTION_POOL"; label: string; authorized: number; parValue?: number | undefined; }>, "many">; issuances: z.ZodArray<z.ZodObject<{ id: z.ZodString; securityClassId: z.ZodString; stakeholderId: z.ZodString; qty: z.ZodNumber; pps: z.ZodOptional<z.ZodNumber>; date: z.ZodEffects<z.ZodString, string, string>; cert: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { id: string; securityClassId: string; stakeholderId: string; qty: number; date: string; pps?: number | undefined; cert?: string | undefined; }, { id: string; securityClassId: string; stakeholderId: string; qty: number; date: string; pps?: number | undefined; cert?: string | undefined; }>, "many">; optionGrants: z.ZodArray<z.ZodObject<{ id: z.ZodString; stakeholderId: z.ZodString; qty: z.ZodNumber; exercise: z.ZodNumber; grantDate: z.ZodEffects<z.ZodString, string, string>; vesting: z.ZodOptional<z.ZodObject<{ start: z.ZodEffects<z.ZodString, string, string>; monthsTotal: z.ZodNumber; cliffMonths: z.ZodNumber; }, "strip", z.ZodTypeAny, { start: string; monthsTotal: number; cliffMonths: number; }, { start: string; monthsTotal: number; cliffMonths: number; }>>; }, "strip", z.ZodTypeAny, { id: string; stakeholderId: string; qty: number; exercise: number; grantDate: string; vesting?: { start: string; monthsTotal: number; cliffMonths: number; } | undefined; }, { id: string; stakeholderId: string; qty: number; exercise: number; grantDate: string; vesting?: { start: string; monthsTotal: number; cliffMonths: number; } | undefined; }>, "many">; safes: z.ZodArray<z.ZodObject<{ id: z.ZodString; stakeholderId: z.ZodString; amount: z.ZodNumber; date: z.ZodEffects<z.ZodString, string, string>; cap: z.ZodOptional<z.ZodNumber>; discount: z.ZodOptional<z.ZodNumber>; type: z.ZodOptional<z.ZodEnum<["pre", "post"]>>; note: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { id: string; stakeholderId: string; date: string; amount: number; type?: "pre" | "post" | undefined; cap?: number | undefined; discount?: number | undefined; note?: string | undefined; }, { id: string; stakeholderId: string; date: string; amount: number; type?: "pre" | "post" | undefined; cap?: number | undefined; discount?: number | undefined; note?: string | undefined; }>, "many">; valuations: z.ZodArray<z.ZodObject<{ id: z.ZodString; date: z.ZodEffects<z.ZodString, string, string>; type: z.ZodEnum<["409a", "common", "preferred", "series_a", "series_b", "series_c", "other"]>; preMoney: z.ZodOptional<z.ZodNumber>; postMoney: z.ZodOptional<z.ZodNumber>; sharePrice: z.ZodOptional<z.ZodNumber>; methodology: z.ZodOptional<z.ZodString>; provider: z.ZodOptional<z.ZodString>; note: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { type: "409a" | "common" | "preferred" | "series_a" | "series_b" | "series_c" | "other"; id: string; date: string; note?: string | undefined; preMoney?: number | undefined; postMoney?: number | undefined; sharePrice?: number | undefined; methodology?: string | undefined; provider?: string | undefined; }, { type: "409a" | "common" | "preferred" | "series_a" | "series_b" | "series_c" | "other"; id: string; date: string; note?: string | undefined; preMoney?: number | undefined; postMoney?: number | undefined; sharePrice?: number | undefined; methodology?: string | undefined; provider?: string | undefined; }>, "many">; audit: z.ZodArray<z.ZodObject<{ ts: z.ZodString; by: z.ZodString; action: z.ZodString; data: z.ZodAny; }, "strip", z.ZodTypeAny, { ts: string; by: string; action: string; data?: any; }, { ts: string; by: string; action: string; data?: any; }>, "many">; }, "strip", z.ZodTypeAny, { version: number; company: { id: string; name: string; formationDate?: string | undefined; entityType?: "C_CORP" | "S_CORP" | "LLC" | undefined; jurisdiction?: string | undefined; currency?: string | undefined; }; stakeholders: { type: "person" | "entity"; id: string; name: string; email?: string | undefined; }[]; securityClasses: { id: string; kind: "COMMON" | "PREF" | "OPTION_POOL"; label: string; authorized: number; parValue?: number | undefined; }[]; issuances: { id: string; securityClassId: string; stakeholderId: string; qty: number; date: string; pps?: number | undefined; cert?: string | undefined; }[]; optionGrants: { id: string; stakeholderId: string; qty: number; exercise: number; grantDate: string; vesting?: { start: string; monthsTotal: number; cliffMonths: number; } | undefined; }[]; safes: { id: string; stakeholderId: string; date: string; amount: number; type?: "pre" | "post" | undefined; cap?: number | undefined; discount?: number | undefined; note?: string | undefined; }[]; valuations: { type: "409a" | "common" | "preferred" | "series_a" | "series_b" | "series_c" | "other"; id: string; date: string; note?: string | undefined; preMoney?: number | undefined; postMoney?: number | undefined; sharePrice?: number | undefined; methodology?: string | undefined; provider?: string | undefined; }[]; audit: { ts: string; by: string; action: string; data?: any; }[]; }, { version: number; company: { id: string; name: string; formationDate?: string | undefined; entityType?: "C_CORP" | "S_CORP" | "LLC" | undefined; jurisdiction?: string | undefined; currency?: string | undefined; }; stakeholders: { type: "person" | "entity"; id: string; name: string; email?: string | undefined; }[]; securityClasses: { id: string; kind: "COMMON" | "PREF" | "OPTION_POOL"; label: string; authorized: number; parValue?: number | undefined; }[]; issuances: { id: string; securityClassId: string; stakeholderId: string; qty: number; date: string; pps?: number | undefined; cert?: string | undefined; }[]; optionGrants: { id: string; stakeholderId: string; qty: number; exercise: number; grantDate: string; vesting?: { start: string; monthsTotal: number; cliffMonths: number; } | undefined; }[]; safes: { id: string; stakeholderId: string; date: string; amount: number; type?: "pre" | "post" | undefined; cap?: number | undefined; discount?: number | undefined; note?: string | undefined; }[]; valuations: { type: "409a" | "common" | "preferred" | "series_a" | "series_b" | "series_c" | "other"; id: string; date: string; note?: string | undefined; preMoney?: number | undefined; postMoney?: number | undefined; sharePrice?: number | undefined; methodology?: string | undefined; provider?: string | undefined; }[]; audit: { ts: string; by: string; action: string; data?: any; }[]; }>; export type FileModel = z.infer<typeof FileModelSchema>; /** * Parse an ISO date string to UTC date, handling various formats * Ensures consistent UTC handling regardless of system timezone */ export declare function parseUTCDate(dateStr: string): Date; /** * Format a Date to ISO date string (YYYY-MM-DD) in UTC */ export declare function formatUTCDate(date: Date): string; /** * Validate an ISO date string */ export declare function isValidISODate(dateStr: string): boolean; /** * Get today's date as ISO string in UTC */ export declare function getTodayUTC(): string; export declare function monthsBetween(aISO: string, bISO: string): number; export declare function vestedQty(asOfISO: string, qty: number, vesting?: Vesting): number; export interface CapTableRow { name: string; outstanding: number; pctOutstanding: number; fullyDiluted: number; pctFullyDiluted: number; } export interface CapTableTotals { issuedTotal: number; vestedOptions: number; unvestedOptions: number; outstandingTotal: number; fd: { issued: number; grants: number; poolRemaining: number; totalFD: number; }; } export interface CapTableResult { rows: CapTableRow[]; totals: CapTableTotals; } export declare function getEntityDefaults(entityType: EntityType): { authorized: number; parValue: number; unitsName: string; holderName: string; poolPct: number; } | { authorized: number; parValue: undefined; unitsName: string; holderName: string; poolPct: number; }; export interface SAFEConversion { safeId: string; stakeholderId: string; stakeholderName: string; investmentAmount: number; sharesIssued: number; conversionPrice: number; conversionReason: 'cap' | 'discount' | 'price'; } export declare function convertSAFE(safe: SAFE, pricePerShare: number, preMoneyShares: number, isPostMoney?: boolean): SAFEConversion; export declare function calcCap(model: FileModel, asOfISO: string): CapTableResult; //# sourceMappingURL=model.d.ts.map