israeli-banks-actual-budget-importer 1.7.4 → 1.7.6
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 +14 -0
- package/package.json +1 -1
- package/src/utils.ts +10 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [1.7.6](https://github.com/tomerh2001/israeli-banks-actual-budget-importer/compare/v1.7.5...v1.7.6) (2025-12-04)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* update transaction scraping start date to two years ago for improved data accuracy ([a08e3e6](https://github.com/tomerh2001/israeli-banks-actual-budget-importer/commit/a08e3e699650844ed1015879355bdd9d157e2c60))
|
|
7
|
+
|
|
8
|
+
## [1.7.5](https://github.com/tomerh2001/israeli-banks-actual-budget-importer/compare/v1.7.4...v1.7.5) (2025-12-04)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* optimize reconciliation logic to skip unnecessary updates when balances are in sync ([5153911](https://github.com/tomerh2001/israeli-banks-actual-budget-importer/commit/515391177d37e5ef0577ab5a306317e21bf990e4))
|
|
14
|
+
|
|
1
15
|
## [1.7.4](https://github.com/tomerh2001/israeli-banks-actual-budget-importer/compare/v1.7.3...v1.7.4) (2025-12-04)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
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(
|
|
23
|
+
startDate: moment().subtract(2, 'years').toDate(),
|
|
24
24
|
// ExecutablePath: '/opt/homebrew/bin/chromium',
|
|
25
25
|
args: ['--user-data-dir=./chrome-data'],
|
|
26
26
|
additionalTransactionInformation: true,
|
|
@@ -91,11 +91,11 @@ export async function scrapeAndImportTransactions({companyId, bank}: ScrapeTrans
|
|
|
91
91
|
|
|
92
92
|
const existingReconciliation = allAccountTxns.find(txn => txn.imported_id === reconciliationImportedId);
|
|
93
93
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
94
|
+
// If balances are already in sync, no need to create/update reconciliation.
|
|
95
|
+
if (existingReconciliation && balanceDiff === 0) {
|
|
96
|
+
log('RECONCILIATION_NOT_NEEDED');
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
99
|
|
|
100
100
|
const reconciliationTxn = {
|
|
101
101
|
account: bank.actualAccountId,
|
|
@@ -107,28 +107,24 @@ export async function scrapeAndImportTransactions({companyId, bank}: ScrapeTrans
|
|
|
107
107
|
imported_id: reconciliationImportedId,
|
|
108
108
|
};
|
|
109
109
|
|
|
110
|
-
stdout.mute();
|
|
111
110
|
if (existingReconciliation) {
|
|
112
|
-
// Update the single reconciliation transaction
|
|
113
111
|
stdout.mute();
|
|
114
112
|
await actual.updateTransaction(existingReconciliation.id, reconciliationTxn);
|
|
115
113
|
stdout.unmute();
|
|
116
|
-
log('RECONCILIATION_UPDATED', {transactionId: existingReconciliation.id});
|
|
117
114
|
|
|
115
|
+
log('RECONCILIATION_UPDATED', {from: currentBalance, to: accountBalance, diff: balanceDiff});
|
|
118
116
|
return;
|
|
119
117
|
}
|
|
120
118
|
|
|
121
119
|
// Create the reconciliation transaction for the first time
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
[reconciliationTxn],
|
|
125
|
-
);
|
|
120
|
+
stdout.mute();
|
|
121
|
+
const reconciliationResult = await actual.importTransactions(bank.actualAccountId, [reconciliationTxn]);
|
|
126
122
|
stdout.unmute();
|
|
127
123
|
|
|
128
124
|
if (!reconciliationResult || _.isEmpty(reconciliationResult.added)) {
|
|
129
125
|
console.error('Reconciliation errors', reconciliationResult?.errors);
|
|
130
126
|
} else {
|
|
131
|
-
log('RECONCILIATION_ADDED', {
|
|
127
|
+
log('RECONCILIATION_ADDED', {from: currentBalance, to: accountBalance, diff: balanceDiff});
|
|
132
128
|
}
|
|
133
129
|
} catch (error) {
|
|
134
130
|
console.error('Error', companyId, error);
|