israeli-banks-actual-budget-importer 1.7.3 → 1.7.5

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.5](https://github.com/tomerh2001/israeli-banks-actual-budget-importer/compare/v1.7.4...v1.7.5) (2025-12-04)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * optimize reconciliation logic to skip unnecessary updates when balances are in sync ([5153911](https://github.com/tomerh2001/israeli-banks-actual-budget-importer/commit/515391177d37e5ef0577ab5a306317e21bf990e4))
7
+
8
+ ## [1.7.4](https://github.com/tomerh2001/israeli-banks-actual-budget-importer/compare/v1.7.3...v1.7.4) (2025-12-04)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * remove unnecessary reconciliation removal logic when balances are in sync ([0fcc569](https://github.com/tomerh2001/israeli-banks-actual-budget-importer/commit/0fcc56977394265502dd871bc0973a05e614fffe))
14
+
1
15
  ## [1.7.3](https://github.com/tomerh2001/israeli-banks-actual-budget-importer/compare/v1.7.2...v1.7.3) (2025-12-04)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.7.3",
2
+ "version": "1.7.5",
3
3
  "name": "israeli-banks-actual-budget-importer",
4
4
  "module": "index.ts",
5
5
  "type": "module",
package/src/utils.ts CHANGED
@@ -91,19 +91,9 @@ export async function scrapeAndImportTransactions({companyId, bank}: ScrapeTrans
91
91
 
92
92
  const existingReconciliation = allAccountTxns.find(txn => txn.imported_id === reconciliationImportedId);
93
93
 
94
- log('RECONCILIATION', {
95
- from: currentBalance,
96
- to: accountBalance,
97
- diff: balanceDiff,
98
- });
99
-
100
- // If balances are already in sync, remove any existing reconciliation and exit.
94
+ // If balances are already in sync, no need to create/update reconciliation.
101
95
  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
-
96
+ log('RECONCILIATION_NOT_NEEDED');
107
97
  return;
108
98
  }
109
99
 
@@ -117,28 +107,24 @@ export async function scrapeAndImportTransactions({companyId, bank}: ScrapeTrans
117
107
  imported_id: reconciliationImportedId,
118
108
  };
119
109
 
120
- stdout.mute();
121
110
  if (existingReconciliation) {
122
- // Update the single reconciliation transaction
123
111
  stdout.mute();
124
112
  await actual.updateTransaction(existingReconciliation.id, reconciliationTxn);
125
113
  stdout.unmute();
126
- log('RECONCILIATION_UPDATED', {transactionId: existingReconciliation.id});
127
114
 
115
+ log('RECONCILIATION_UPDATED', {from: currentBalance, to: accountBalance, diff: balanceDiff});
128
116
  return;
129
117
  }
130
118
 
131
119
  // Create the reconciliation transaction for the first time
132
- const reconciliationResult = await actual.importTransactions(
133
- bank.actualAccountId,
134
- [reconciliationTxn],
135
- );
120
+ stdout.mute();
121
+ const reconciliationResult = await actual.importTransactions(bank.actualAccountId, [reconciliationTxn]);
136
122
  stdout.unmute();
137
123
 
138
124
  if (!reconciliationResult || _.isEmpty(reconciliationResult.added)) {
139
125
  console.error('Reconciliation errors', reconciliationResult?.errors);
140
126
  } else {
141
- log('RECONCILIATION_ADDED', {transactions: reconciliationResult.added.length});
127
+ log('RECONCILIATION_ADDED', {from: currentBalance, to: accountBalance, diff: balanceDiff});
142
128
  }
143
129
  } catch (error) {
144
130
  console.error('Error', companyId, error);