israeli-banks-actual-budget-importer 1.7.0 → 1.7.2

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [1.7.2](https://github.com/tomerh2001/israeli-banks-actual-budget-importer/compare/v1.7.1...v1.7.2) (2025-12-04)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * improve reconciliation logic to log transaction removal when balances are in sync ([c2f3fba](https://github.com/tomerh2001/israeli-banks-actual-budget-importer/commit/c2f3fba73588fb1591ddfcc92cb0e2b0fe9a54f5))
7
+
8
+ ## [1.7.1](https://github.com/tomerh2001/israeli-banks-actual-budget-importer/compare/v1.7.0...v1.7.1) (2025-12-04)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * extend transaction scraping period to 12 months and remove debug logs ([bcfccd8](https://github.com/tomerh2001/israeli-banks-actual-budget-importer/commit/bcfccd8215af67ca1ca714b3677d55ad13c655d6))
14
+
1
15
  # [1.7.0](https://github.com/tomerh2001/israeli-banks-actual-budget-importer/compare/v1.6.1...v1.7.0) (2025-12-04)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.7.0",
2
+ "version": "1.7.2",
3
3
  "name": "israeli-banks-actual-budget-importer",
4
4
  "module": "index.ts",
5
5
  "type": "module",
package/src/utils.ts CHANGED
@@ -20,7 +20,7 @@ export async function scrapeAndImportTransactions({companyId, bank}: ScrapeTrans
20
20
  try {
21
21
  const scraper = createScraper({
22
22
  companyId,
23
- startDate: moment().subtract(6, 'month').toDate(),
23
+ startDate: moment().subtract(12, 'month').toDate(),
24
24
  // ExecutablePath: '/opt/homebrew/bin/chromium',
25
25
  args: ['--user-data-dir=./chrome-data'],
26
26
  additionalTransactionInformation: true,
@@ -50,9 +50,6 @@ export async function scrapeAndImportTransactions({companyId, bank}: ScrapeTrans
50
50
  const accountBalance = result.accounts![0].balance!;
51
51
  const payees: PayeeEntity[] = await actual.getPayees();
52
52
 
53
- // Print first 5 scraped transactions for debugging
54
- log('SCRAPED_TRANSACTIONS_SAMPLE', {sample: transactions.slice(0, 5)});
55
-
56
53
  const mappedTransactions = transactions.map(async x => ({
57
54
  date: moment(x.date).format('YYYY-MM-DD'),
58
55
  amount: actual.utils.amountToInteger(x.chargedAmount),
@@ -62,9 +59,6 @@ export async function scrapeAndImportTransactions({companyId, bank}: ScrapeTrans
62
59
  imported_id: `${x.identifier}-${moment(x.date).format('YYYY-MM-DD HH:mm:ss')}`,
63
60
  }));
64
61
 
65
- // Print first 5 mapped transactions for debugging
66
- log('MAPPED_TRANSACTIONS_SAMPLE', {sample: await Promise.all(mappedTransactions.slice(0, 5))});
67
-
68
62
  stdout.mute();
69
63
  const importResult = await actual.importTransactions(bank.actualAccountId, await Promise.all(mappedTransactions), {defaultCleared: true});
70
64
  stdout.unmute();
@@ -97,24 +91,22 @@ export async function scrapeAndImportTransactions({companyId, bank}: ScrapeTrans
97
91
 
98
92
  const existingReconciliation = allAccountTxns.find(txn => txn.imported_id === reconciliationImportedId);
99
93
 
100
- // If balances are already in sync, remove any existing reconciliation and exit.
101
- if (balanceDiff === 0) {
102
- if (existingReconciliation) {
103
- stdout.mute();
104
- await actual.deleteTransaction(existingReconciliation.id);
105
- stdout.unmute();
106
- log('RECONCILIATION_REMOVED');
107
- }
108
-
109
- return;
110
- }
111
-
112
94
  log('RECONCILIATION', {
113
95
  from: currentBalance,
114
96
  to: accountBalance,
115
97
  diff: balanceDiff,
116
98
  });
117
99
 
100
+ // If balances are already in sync, remove any existing reconciliation and exit.
101
+ if (existingReconciliation && balanceDiff === 0) {
102
+ stdout.mute();
103
+ await actual.deleteTransaction(existingReconciliation.id);
104
+ stdout.unmute();
105
+ log(`RECONCILIATION_REMOVED, since ${currentBalance.toLocaleString()} === ${accountBalance.toLocaleString()}`, {transactionId: existingReconciliation.id});
106
+
107
+ return;
108
+ }
109
+
118
110
  const reconciliationTxn = {
119
111
  account: bank.actualAccountId,
120
112
  date: moment().format('YYYY-MM-DD'),