@actual-app/sync-server 25.11.0-nightly.20251018 → 25.11.0-nightly.20251020
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/README.md +1 -1
- package/build/src/app-gocardless/app-gocardless.js +3 -4
- package/build/src/app-gocardless/banks/integration-bank.js +0 -6
- package/build/src/app-gocardless/banks/tests/integration_bank.spec.js +17 -39
- package/build/src/app-gocardless/util/handle-error.js +1 -2
- package/build/src/app-simplefin/app-simplefin.js +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ Want to say thanks? Click the ⭐ at the top of the page.
|
|
|
10
10
|
|
|
11
11
|
### Using the CLI tool
|
|
12
12
|
|
|
13
|
-
Node.js
|
|
13
|
+
Node.js v22 or higher is required for the @actual-app/sync-server npm package
|
|
14
14
|
|
|
15
15
|
**Install globally with npm:**
|
|
16
16
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
|
-
import { inspect } from 'util';
|
|
3
2
|
import { isAxiosError } from 'axios';
|
|
4
3
|
import express from 'express';
|
|
5
4
|
import { sha256String } from '../util/hash.js';
|
|
@@ -167,21 +166,21 @@ app.post('/transactions', handleError(async (req, res) => {
|
|
|
167
166
|
});
|
|
168
167
|
break;
|
|
169
168
|
case error instanceof GenericGoCardlessError:
|
|
170
|
-
console.log('Something went wrong',
|
|
169
|
+
console.log('Something went wrong', error.message);
|
|
171
170
|
sendErrorResponse({
|
|
172
171
|
error_type: 'SYNC_ERROR',
|
|
173
172
|
error_code: 'NORDIGEN_ERROR',
|
|
174
173
|
});
|
|
175
174
|
break;
|
|
176
175
|
case isAxiosError(error):
|
|
177
|
-
console.log('Something went wrong',
|
|
176
|
+
console.log('Something went wrong', error.message, error.response?.data?.summary || error.response?.data?.detail || '');
|
|
178
177
|
sendErrorResponse({
|
|
179
178
|
error_type: 'SYNC_ERROR',
|
|
180
179
|
error_code: 'NORDIGEN_ERROR',
|
|
181
180
|
});
|
|
182
181
|
break;
|
|
183
182
|
default:
|
|
184
|
-
console.log('Something went wrong',
|
|
183
|
+
console.log('Something went wrong', error.message || String(error));
|
|
185
184
|
sendErrorResponse({
|
|
186
185
|
error_type: 'UNKNOWN',
|
|
187
186
|
error_code: 'UNKNOWN',
|
|
@@ -14,7 +14,6 @@ const SORTED_BALANCE_TYPE_LIST = [
|
|
|
14
14
|
export default {
|
|
15
15
|
institutionIds: ['IntegrationBank'],
|
|
16
16
|
normalizeAccount(account) {
|
|
17
|
-
console.debug('Available account properties for new institution integration', { account: JSON.stringify(account) });
|
|
18
17
|
return {
|
|
19
18
|
account_id: account.id,
|
|
20
19
|
institution: account.institution,
|
|
@@ -59,14 +58,9 @@ export default {
|
|
|
59
58
|
};
|
|
60
59
|
},
|
|
61
60
|
sortTransactions(transactions = []) {
|
|
62
|
-
console.debug('Available (first 10) transactions properties for new integration of institution in sortTransactions function', { top10Transactions: JSON.stringify(transactions.slice(0, 10)) });
|
|
63
61
|
return sortByBookingDateOrValueDate(transactions);
|
|
64
62
|
},
|
|
65
63
|
calculateStartingBalance(sortedTransactions = [], balances = []) {
|
|
66
|
-
console.debug('Available (first 10) transactions properties for new integration of institution in calculateStartingBalance function', {
|
|
67
|
-
balances: JSON.stringify(balances),
|
|
68
|
-
top10SortedTransactions: JSON.stringify(sortedTransactions.slice(0, 10)),
|
|
69
|
-
});
|
|
70
64
|
const currentBalance = balances
|
|
71
65
|
.filter(item => SORTED_BALANCE_TYPE_LIST.includes(item.balanceType))
|
|
72
66
|
.sort((a, b) => SORTED_BALANCE_TYPE_LIST.indexOf(a.balanceType) -
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { mockExtendAccountsAboutInstitutions, mockInstitution, } from '../../services/tests/fixtures.js';
|
|
2
2
|
import IntegrationBank from '../integration-bank.js';
|
|
3
3
|
describe('IntegrationBank', () => {
|
|
4
|
-
let consoleSpy;
|
|
5
|
-
beforeEach(() => {
|
|
6
|
-
consoleSpy = vi.spyOn(console, 'debug');
|
|
7
|
-
});
|
|
8
4
|
describe('normalizeAccount', () => {
|
|
9
5
|
const account = mockExtendAccountsAboutInstitutions[0];
|
|
10
6
|
it('should return a normalized account object', () => {
|
|
@@ -34,12 +30,6 @@ describe('IntegrationBank', () => {
|
|
|
34
30
|
type: 'checking',
|
|
35
31
|
});
|
|
36
32
|
});
|
|
37
|
-
it('normalizeAccount logs available account properties', () => {
|
|
38
|
-
IntegrationBank.normalizeAccount(account);
|
|
39
|
-
expect(consoleSpy).toHaveBeenCalledWith('Available account properties for new institution integration', {
|
|
40
|
-
account: JSON.stringify(account),
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
33
|
});
|
|
44
34
|
describe('sortTransactions', () => {
|
|
45
35
|
const transactions = [
|
|
@@ -59,30 +49,25 @@ describe('IntegrationBank', () => {
|
|
|
59
49
|
transactionAmount: { amount: '100', currency: 'EUR' },
|
|
60
50
|
},
|
|
61
51
|
];
|
|
62
|
-
const sortedTransactions = [
|
|
63
|
-
{
|
|
64
|
-
date: '2022-01-03',
|
|
65
|
-
bookingDate: '2022-01-03',
|
|
66
|
-
transactionAmount: { amount: '100', currency: 'EUR' },
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
date: '2022-01-02',
|
|
70
|
-
bookingDate: '2022-01-02',
|
|
71
|
-
transactionAmount: { amount: '100', currency: 'EUR' },
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
date: '2022-01-01',
|
|
75
|
-
bookingDate: '2022-01-01',
|
|
76
|
-
transactionAmount: { amount: '100', currency: 'EUR' },
|
|
77
|
-
},
|
|
78
|
-
];
|
|
79
52
|
it('should return transactions sorted by bookingDate', () => {
|
|
80
53
|
const sortedTransactions = IntegrationBank.sortTransactions(transactions);
|
|
81
|
-
expect(sortedTransactions).toEqual(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
54
|
+
expect(sortedTransactions).toEqual([
|
|
55
|
+
{
|
|
56
|
+
date: '2022-01-03',
|
|
57
|
+
bookingDate: '2022-01-03',
|
|
58
|
+
transactionAmount: { amount: '100', currency: 'EUR' },
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
date: '2022-01-02',
|
|
62
|
+
bookingDate: '2022-01-02',
|
|
63
|
+
transactionAmount: { amount: '100', currency: 'EUR' },
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
date: '2022-01-01',
|
|
67
|
+
bookingDate: '2022-01-01',
|
|
68
|
+
transactionAmount: { amount: '100', currency: 'EUR' },
|
|
69
|
+
},
|
|
70
|
+
]);
|
|
86
71
|
});
|
|
87
72
|
});
|
|
88
73
|
describe('calculateStartingBalance', () => {
|
|
@@ -116,12 +101,5 @@ describe('IntegrationBank', () => {
|
|
|
116
101
|
const startingBalance = IntegrationBank.calculateStartingBalance(transactions, balances);
|
|
117
102
|
expect(startingBalance).toEqual(70000);
|
|
118
103
|
});
|
|
119
|
-
it('logs available transactions and balances properties', () => {
|
|
120
|
-
IntegrationBank.calculateStartingBalance(transactions, balances);
|
|
121
|
-
expect(consoleSpy).toHaveBeenCalledWith('Available (first 10) transactions properties for new integration of institution in calculateStartingBalance function', {
|
|
122
|
-
balances: JSON.stringify(balances),
|
|
123
|
-
top10SortedTransactions: JSON.stringify(transactions.slice(0, 10)),
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
104
|
});
|
|
127
105
|
});
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { inspect } from 'util';
|
|
2
1
|
export function handleError(func) {
|
|
3
2
|
return (req, res) => {
|
|
4
3
|
func(req, res).catch(err => {
|
|
5
|
-
console.log('Error', req.originalUrl,
|
|
4
|
+
console.log('Error', req.originalUrl, err.message || String(err));
|
|
6
5
|
res.send({
|
|
7
6
|
status: 'ok',
|
|
8
7
|
data: {
|
|
@@ -242,7 +242,7 @@ function parseAccessKey(accessKey) {
|
|
|
242
242
|
let password = null;
|
|
243
243
|
let baseUrl = null;
|
|
244
244
|
if (!accessKey || !accessKey.match(/^.*\/\/.*:.*@.*$/)) {
|
|
245
|
-
console.log(
|
|
245
|
+
console.log('Invalid SimpleFIN access key');
|
|
246
246
|
throw new Error(`Invalid access key`);
|
|
247
247
|
}
|
|
248
248
|
[scheme, rest] = accessKey.split('//');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@actual-app/sync-server",
|
|
3
|
-
"version": "25.11.0-nightly.
|
|
3
|
+
"version": "25.11.0-nightly.20251020",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "actual syncing server",
|
|
6
6
|
"bin": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@actual-app/crdt": "2.1.0",
|
|
31
|
-
"@actual-app/web": "25.11.0-nightly.
|
|
31
|
+
"@actual-app/web": "25.11.0-nightly.20251020",
|
|
32
32
|
"bcrypt": "^6.0.0",
|
|
33
33
|
"better-sqlite3": "^12.4.1",
|
|
34
34
|
"convict": "^6.2.4",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@types/cors": "^2.8.19",
|
|
58
58
|
"@types/express": "^5.0.3",
|
|
59
59
|
"@types/express-actuator": "^1.8.3",
|
|
60
|
-
"@types/node": "^22.18.
|
|
60
|
+
"@types/node": "^22.18.11",
|
|
61
61
|
"@types/supertest": "^6.0.3",
|
|
62
62
|
"@vitest/coverage-v8": "3.2.4",
|
|
63
63
|
"http-proxy-middleware": "^3.0.5",
|