UNPKG

@baruchiro/actual-mcp

Version:

Actual Budget MCP server exposing API functionality

38 lines 1.36 kB
export class CategoryMapper { categoryNames = {}; groupNames = {}; categoryToGroup = {}; investmentCategories = new Set(); constructor(categories, categoryGroups) { categories.forEach((cat) => { this.categoryNames[cat.id] = cat.name; }); categoryGroups.forEach((group) => { this.groupNames[group.id] = group.name; }); categories.forEach((cat) => { const groupName = this.groupNames[cat.group_id] || 'Unknown Group'; const isIncome = !!cat.is_income; const isSavingsOrInvestment = groupName.toLowerCase().includes('investment') || groupName.toLowerCase().includes('savings'); this.categoryToGroup[cat.id] = { id: cat.group_id, name: groupName, isIncome, isSavingsOrInvestment, }; if (isSavingsOrInvestment) { this.investmentCategories.add(cat.id); } }); } getCategoryName(categoryId) { return this.categoryNames[categoryId] || 'Unknown Category'; } getGroupInfo(categoryId) { return this.categoryToGroup[categoryId]; } isInvestmentCategory(categoryId) { return this.investmentCategories.has(categoryId); } } //# sourceMappingURL=category-mapper.js.map