@lunchflow/actual-flow 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +196 -0
  2. package/dist/actual-budget-client.d.ts +19 -0
  3. package/dist/actual-budget-client.d.ts.map +1 -0
  4. package/dist/actual-budget-client.js +161 -0
  5. package/dist/actual-budget-client.js.map +1 -0
  6. package/dist/config-manager.d.ts +16 -0
  7. package/dist/config-manager.d.ts.map +1 -0
  8. package/dist/config-manager.js +119 -0
  9. package/dist/config-manager.js.map +1 -0
  10. package/dist/importer.d.ts +20 -0
  11. package/dist/importer.d.ts.map +1 -0
  12. package/dist/importer.js +234 -0
  13. package/dist/importer.js.map +1 -0
  14. package/dist/index.d.ts +3 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +30 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/lunch-flow-client.d.ts +10 -0
  19. package/dist/lunch-flow-client.d.ts.map +1 -0
  20. package/dist/lunch-flow-client.js +67 -0
  21. package/dist/lunch-flow-client.js.map +1 -0
  22. package/dist/transaction-mapper.d.ts +8 -0
  23. package/dist/transaction-mapper.d.ts.map +1 -0
  24. package/dist/transaction-mapper.js +32 -0
  25. package/dist/transaction-mapper.js.map +1 -0
  26. package/dist/types.d.ts +55 -0
  27. package/dist/types.d.ts.map +1 -0
  28. package/dist/types.js +3 -0
  29. package/dist/types.js.map +1 -0
  30. package/dist/ui.d.ts +30 -0
  31. package/dist/ui.d.ts.map +1 -0
  32. package/dist/ui.js +278 -0
  33. package/dist/ui.js.map +1 -0
  34. package/install.sh +55 -0
  35. package/package.json +35 -0
  36. package/pnpm-workspace.yaml +2 -0
  37. package/src/actual-budget-client.ts +132 -0
  38. package/src/config-manager.ts +128 -0
  39. package/src/importer.ts +279 -0
  40. package/src/index.ts +28 -0
  41. package/src/lunch-flow-client.ts +64 -0
  42. package/src/transaction-mapper.ts +37 -0
  43. package/src/types.ts +60 -0
  44. package/src/ui.ts +314 -0
  45. package/tsconfig.json +19 -0
@@ -0,0 +1,234 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.LunchFlowImporter = void 0;
7
+ const lunch_flow_client_1 = require("./lunch-flow-client");
8
+ const actual_budget_client_1 = require("./actual-budget-client");
9
+ const transaction_mapper_1 = require("./transaction-mapper");
10
+ const config_manager_1 = require("./config-manager");
11
+ const ui_1 = require("./ui");
12
+ const chalk_1 = __importDefault(require("chalk"));
13
+ const cli_table3_1 = __importDefault(require("cli-table3"));
14
+ class LunchFlowImporter {
15
+ constructor() {
16
+ this.config = null;
17
+ this.configManager = new config_manager_1.ConfigManager();
18
+ this.ui = new ui_1.TerminalUI();
19
+ this.config = this.configManager.loadConfig();
20
+ // Initialize clients with default values, will be updated when config is loaded
21
+ this.lfClient = new lunch_flow_client_1.LunchFlowClient('', '');
22
+ this.abClient = new actual_budget_client_1.ActualBudgetClient('', '');
23
+ }
24
+ async initialize() {
25
+ await this.ui.showWelcome();
26
+ if (!this.config || !this.configManager.isConfigured()) {
27
+ console.log('No configuration found or incomplete. Let\'s set it up!\n');
28
+ await this.setupConfiguration();
29
+ }
30
+ else {
31
+ this.updateClients();
32
+ this.ui.showInfo('Configuration loaded successfully');
33
+ }
34
+ }
35
+ async setupConfiguration() {
36
+ const lfCreds = await this.ui.getLunchFlowCredentials();
37
+ const abCreds = await this.ui.getActualBudgetCredentials();
38
+ this.config = {
39
+ lunchFlow: lfCreds,
40
+ actualBudget: abCreds,
41
+ accountMappings: [],
42
+ };
43
+ this.configManager.saveConfig(this.config);
44
+ this.updateClients();
45
+ this.ui.showSuccess('Configuration saved successfully');
46
+ }
47
+ updateClients() {
48
+ if (this.config) {
49
+ this.lfClient = new lunch_flow_client_1.LunchFlowClient(this.config.lunchFlow.apiKey, this.config.lunchFlow.baseUrl);
50
+ this.abClient = new actual_budget_client_1.ActualBudgetClient(this.config.actualBudget.serverUrl, this.config.actualBudget.budgetSyncId, this.config.actualBudget.password);
51
+ }
52
+ }
53
+ async testConnections() {
54
+ const spinner = this.ui.showSpinner('Testing connections...');
55
+ try {
56
+ const [lfConnected, abConnected] = await Promise.all([
57
+ this.lfClient.testConnection(),
58
+ this.abClient.testConnection(),
59
+ ]);
60
+ spinner.stop();
61
+ await this.ui.showConnectionStatus({ lunchFlow: lfConnected, actualBudget: abConnected });
62
+ return { lunchFlow: lfConnected, actualBudget: abConnected };
63
+ }
64
+ catch (error) {
65
+ spinner.stop();
66
+ this.ui.showError('Failed to test connections');
67
+ return { lunchFlow: false, actualBudget: false };
68
+ }
69
+ }
70
+ async configureAccountMappings() {
71
+ const spinner = this.ui.showSpinner('Loading accounts...');
72
+ try {
73
+ const [lfAccounts, abAccounts] = await Promise.all([
74
+ this.lfClient.getAccounts(),
75
+ this.abClient.getAccounts(),
76
+ ]);
77
+ spinner.stop();
78
+ if (lfAccounts.length === 0) {
79
+ this.ui.showError('No Lunch Flow accounts found');
80
+ return;
81
+ }
82
+ if (abAccounts.length === 0) {
83
+ this.ui.showError('No Actual Budget accounts found');
84
+ return;
85
+ }
86
+ // Show accounts for reference
87
+ await this.ui.showAccountsTable(lfAccounts, '📡 Lunch Flow Accounts');
88
+ await this.ui.showAccountsTable(abAccounts, '💰 Actual Budget Accounts');
89
+ const mappings = await this.ui.configureAccountMappings(lfAccounts, abAccounts);
90
+ if (this.config) {
91
+ this.config.accountMappings = mappings;
92
+ this.configManager.saveConfig(this.config);
93
+ this.ui.showSuccess(`Configured ${mappings.length} account mappings`);
94
+ }
95
+ }
96
+ catch (error) {
97
+ spinner.stop();
98
+ this.ui.showError('Failed to configure account mappings');
99
+ }
100
+ }
101
+ async importTransactions() {
102
+ if (!this.config || this.config.accountMappings.length === 0) {
103
+ this.ui.showError('No account mappings configured. Please configure mappings first.');
104
+ return;
105
+ }
106
+ // Test connections first
107
+ const status = await this.testConnections();
108
+ if (!status.lunchFlow || !status.actualBudget) {
109
+ this.ui.showError('Cannot import: connections failed');
110
+ return;
111
+ }
112
+ const spinner = this.ui.showSpinner('Fetching transactions...');
113
+ try {
114
+ const lfTransactions = await this.lfClient.getTransactions(this.config.accountMappings[0].lunchFlowAccountId);
115
+ spinner.stop();
116
+ if (lfTransactions.length === 0) {
117
+ this.ui.showInfo('No transactions found for the selected date range');
118
+ return;
119
+ }
120
+ const mapper = new transaction_mapper_1.TransactionMapper(this.config.accountMappings);
121
+ const abTransactions = mapper.mapTransactions(lfTransactions);
122
+ if (abTransactions.length === 0) {
123
+ this.ui.showError('No transactions could be mapped to Actual Budget accounts');
124
+ return;
125
+ }
126
+ const startDate = abTransactions.reduce((min, t) => t.date < min ? t.date : min, abTransactions[0].date);
127
+ const endDate = abTransactions.reduce((max, t) => t.date > max ? t.date : max, abTransactions[0].date);
128
+ // Show preview
129
+ const abAccounts = await this.abClient.getAccounts();
130
+ await this.ui.showTransactionPreview(abTransactions, abAccounts);
131
+ const confirmed = await this.ui.confirmImport(abTransactions.length, { startDate, endDate });
132
+ if (!confirmed) {
133
+ this.ui.showInfo('Import cancelled');
134
+ return;
135
+ }
136
+ const importSpinner = this.ui.showSpinner(`Importing ${abTransactions.length} transactions...`);
137
+ await this.abClient.importTransactions(abTransactions);
138
+ importSpinner.stop();
139
+ this.ui.showSuccess(`Successfully imported ${abTransactions.length} transactions`);
140
+ }
141
+ catch (error) {
142
+ spinner.stop();
143
+ this.ui.showError('Failed to import transactions');
144
+ console.error('Import error:', error);
145
+ }
146
+ }
147
+ async showCurrentMappings() {
148
+ if (this.config) {
149
+ await this.ui.showAccountMappings(this.config.accountMappings);
150
+ }
151
+ else {
152
+ this.ui.showError('No configuration found');
153
+ }
154
+ }
155
+ async listAvailableBudgets() {
156
+ const spinner = this.ui.showSpinner('Fetching available budgets...');
157
+ try {
158
+ const budgets = await this.abClient.listAvailableBudgets();
159
+ spinner.stop();
160
+ if (budgets.length === 0) {
161
+ this.ui.showWarning('No budgets found on the server');
162
+ return;
163
+ }
164
+ console.log(chalk_1.default.blue('\n📋 Available Budgets\n'));
165
+ const table = new cli_table3_1.default({
166
+ head: ['Name', 'ID'],
167
+ colWidths: [30, 40],
168
+ style: {
169
+ head: ['cyan'],
170
+ border: ['gray'],
171
+ }
172
+ });
173
+ budgets.forEach(budget => {
174
+ table.push([budget.name, budget.id]);
175
+ });
176
+ console.log(table.toString());
177
+ }
178
+ catch (error) {
179
+ spinner.stop();
180
+ this.ui.showError('Failed to fetch available budgets');
181
+ console.error('Error:', error);
182
+ }
183
+ }
184
+ async reconfigureCredentials() {
185
+ const action = await this.ui.showReconfigureMenu();
186
+ if (action === 'cancel')
187
+ return;
188
+ if (action === 'lunchflow' || action === 'both') {
189
+ const lfCreds = await this.ui.getLunchFlowCredentials();
190
+ this.configManager.updateLunchFlowConfig(lfCreds.apiKey, lfCreds.baseUrl);
191
+ this.ui.showSuccess('Lunch Flow credentials updated');
192
+ }
193
+ if (action === 'actualbudget' || action === 'both') {
194
+ const abCreds = await this.ui.getActualBudgetCredentials();
195
+ this.configManager.updateActualBudgetConfig(abCreds.serverUrl, abCreds.budgetSyncId, abCreds.password);
196
+ this.ui.showSuccess('Actual Budget credentials updated');
197
+ }
198
+ // Reload config and update clients
199
+ this.config = this.configManager.loadConfig();
200
+ this.updateClients();
201
+ }
202
+ async run() {
203
+ await this.initialize();
204
+ while (true) {
205
+ const action = await this.ui.showMainMenu();
206
+ switch (action) {
207
+ case 'test':
208
+ await this.testConnections();
209
+ break;
210
+ case 'list-budgets':
211
+ await this.listAvailableBudgets();
212
+ break;
213
+ case 'configure':
214
+ await this.configureAccountMappings();
215
+ break;
216
+ case 'show':
217
+ await this.showCurrentMappings();
218
+ break;
219
+ case 'import':
220
+ await this.importTransactions();
221
+ break;
222
+ case 'reconfigure':
223
+ await this.reconfigureCredentials();
224
+ break;
225
+ case 'exit':
226
+ console.log(chalk_1.default.blue('\n👋 Goodbye!\n'));
227
+ await this.abClient.shutdown();
228
+ process.exit(0);
229
+ }
230
+ }
231
+ }
232
+ }
233
+ exports.LunchFlowImporter = LunchFlowImporter;
234
+ //# sourceMappingURL=importer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"importer.js","sourceRoot":"","sources":["../src/importer.ts"],"names":[],"mappings":";;;;;;AAAA,2DAAsD;AACtD,iEAA4D;AAC5D,6DAAyD;AACzD,qDAAiD;AACjD,6BAAkC;AAElC,kDAA0B;AAC1B,4DAA+B;AAE/B,MAAa,iBAAiB;IAO5B;QAFQ,WAAM,GAAkB,IAAI,CAAC;QAGnC,IAAI,CAAC,aAAa,GAAG,IAAI,8BAAa,EAAE,CAAC;QACzC,IAAI,CAAC,EAAE,GAAG,IAAI,eAAU,EAAE,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC;QAE9C,gFAAgF;QAChF,IAAI,CAAC,QAAQ,GAAG,IAAI,mCAAe,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAC5C,IAAI,CAAC,QAAQ,GAAG,IAAI,yCAAkB,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IACjD,CAAC;IAED,KAAK,CAAC,UAAU;QACd,MAAM,IAAI,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC;QAE5B,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE,EAAE,CAAC;YACvD,OAAO,CAAC,GAAG,CAAC,2DAA2D,CAAC,CAAC;YACzE,MAAM,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAClC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,aAAa,EAAE,CAAC;YACrB,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC,CAAC;QACxD,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,kBAAkB;QAC9B,MAAM,OAAO,GAAG,MAA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OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC;oBAC3C,MAAM,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;oBAC/B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACpB,CAAC;QACH,CAAC;IACH,CAAC;CACF;AA7QD,8CA6QC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import 'dotenv/config';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,eAAe,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ require("dotenv/config");
8
+ const chalk_1 = __importDefault(require("chalk"));
9
+ const importer_1 = require("./importer");
10
+ async function main() {
11
+ try {
12
+ const importer = new importer_1.LunchFlowImporter();
13
+ await importer.run();
14
+ }
15
+ catch (error) {
16
+ console.error(chalk_1.default.red('An error occurred:'), error);
17
+ process.exit(1);
18
+ }
19
+ }
20
+ // Handle uncaught exceptions
21
+ process.on('uncaughtException', (error) => {
22
+ console.error(chalk_1.default.red('Uncaught Exception:'), error);
23
+ process.exit(1);
24
+ });
25
+ process.on('unhandledRejection', (reason, promise) => {
26
+ console.error(chalk_1.default.red('Unhandled Rejection at:'), promise, 'reason:', reason);
27
+ process.exit(1);
28
+ });
29
+ main();
30
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAEA,yBAAuB;AACvB,kDAA0B;AAC1B,yCAA+C;AAE/C,KAAK,UAAU,IAAI;IACjB,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,IAAI,4BAAiB,EAAE,CAAC;QACzC,MAAM,QAAQ,CAAC,GAAG,EAAE,CAAC;IACvB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,oBAAoB,CAAC,EAAE,KAAK,CAAC,CAAC;QACtD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,6BAA6B;AAC7B,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,KAAK,EAAE,EAAE;IACxC,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,qBAAqB,CAAC,EAAE,KAAK,CAAC,CAAC;IACvD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE;IACnD,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,yBAAyB,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IAChF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,IAAI,EAAE,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { LunchFlowTransaction, LunchFlowAccount, LunchFlowAccountId } from './types';
2
+ export declare class LunchFlowClient {
3
+ private client;
4
+ private apiKey;
5
+ constructor(apiKey: string, baseUrl?: string);
6
+ testConnection(): Promise<boolean>;
7
+ getAccounts(): Promise<LunchFlowAccount[]>;
8
+ getTransactions(accountId: LunchFlowAccountId): Promise<LunchFlowTransaction[]>;
9
+ }
10
+ //# sourceMappingURL=lunch-flow-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lunch-flow-client.d.ts","sourceRoot":"","sources":["../src/lunch-flow-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAErF,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,MAAoC;IAYnE,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC;IAWlC,WAAW,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAiB1C,eAAe,CAAC,SAAS,EAAE,kBAAkB,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC;CAgBtF"}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.LunchFlowClient = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ class LunchFlowClient {
9
+ constructor(apiKey, baseUrl = 'https://api.lunchflow.com') {
10
+ this.apiKey = apiKey;
11
+ this.client = axios_1.default.create({
12
+ baseURL: baseUrl,
13
+ headers: {
14
+ 'x-api-key': apiKey,
15
+ 'Content-Type': 'application/json',
16
+ },
17
+ timeout: 10000,
18
+ });
19
+ }
20
+ async testConnection() {
21
+ try {
22
+ // Try to get accounts as a health check
23
+ const response = await this.client.get('/accounts');
24
+ return response.status === 200;
25
+ }
26
+ catch (error) {
27
+ console.error('Lunch Flow connection test failed:', error.message);
28
+ return false;
29
+ }
30
+ }
31
+ async getAccounts() {
32
+ try {
33
+ const response = await this.client.get('/accounts');
34
+ // Handle different possible response structures
35
+ if (Array.isArray(response.data.accounts)) {
36
+ return response.data.accounts;
37
+ }
38
+ else {
39
+ console.warn('Unexpected response structure from Lunch Flow accounts endpoint');
40
+ return [];
41
+ }
42
+ }
43
+ catch (error) {
44
+ console.error('Failed to fetch Lunch Flow accounts:', error.message);
45
+ throw new Error(`Failed to fetch accounts: ${error.message}`);
46
+ }
47
+ }
48
+ async getTransactions(accountId) {
49
+ try {
50
+ const response = await this.client.get(`/accounts/${accountId}/transactions`);
51
+ // Handle different possible response structures
52
+ if (Array.isArray(response.data.transactions)) {
53
+ return response.data.transactions;
54
+ }
55
+ else {
56
+ console.warn('Unexpected response structure from Lunch Flow transactions endpoint');
57
+ return [];
58
+ }
59
+ }
60
+ catch (error) {
61
+ console.error('Failed to fetch Lunch Flow transactions:', error.message);
62
+ throw new Error(`Failed to fetch transactions: ${error.message}`);
63
+ }
64
+ }
65
+ }
66
+ exports.LunchFlowClient = LunchFlowClient;
67
+ //# sourceMappingURL=lunch-flow-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lunch-flow-client.js","sourceRoot":"","sources":["../src/lunch-flow-client.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA6C;AAG7C,MAAa,eAAe;IAI1B,YAAY,MAAc,EAAE,UAAkB,2BAA2B;QACvE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,eAAK,CAAC,MAAM,CAAC;YACzB,OAAO,EAAE,OAAO;YAChB,OAAO,EAAE;gBACP,WAAW,EAAE,MAAM;gBACnB,cAAc,EAAE,kBAAkB;aACnC;YACD,OAAO,EAAE,KAAK;SACf,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,cAAc;QAClB,IAAI,CAAC;YACH,wCAAwC;YACxC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YACpD,OAAO,QAAQ,CAAC,MAAM,KAAK,GAAG,CAAC;QACjC,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,oCAAoC,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;YACnE,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,KAAK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5DD,0CA4DC"}
@@ -0,0 +1,8 @@
1
+ import { LunchFlowTransaction, ActualBudgetTransaction, AccountMapping } from './types';
2
+ export declare class TransactionMapper {
3
+ private accountMappings;
4
+ constructor(accountMappings: AccountMapping[]);
5
+ mapTransaction(lfTransaction: LunchFlowTransaction): ActualBudgetTransaction | null;
6
+ mapTransactions(lfTransactions: LunchFlowTransaction[]): ActualBudgetTransaction[];
7
+ }
8
+ //# sourceMappingURL=transaction-mapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction-mapper.d.ts","sourceRoot":"","sources":["../src/transaction-mapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAExF,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,eAAe,CAAmB;gBAE9B,eAAe,EAAE,cAAc,EAAE;IAI7C,cAAc,CAAC,aAAa,EAAE,oBAAoB,GAAG,uBAAuB,GAAG,IAAI;IAsBnF,eAAe,CAAC,cAAc,EAAE,oBAAoB,EAAE,GAAG,uBAAuB,EAAE;CAKnF"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TransactionMapper = void 0;
4
+ class TransactionMapper {
5
+ constructor(accountMappings) {
6
+ this.accountMappings = accountMappings;
7
+ }
8
+ mapTransaction(lfTransaction) {
9
+ const mapping = this.accountMappings.find(m => m.lunchFlowAccountId === lfTransaction.accountId);
10
+ if (!mapping) {
11
+ console.warn(`No mapping found for Lunch Flow account ${lfTransaction.accountId}`);
12
+ return null;
13
+ }
14
+ return {
15
+ date: lfTransaction.date,
16
+ // Forcing to fixed point integer to avoid floating point precision issues
17
+ amount: parseInt((lfTransaction.amount * 100).toFixed(0)),
18
+ imported_payee: lfTransaction.merchant,
19
+ account: mapping.actualBudgetAccountId,
20
+ cleared: true, // Lunch Flow transactions are always cleared
21
+ notes: lfTransaction.description,
22
+ imported_id: `lf_${lfTransaction.id}`,
23
+ };
24
+ }
25
+ mapTransactions(lfTransactions) {
26
+ return lfTransactions
27
+ .map(t => this.mapTransaction(t))
28
+ .filter((t) => t !== null);
29
+ }
30
+ }
31
+ exports.TransactionMapper = TransactionMapper;
32
+ //# sourceMappingURL=transaction-mapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction-mapper.js","sourceRoot":"","sources":["../src/transaction-mapper.ts"],"names":[],"mappings":";;;AAEA,MAAa,iBAAiB;IAG5B,YAAY,eAAiC;QAC3C,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IACzC,CAAC;IAED,cAAc,CAAC,aAAmC;QAChD,MAAM,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,CACvC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,kBAAkB,KAAK,aAAa,CAAC,SAAS,CACtD,CAAC;QAEF,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,CAAC,IAAI,CAAC,2CAA2C,aAAa,CAAC,SAAS,EAAE,CAAC,CAAC;YACnF,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO;YACL,IAAI,EAAE,aAAa,CAAC,IAAI;YACxB,0EAA0E;YAC1E,MAAM,EAAE,QAAQ,CAAC,CAAC,aAAa,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACzD,cAAc,EAAE,aAAa,CAAC,QAAQ;YACtC,OAAO,EAAE,OAAO,CAAC,qBAAqB;YACtC,OAAO,EAAE,IAAI,EAAE,6CAA6C;YAC5D,KAAK,EAAE,aAAa,CAAC,WAAW;YAChC,WAAW,EAAE,MAAM,aAAa,CAAC,EAAE,EAAE;SACtC,CAAC;IACJ,CAAC;IAED,eAAe,CAAC,cAAsC;QACpD,OAAO,cAAc;aAClB,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;aAChC,MAAM,CAAC,CAAC,CAAC,EAAgC,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;IAC7D,CAAC;CACF;AAlCD,8CAkCC"}
@@ -0,0 +1,55 @@
1
+ export type LunchFlowAccountId = number;
2
+ export interface LunchFlowTransaction {
3
+ id: string;
4
+ accountId: LunchFlowAccountId;
5
+ date: string;
6
+ amount: number;
7
+ currency: string;
8
+ merchant: string;
9
+ description: string;
10
+ }
11
+ export interface LunchFlowAccount {
12
+ id: LunchFlowAccountId;
13
+ name: string;
14
+ institution_name: string;
15
+ }
16
+ export interface ActualBudgetTransaction {
17
+ id?: string;
18
+ date: string;
19
+ amount: number;
20
+ imported_payee: string;
21
+ account: string;
22
+ cleared?: boolean;
23
+ notes?: string;
24
+ imported_id?: string;
25
+ }
26
+ export interface ActualBudgetAccount {
27
+ id: string;
28
+ name: string;
29
+ type: 'checking' | 'savings' | 'credit' | 'investment' | 'other';
30
+ balance: number;
31
+ currency: string;
32
+ }
33
+ export interface AccountMapping {
34
+ lunchFlowAccountId: LunchFlowAccountId;
35
+ lunchFlowAccountName: string;
36
+ actualBudgetAccountId: string;
37
+ actualBudgetAccountName: string;
38
+ }
39
+ export interface Config {
40
+ lunchFlow: {
41
+ apiKey: string;
42
+ baseUrl: string;
43
+ };
44
+ actualBudget: {
45
+ serverUrl: string;
46
+ budgetSyncId: string;
47
+ password?: string;
48
+ };
49
+ accountMappings: AccountMapping[];
50
+ }
51
+ export interface ConnectionStatus {
52
+ lunchFlow: boolean;
53
+ actualBudget: boolean;
54
+ }
55
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC;AACxC,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,kBAAkB,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb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gBAAgB;IAC/B,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;CACvB"}
package/dist/types.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/dist/ui.d.ts ADDED
@@ -0,0 +1,30 @@
1
+ import { LunchFlowAccount, ActualBudgetAccount, AccountMapping, ConnectionStatus, ActualBudgetTransaction } from './types';
2
+ export declare class TerminalUI {
3
+ showWelcome(): Promise<void>;
4
+ getLunchFlowCredentials(): Promise<{
5
+ apiKey: string;
6
+ baseUrl: string;
7
+ }>;
8
+ getActualBudgetCredentials(): Promise<{
9
+ serverUrl: string;
10
+ budgetSyncId: string;
11
+ password?: string;
12
+ }>;
13
+ showConnectionStatus(status: ConnectionStatus): Promise<void>;
14
+ showAccountsTable(accounts: (LunchFlowAccount | ActualBudgetAccount)[], title: string): Promise<void>;
15
+ configureAccountMappings(lfAccounts: LunchFlowAccount[], abAccounts: ActualBudgetAccount[]): Promise<AccountMapping[]>;
16
+ showAccountMappings(mappings: AccountMapping[]): Promise<void>;
17
+ confirmImport(transactionCount: number, dateRange: {
18
+ startDate: string;
19
+ endDate: string;
20
+ }): Promise<boolean>;
21
+ showMainMenu(): Promise<string>;
22
+ showReconfigureMenu(): Promise<string>;
23
+ showSpinner(message: string): any;
24
+ showSuccess(message: string): void;
25
+ showError(message: string): void;
26
+ showInfo(message: string): void;
27
+ showWarning(message: string): void;
28
+ showTransactionPreview(transactions: ActualBudgetTransaction[], accounts: ActualBudgetAccount[], count?: number): Promise<void>;
29
+ }
30
+ //# sourceMappingURL=ui.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,E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