A local-first personal finance app
feedback (#5)
Michael Clark7faecf42730c
diff --git a/packages/sync-server/.editorconfig b/packages/sync-server/.editorconfigdeleted file mode 100644index 551e30b920..0000000000--- a/packages/sync-server/.editorconfig+++ /dev/null@@ -1,11 +0,0 @@-# https://editorconfig.org--root = true--[*]-charset = utf-8-end_of_line = lf-indent_size = 2-indent_style = space-insert_final_newline = true-trim_trailing_whitespace = truediff --git a/packages/sync-server/.eslintignore b/packages/sync-server/.eslintignoredeleted file mode 100644index f4572de01e..0000000000--- a/packages/sync-server/.eslintignore+++ /dev/null@@ -1,6 +0,0 @@-**/node_modules/*-**/log/*-**/shared/*-/build--supervisediff --git a/packages/sync-server/.eslintrc.cjs b/packages/sync-server/.eslintrc.cjsdeleted file mode 100644index c553853020..0000000000--- a/packages/sync-server/.eslintrc.cjs+++ /dev/null@@ -1,21 +0,0 @@-module.exports = {- root: true,- env: {- browser: true,- amd: true,- node: true,- jest: true- },- parser: '@typescript-eslint/parser',- plugins: ['@typescript-eslint', 'prettier'],- extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],- rules: {- 'prettier/prettier': 'error',- '@typescript-eslint/no-unused-vars': [- 'error',- {- argsIgnorePattern: '^_'- }- ]- }-};diff --git a/packages/sync-server/.node-version b/packages/sync-server/.node-versiondeleted file mode 100644index e6db45a907..0000000000--- a/packages/sync-server/.node-version+++ /dev/null@@ -1 +0,0 @@-18.14.0diff --git a/packages/sync-server/.prettierrc.json b/packages/sync-server/.prettierrc.jsondeleted file mode 100644index a20502b7f0..0000000000--- a/packages/sync-server/.prettierrc.json+++ /dev/null@@ -1,4 +0,0 @@-{- "singleQuote": true,- "trailingComma": "all"-}diff --git a/packages/sync-server/LICENSE.txt b/packages/sync-server/LICENSE.txtdeleted file mode 100644index 3898f370d3..0000000000--- a/packages/sync-server/LICENSE.txt+++ /dev/null@@ -1,7 +0,0 @@-Copyright James Long--Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:--The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.--THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.diff --git a/packages/sync-server/README.md b/packages/sync-server/README.mdindex ea313f059d..4577c3b172 100644--- a/packages/sync-server/README.md+++ b/packages/sync-server/README.md@@ -1,22 +1,19 @@-> [!IMPORTANT]-> This repository was merged into [actualbudget/actual](https://github.com/actualbudget/actual/tree/master/packages/sync-server) in February 2025 and has been placed in a readonly state. For more information please visit our [Discord](https://discord.com/invite/pRYNYr4W5A).------This is the main project to run [Actual](https://github.com/actualbudget/actual), a local-first personal finance tool. It comes with the latest version of Actual, and a server to persist changes and make data available across all devices.### Getting Started+Actual is a local-first personal finance tool. It is 100% free and open-source, written in NodeJS, it has a synchronization element so that all your changes can move between devices without any heavy lifting.If you are interested in contributing, or want to know how development works, see our [contributing](https://actualbudget.org/docs/contributing/) document we would love to have you.Want to say thanks? Click the ⭐ at the top of the page.-### Documentation+### DocumentationWe have a wide range of documentation on how to use Actual. This is all available in our [Community Documentation](https://actualbudget.org/docs/), including topics on [installing](https://actualbudget.org/docs/install/), [Budgeting](https://actualbudget.org/docs/budgeting/), [Account Management](https://actualbudget.org/docs/accounts/), [Tips & Tricks](https://actualbudget.org/docs/getting-started/tips-tricks) and some documentation for developers.### Feature Requests+Current feature requests can be seen [here](https://github.com/actualbudget/actual/issues?q=is%3Aissue+label%3A%22needs+votes%22+sort%3Areactions-%2B1-desc). Vote for your favorite requests by reacting 👍 to the top comment of the request.To add new feature requests, open a new Issue of the "Feature Request" type.diff --git a/packages/sync-server/app.js b/packages/sync-server/app.jsindex d0647fb88f..e98462498c 100644--- a/packages/sync-server/app.js+++ b/packages/sync-server/app.js@@ -3,9 +3,9 @@ import runMigrations from './src/migrations.js';runMigrations().then(() => {//import the app here becasue initial migrations need to be run first - they are dependencies of the app.js- import('./src/app.js').then((app) => app.default()); // run the app+ import('./src/app.js').then(app => app.default()); // run the app})- .catch((err) => {+ .catch(err => {console.log('Error starting app:', err);process.exit(1);});diff --git a/packages/sync-server/docker-compose.yml b/packages/sync-server/docker-compose.ymlindex 376ecfa3af..43636aeb2a 100644--- a/packages/sync-server/docker-compose.yml+++ b/packages/sync-server/docker-compose.yml@@ -21,7 +21,7 @@ services:- ./actual-data:/datahealthcheck:# Enable health check for the instance- test: ["CMD-SHELL", "node src/scripts/health-check.js"]+ test: ['CMD-SHELL', 'node src/scripts/health-check.js']interval: 60stimeout: 10sretries: 3diff --git a/packages/sync-server/jest.config.json b/packages/sync-server/jest.config.jsonindex f33061a9d7..3f599c3d14 100644--- a/packages/sync-server/jest.config.json+++ b/packages/sync-server/jest.config.json@@ -7,7 +7,12 @@"testEnvironment": "node","collectCoverage": true,"collectCoverageFrom": ["**/*.{js,ts,tsx}"],- "coveragePathIgnorePatterns": ["dist", "/node_modules/", "/build/", "/coverage/"],+ "coveragePathIgnorePatterns": [+ "dist",+ "/node_modules/",+ "/build/",+ "/coverage/"+ ],"coverageReporters": ["html", "lcov", "text", "text-summary"],"resetMocks": true,"restoreMocks": truediff --git a/packages/sync-server/src/account-db.js b/packages/sync-server/src/account-db.jsindex 409f000991..1e2f22ac43 100644--- a/packages/sync-server/src/account-db.js+++ b/packages/sync-server/src/account-db.js@@ -25,7 +25,7 @@ export function needsBootstrap() {export function listLoginMethods() {let accountDb = getAccountDb();let rows = accountDb.all('SELECT method, display_name, active FROM auth');- return rows.map((r) => ({+ return rows.map(r => ({method: r.method,active: r.active,displayName: r.display_name,diff --git a/packages/sync-server/src/app-admin.js b/packages/sync-server/src/app-admin.jsindex f920a266be..97857d9db2 100644--- a/packages/sync-server/src/app-admin.js+++ b/packages/sync-server/src/app-admin.js@@ -28,7 +28,7 @@ app.get('/owner-created/', (req, res) => {app.get('/users/', validateSessionMiddleware, (req, res) => {const users = UserService.getAllUsers();res.json(- users.map((u) => ({+ users.map(u => ({...u,owner: u.owner === 1,enabled: u.enabled === 1,@@ -152,7 +152,7 @@ app.delete('/users', validateSessionMiddleware, async (req, res) => {const ids = req.body.ids;let totalDeleted = 0;- ids.forEach((item) => {+ ids.forEach(item => {const ownerId = UserService.getOwnerId();if (item === ownerId) return;diff --git a/packages/sync-server/src/app-admin.test.js b/packages/sync-server/src/app-admin.test.jsindex 29f22ec250..81ab283aa7 100644--- a/packages/sync-server/src/app-admin.test.js+++ b/packages/sync-server/src/app-admin.test.js@@ -14,7 +14,7 @@ const createUser = (userId, userName, role, owner = 0, enabled = 1) => {);};-const deleteUser = (userId) => {+const deleteUser = userId => {getAccountDb().mutate('DELETE FROM user_access WHERE user_id = ?', [userId]);getAccountDb().mutate('DELETE FROM users WHERE id = ?', [userId]);};diff --git a/packages/sync-server/src/app-gocardless/README.md b/packages/sync-server/src/app-gocardless/README.mdindex 23f8300e96..de406253dc 100644--- a/packages/sync-server/src/app-gocardless/README.md+++ b/packages/sync-server/src/app-gocardless/README.md@@ -8,156 +8,156 @@ If the default bank integration does not work for you, you can integrate a new b3. In the frontend, create a new linked account selecting the institution which you are interested in.- This will trigger the process of fetching the data from the bank and will log the data in the backend. Use this data to fill the logic of the bank class.+ This will trigger the process of fetching the data from the bank and will log the data in the backend. Use this data to fill the logic of the bank class.4. Create new a bank class based on `app-gocardless/banks/sandboxfinance-sfin0000.js`.- Name of the file and class should be created based on the ID of the integrated institution, found in step 1.+ Name of the file and class should be created based on the ID of the integrated institution, found in step 1.5. Fill the logic of `normalizeAccount`, `normalizeTransaction`, `sortTransactions`, and `calculateStartingBalance` functions.You do not need to fill every function, only those which are necessary for the integration to work.- You should do it based on the data which you found in the logs.-- Example logs which help you to fill:-- - `normalizeAccount` function:-- ```log- Available account properties for new institution integration {- account: '{- "iban": "PL00000000000000000987654321",- "currency": "PLN",- "ownerName": "John Example",- "displayName": "Product name",- "product": "Daily account",- "usage": "PRIV",- "ownerAddressUnstructured": [- "POL",- "UL. Example 1",- "00-000 Warsaw"- ],- "id": "XXXXXXXX-XXXX-XXXXX-XXXXXX-XXXXXXXXX",- "created": "2023-01-18T12:15:16.502446Z",- "last_accessed": null,- "institution_id": "MBANK_RETAIL_BREXPLPW",- "status": "READY",- "owner_name": "",- "institution": {- "id": "MBANK_RETAIL_BREXPLPW",- "name": "mBank Retail",- "bic": "BREXPLPW",- "transaction_total_days": "90",- "countries": [- "PL"- ],- "logo": "https://cdn.nordigen.com/ais/MBANK_RETAIL_BREXCZPP.png",- "supported_payments": {},- "supported_features": [- "access_scopes",- "business_accounts",- "card_accounts",- "corporate_accounts",- "pending_transactions",- "private_accounts"- ]- }- }'- }- ```-- - `sortTransactions` function:-- ```log- Available (first 10) transactions properties for new integration of institution in sortTransactions function- {- top10SortedTransactions: '[- {- "transactionId": "20220101001",- "bookingDate": "2022-01-01",- "valueDate": "2022-01-01",- "transactionAmount": {- "amount": "5.01",- "currency": "EUR"- },- "creditorName": "JOHN EXAMPLE",- "creditorAccount": {- "iban": "PL00000000000000000987654321"- },- "debtorName": "CHRIS EXAMPLE",- "debtorAccount": {- "iban": "PL12345000000000000987654321"- },- "remittanceInformationUnstructured": "TEST BANK TRANSFER",- "remittanceInformationUnstructuredArray": [- "TEST BANK TRANSFER"- ],- "balanceAfterTransaction": {- "balanceAmount": {- "amount": "448.52",- "currency": "EUR"- },- "balanceType": "interimBooked"- },- "internalTransactionId": "casfib7720c2a02c0331cw2"- }- ]'- }- ```-- - `calculateStartingBalance` function:-- ```log- Available (first 10) transactions properties for new integration of institution in calculateStartingBalance function {- balances: '[- {- "balanceAmount": {- "amount": "448.52",- "currency": "EUR"- },- "balanceType": "forwardAvailable"- },- {- "balanceAmount": {- "amount": "448.52",- "currency": "EUR"- },- "balanceType": "interimBooked"- }- ]',- top10SortedTransactions: '[- {- "transactionId": "20220101001",- "bookingDate": "2022-01-01",- "valueDate": "2022-01-01",- "transactionAmount": {- "amount": "5.01",- "currency": "EUR"- },- "creditorName": "JOHN EXAMPLE",- "creditorAccount": {- "iban": "PL00000000000000000987654321"- },- "debtorName": "CHRIS EXAMPLE",- "debtorAccount": {- "iban": "PL12345000000000000987654321"- },- "remittanceInformationUnstructured": "TEST BANK TRANSFER",- "remittanceInformationUnstructuredArray": [- "TEST BANK TRANSFER"- ],- "balanceAfterTransaction": {- "balanceAmount": {- "amount": "448.52",- "currency": "EUR"- },- "balanceType": "interimBooked"- },- "internalTransactionId": "casfib7720c2a02c0331cw2"- }- ]'- }- ```+ You should do it based on the data which you found in the logs.++ Example logs which help you to fill:++ - `normalizeAccount` function:++ ```log+ Available account properties for new institution integration {+ account: '{+ "iban": "PL00000000000000000987654321",+ "currency": "PLN",+ "ownerName": "John Example",+ "displayName": "Product name",+ "product": "Daily account",+ "usage": "PRIV",+ "ownerAddressUnstructured": [+ "POL",+ "UL. Example 1",+ "00-000 Warsaw"+ ],+ "id": "XXXXXXXX-XXXX-XXXXX-XXXXXX-XXXXXXXXX",+ "created": "2023-01-18T12:15:16.502446Z",+ "last_accessed": null,+ "institution_id": "MBANK_RETAIL_BREXPLPW",+ "status": "READY",+ "owner_name": "",+ "institution": {+ "id": "MBANK_RETAIL_BREXPLPW",+ "name": "mBank Retail",+ "bic": "BREXPLPW",+ "transaction_total_days": "90",+ "countries": [+ "PL"+ ],+ "logo": "https://cdn.nordigen.com/ais/MBANK_RETAIL_BREXCZPP.png",+ "supported_payments": {},+ "supported_features": [+ "access_scopes",+ "business_accounts",+ "card_accounts",+ "corporate_accounts",+ "pending_transactions",+ "private_accounts"+ ]+ }+ }'+ }+ ```++ - `sortTransactions` function:++ ```log+ Available (first 10) transactions properties for new integration of institution in sortTransactions function+ {+ top10SortedTransactions: '[+ {+ "transactionId": "20220101001",+ "bookingDate": "2022-01-01",+ "valueDate": "2022-01-01",+ "transactionAmount": {+ "amount": "5.01",+ "currency": "EUR"+ },+ "creditorName": "JOHN EXAMPLE",+ "creditorAccount": {+ "iban": "PL00000000000000000987654321"+ },+ "debtorName": "CHRIS EXAMPLE",+ "debtorAccount": {+ "iban": "PL12345000000000000987654321"+ },+ "remittanceInformationUnstructured": "TEST BANK TRANSFER",+ "remittanceInformationUnstructuredArray": [+ "TEST BANK TRANSFER"+ ],+ "balanceAfterTransaction": {+ "balanceAmount": {+ "amount": "448.52",+ "currency": "EUR"+ },+ "balanceType": "interimBooked"+ },+ "internalTransactionId": "casfib7720c2a02c0331cw2"+ }+ ]'+ }+ ```++ - `calculateStartingBalance` function:++ ```log+ Available (first 10) transactions properties for new integration of institution in calculateStartingBalance function {+ balances: '[+ {+ "balanceAmount": {+ "amount": "448.52",+ "currency": "EUR"+ },+ "balanceType": "forwardAvailable"+ },+ {+ "balanceAmount": {+ "amount": "448.52",+ "currency": "EUR"+ },+ "balanceType": "interimBooked"+ }+ ]',+ top10SortedTransactions: '[+ {+ "transactionId": "20220101001",+ "bookingDate": "2022-01-01",+ "valueDate": "2022-01-01",+ "transactionAmount": {+ "amount": "5.01",+ "currency": "EUR"+ },+ "creditorName": "JOHN EXAMPLE",+ "creditorAccount": {+ "iban": "PL00000000000000000987654321"+ },+ "debtorName": "CHRIS EXAMPLE",+ "debtorAccount": {+ "iban": "PL12345000000000000987654321"+ },+ "remittanceInformationUnstructured": "TEST BANK TRANSFER",+ "remittanceInformationUnstructuredArray": [+ "TEST BANK TRANSFER"+ ],+ "balanceAfterTransaction": {+ "balanceAmount": {+ "amount": "448.52",+ "currency": "EUR"+ },+ "balanceType": "interimBooked"+ },+ "internalTransactionId": "casfib7720c2a02c0331cw2"+ }+ ]'+ }+ ```6. Add new bank integration to `BankFactory` class in file `actual-server/app-gocardless/bank-factory.js`diff --git a/packages/sync-server/src/app-gocardless/app-gocardless.js b/packages/sync-server/src/app-gocardless/app-gocardless.jsindex b076a91b5b..569a5a69ce 100644--- a/packages/sync-server/src/app-gocardless/app-gocardless.js+++ b/packages/sync-server/src/app-gocardless/app-gocardless.js@@ -72,7 +72,7 @@ app.post(data: {...requisition,accounts: await Promise.all(- accounts.map(async (account) =>+ accounts.map(async account =>account?.iban? { ...account, iban: await sha256String(account.iban) }: account,@@ -209,7 +209,7 @@ app.post(),);- const sendErrorResponse = (data) =>+ const sendErrorResponse = data =>res.send({status: 'ok',data: { ...data, details: error.details, rateLimitHeaders },diff --git a/packages/sync-server/src/app-gocardless/bank-factory.js b/packages/sync-server/src/app-gocardless/bank-factory.jsindex 33d6a4ec89..f830bc2287 100644--- a/packages/sync-server/src/app-gocardless/bank-factory.js+++ b/packages/sync-server/src/app-gocardless/bank-factory.js@@ -10,14 +10,12 @@ const banksDir = path.resolve(dirname, 'banks');async function loadBanks() {const bankHandlers = fs.readdirSync(banksDir)- .filter((filename) => filename.includes('_') && filename.endsWith('.js'));+ .filter(filename => filename.includes('_') && filename.endsWith('.js'));const imports = await Promise.all(- bankHandlers.map((file) => {+ bankHandlers.map(file => {const fileUrlToBank = pathToFileURL(path.resolve(banksDir, file)); // pathToFileURL for ESM compatibility- return import(fileUrlToBank.toString()).then(- (handler) => handler.default,- );+ return import(fileUrlToBank.toString()).then(handler => handler.default);}),);@@ -26,9 +24,8 @@ async function loadBanks() {export const banks = await loadBanks();-export default (institutionId) =>- banks.find((b) => b.institutionIds.includes(institutionId)) ||- IntegrationBank;+export default institutionId =>+ banks.find(b => b.institutionIds.includes(institutionId)) || IntegrationBank;export const BANKS_WITH_LIMITED_HISTORY = ['BANCA_AIDEXA_AIDXITMM',diff --git a/packages/sync-server/src/app-gocardless/banks/abnamro_abnanl2a.js b/packages/sync-server/src/app-gocardless/banks/abnamro_abnanl2a.jsindex 2b260953f6..817e2a5037 100644--- a/packages/sync-server/src/app-gocardless/banks/abnamro_abnanl2a.js+++ b/packages/sync-server/src/app-gocardless/banks/abnamro_abnanl2a.js@@ -17,8 +17,8 @@ export default {// Remove clutter to extract the payee from remittanceInformationUnstructured ...// ... when not otherwise provided.const payeeName = transaction.remittanceInformationUnstructuredArray- .map((el) => el.match(/^(?:.*\*)?(.+),PAS\d+$/))- .find((match) => match)?.[1];+ .map(el => el.match(/^(?:.*\*)?(.+),PAS\d+$/))+ .find(match => match)?.[1];transaction.debtorName = transaction.debtorName || payeeName;transaction.creditorName = transaction.creditorName || payeeName;@@ -49,7 +49,7 @@ export default {return oldestKnownBalance - oldestTransactionAmount;} else {return amountToInteger(- balances.find((balance) => 'interimBooked' === balance.balanceType)+ balances.find(balance => 'interimBooked' === balance.balanceType).balanceAmount.amount,);}diff --git a/packages/sync-server/src/app-gocardless/banks/american_express_aesudef1.js b/packages/sync-server/src/app-gocardless/banks/american_express_aesudef1.jsindex dcf6a20bcc..99aa5fe579 100644--- a/packages/sync-server/src/app-gocardless/banks/american_express_aesudef1.js+++ b/packages/sync-server/src/app-gocardless/banks/american_express_aesudef1.js@@ -39,7 +39,7 @@ export default {*/calculateStartingBalance(sortedTransactions = [], balances = []) {const currentBalance = balances.find(- (balance) => 'information' === balance.balanceType.toString(),+ balance => 'information' === balance.balanceType.toString(),);return sortedTransactions.reduce((total, trans) => {diff --git a/packages/sync-server/src/app-gocardless/banks/berliner_sparkasse_beladebexxx.js b/packages/sync-server/src/app-gocardless/banks/berliner_sparkasse_beladebexxx.jsindex 9c8c3d9f65..a5af45da3a 100644--- a/packages/sync-server/src/app-gocardless/banks/berliner_sparkasse_beladebexxx.js+++ b/packages/sync-server/src/app-gocardless/banks/berliner_sparkasse_beladebexxx.js@@ -74,7 +74,7 @@ export default {*/calculateStartingBalance(sortedTransactions = [], balances = []) {const currentBalance = balances.find(- (balance) => 'interimAvailable' === balance.balanceType,+ balance => 'interimAvailable' === balance.balanceType,);return sortedTransactions.reduce((total, trans) => {diff --git a/packages/sync-server/src/app-gocardless/banks/commerzbank_cobadeff.js b/packages/sync-server/src/app-gocardless/banks/commerzbank_cobadeff.jsindex eaf061c9b7..e772796a06 100644--- a/packages/sync-server/src/app-gocardless/banks/commerzbank_cobadeff.js+++ b/packages/sync-server/src/app-gocardless/banks/commerzbank_cobadeff.js@@ -25,7 +25,7 @@ export default {'Kartenzahlung','Dauerauftrag',];- keywords.forEach((keyword) => {+ keywords.forEach(keyword => {transaction.remittanceInformationUnstructured =transaction.remittanceInformationUnstructured.replace(// There can be spaces in keywordsdiff --git a/packages/sync-server/src/app-gocardless/banks/danskebank_dabno22.js b/packages/sync-server/src/app-gocardless/banks/danskebank_dabno22.jsindex 39a1f13b34..78e657caf8 100644--- a/packages/sync-server/src/app-gocardless/banks/danskebank_dabno22.js+++ b/packages/sync-server/src/app-gocardless/banks/danskebank_dabno22.js@@ -36,7 +36,7 @@ export default {calculateStartingBalance(sortedTransactions = [], balances = []) {const currentBalance = balances.find(- (balance) => balance.balanceType === 'interimAvailable',+ balance => balance.balanceType === 'interimAvailable',);return sortedTransactions.reduce((total, trans) => {diff --git a/packages/sync-server/src/app-gocardless/banks/entercard_swednokk.js b/packages/sync-server/src/app-gocardless/banks/entercard_swednokk.jsindex c71c306b2c..2e0f413a0b 100644--- a/packages/sync-server/src/app-gocardless/banks/entercard_swednokk.js+++ b/packages/sync-server/src/app-gocardless/banks/entercard_swednokk.js@@ -33,8 +33,11 @@ export default {},calculateStartingBalance(sortedTransactions = [], balances = []) {- return sortedTransactions.reduce((total, trans) => {- return total - amountToInteger(trans.transactionAmount.amount);- }, amountToInteger(balances[0]?.balanceAmount?.amount || 0));+ return sortedTransactions.reduce(+ (total, trans) => {+ return total - amountToInteger(trans.transactionAmount.amount);+ },+ amountToInteger(balances[0]?.balanceAmount?.amount || 0),+ );},};diff --git a/packages/sync-server/src/app-gocardless/banks/ing_ingddeff.js b/packages/sync-server/src/app-gocardless/banks/ing_ingddeff.jsindex 57907ee76b..e44c027f18 100644--- a/packages/sync-server/src/app-gocardless/banks/ing_ingddeff.js+++ b/packages/sync-server/src/app-gocardless/banks/ing_ingddeff.js@@ -40,7 +40,7 @@ export default {calculateStartingBalance(sortedTransactions = [], balances = []) {const currentBalance = balances.find(- (balance) => 'interimBooked' === balance.balanceType,+ balance => 'interimBooked' === balance.balanceType,);return sortedTransactions.reduce((total, trans) => {diff --git a/packages/sync-server/src/app-gocardless/banks/ing_pl_ingbplpw.js b/packages/sync-server/src/app-gocardless/banks/ing_pl_ingbplpw.jsindex 611f67cab5..a4b3a8d493 100644--- a/packages/sync-server/src/app-gocardless/banks/ing_pl_ingbplpw.js+++ b/packages/sync-server/src/app-gocardless/banks/ing_pl_ingbplpw.js@@ -39,7 +39,7 @@ export default {return oldestKnownBalance - oldestTransactionAmount;} else {return amountToInteger(- balances.find((balance) => 'interimBooked' === balance.balanceType)+ balances.find(balance => 'interimBooked' === balance.balanceType).balanceAmount.amount,);}diff --git a/packages/sync-server/src/app-gocardless/banks/integration-bank.js b/packages/sync-server/src/app-gocardless/banks/integration-bank.jsindex 70f3c1cf34..b0ed37a354 100644--- a/packages/sync-server/src/app-gocardless/banks/integration-bank.js+++ b/packages/sync-server/src/app-gocardless/banks/integration-bank.js@@ -82,14 +82,17 @@ export default {);const currentBalance = balances- .filter((item) => SORTED_BALANCE_TYPE_LIST.includes(item.balanceType))+ .filter(item => SORTED_BALANCE_TYPE_LIST.includes(item.balanceType)).sort((a, b) =>SORTED_BALANCE_TYPE_LIST.indexOf(a.balanceType) -SORTED_BALANCE_TYPE_LIST.indexOf(b.balanceType),)[0];- return sortedTransactions.reduce((total, trans) => {- return total - amountToInteger(trans.transactionAmount.amount);- }, amountToInteger(currentBalance?.balanceAmount?.amount || 0));+ return sortedTransactions.reduce(+ (total, trans) => {+ return total - amountToInteger(trans.transactionAmount.amount);+ },+ amountToInteger(currentBalance?.balanceAmount?.amount || 0),+ );},};diff --git a/packages/sync-server/src/app-gocardless/banks/mbank_retail_brexplpw.js b/packages/sync-server/src/app-gocardless/banks/mbank_retail_brexplpw.jsindex 27764e40fc..121631e487 100644--- a/packages/sync-server/src/app-gocardless/banks/mbank_retail_brexplpw.js+++ b/packages/sync-server/src/app-gocardless/banks/mbank_retail_brexplpw.js@@ -33,7 +33,7 @@ export default {*/calculateStartingBalance(sortedTransactions = [], balances = []) {const currentBalance = balances.find(- (balance) => 'interimBooked' === balance.balanceType,+ balance => 'interimBooked' === balance.balanceType,);return sortedTransactions.reduce((total, trans) => {diff --git a/packages/sync-server/src/app-gocardless/banks/nbg_ethngraaxxx.js b/packages/sync-server/src/app-gocardless/banks/nbg_ethngraaxxx.jsindex 3bdb4b4650..4fc5a9c6f5 100644--- a/packages/sync-server/src/app-gocardless/banks/nbg_ethngraaxxx.js+++ b/packages/sync-server/src/app-gocardless/banks/nbg_ethngraaxxx.js@@ -47,7 +47,7 @@ export default {*/calculateStartingBalance(sortedTransactions = [], balances = []) {const currentBalance = balances.find(- (balance) => 'interimAvailable' === balance.balanceType,+ balance => 'interimAvailable' === balance.balanceType,);return sortedTransactions.reduce((total, trans) => {diff --git a/packages/sync-server/src/app-gocardless/banks/norwegian_xx_norwnok1.js b/packages/sync-server/src/app-gocardless/banks/norwegian_xx_norwnok1.jsindex 67900828bd..82d4693d69 100644--- a/packages/sync-server/src/app-gocardless/banks/norwegian_xx_norwnok1.js+++ b/packages/sync-server/src/app-gocardless/banks/norwegian_xx_norwnok1.js@@ -73,7 +73,7 @@ export default {*/calculateStartingBalance(sortedTransactions = [], balances = []) {const currentBalance = balances.find(- (balance) => 'expected' === balance.balanceType,+ balance => 'expected' === balance.balanceType,);return sortedTransactions.reduce((total, trans) => {diff --git a/packages/sync-server/src/app-gocardless/banks/sandboxfinance_sfin0000.js b/packages/sync-server/src/app-gocardless/banks/sandboxfinance_sfin0000.jsindex 65bdeafdb1..72c9442701 100644--- a/packages/sync-server/src/app-gocardless/banks/sandboxfinance_sfin0000.js+++ b/packages/sync-server/src/app-gocardless/banks/sandboxfinance_sfin0000.js@@ -35,7 +35,7 @@ export default {*/calculateStartingBalance(sortedTransactions = [], balances = []) {const currentBalance = balances.find(- (balance) => 'interimAvailable' === balance.balanceType,+ balance => 'interimAvailable' === balance.balanceType,);return sortedTransactions.reduce((total, trans) => {diff --git a/packages/sync-server/src/app-gocardless/banks/seb_kort_bank_ab.js b/packages/sync-server/src/app-gocardless/banks/seb_kort_bank_ab.jsindex c159a1f058..e6734dc294 100644--- a/packages/sync-server/src/app-gocardless/banks/seb_kort_bank_ab.js+++ b/packages/sync-server/src/app-gocardless/banks/seb_kort_bank_ab.js@@ -43,15 +43,19 @@ export default {*/calculateStartingBalance(sortedTransactions = [], balances = []) {const currentBalance = balances.find(- (balance) => 'expected' === balance.balanceType,+ balance => 'expected' === balance.balanceType,);const nonInvoiced = balances.find(- (balance) => 'nonInvoiced' === balance.balanceType,+ balance => 'nonInvoiced' === balance.balanceType,);- return sortedTransactions.reduce((total, trans) => {- return total - amountToInteger(trans.transactionAmount.amount);- }, -amountToInteger(currentBalance.balanceAmount.amount) + amountToInteger(nonInvoiced.balanceAmount.amount));+ return sortedTransactions.reduce(+ (total, trans) => {+ return total - amountToInteger(trans.transactionAmount.amount);+ },+ -amountToInteger(currentBalance.balanceAmount.amount) ++ amountToInteger(nonInvoiced.balanceAmount.amount),+ );},};diff --git a/packages/sync-server/src/app-gocardless/banks/seb_privat.js b/packages/sync-server/src/app-gocardless/banks/seb_privat.jsindex de6a4a4161..57863e40cf 100644--- a/packages/sync-server/src/app-gocardless/banks/seb_privat.js+++ b/packages/sync-server/src/app-gocardless/banks/seb_privat.js@@ -35,7 +35,7 @@ export default {calculateStartingBalance(sortedTransactions = [], balances = []) {const currentBalance = balances.find(- (balance) => 'interimBooked' === balance.balanceType,+ balance => 'interimBooked' === balance.balanceType,);return sortedTransactions.reduce((total, trans) => {diff --git a/packages/sync-server/src/app-gocardless/banks/spk_karlsruhe_karsde66.js b/packages/sync-server/src/app-gocardless/banks/spk_karlsruhe_karsde66.jsindex 7974c52aea..0dc1b352fb 100644--- a/packages/sync-server/src/app-gocardless/banks/spk_karlsruhe_karsde66.js+++ b/packages/sync-server/src/app-gocardless/banks/spk_karlsruhe_karsde66.js@@ -74,7 +74,7 @@ export default {*/calculateStartingBalance(sortedTransactions = [], balances = []) {const currentBalance = balances.find(- (balance) => 'interimAvailable' === balance.balanceType,+ balance => 'interimAvailable' === balance.balanceType,);return sortedTransactions.reduce((total, trans) => {diff --git a/packages/sync-server/src/app-gocardless/banks/tests/ing_ingddeff.spec.js b/packages/sync-server/src/app-gocardless/banks/tests/ing_ingddeff.spec.jsindex f1279d3a40..de8fbd22c9 100644--- a/packages/sync-server/src/app-gocardless/banks/tests/ing_ingddeff.spec.js+++ b/packages/sync-server/src/app-gocardless/banks/tests/ing_ingddeff.spec.js@@ -246,7 +246,7 @@ describe('IngIngddeff', () => {});it('returns sorted array for unsorted inputs', () => {- const normalizeTransactions = transactionsRaw.map((tx) =>+ const normalizeTransactions = transactionsRaw.map(tx =>IngIngddeff.normalizeTransaction(tx, true),);const originalOrder = Array.from(normalizeTransactions);@@ -276,7 +276,7 @@ describe('IngIngddeff', () => {];it('should calculate the starting balance correctly', () => {- const normalizeTransactions = transactionsRaw.map((tx) =>+ const normalizeTransactions = transactionsRaw.map(tx =>IngIngddeff.normalizeTransaction(tx, true),);const sortedTransactions = IngIngddeff.sortTransactions(diff --git a/packages/sync-server/src/app-gocardless/banks/tests/spk_marburg_biedenkopf_heladef1mar.spec.js b/packages/sync-server/src/app-gocardless/banks/tests/spk_marburg_biedenkopf_heladef1mar.spec.jsindex 7cac1ab81a..87b51c9a03 100644--- a/packages/sync-server/src/app-gocardless/banks/tests/spk_marburg_biedenkopf_heladef1mar.spec.js+++ b/packages/sync-server/src/app-gocardless/banks/tests/spk_marburg_biedenkopf_heladef1mar.spec.js@@ -192,7 +192,7 @@ describe('SpkMarburgBiedenkopfHeladef1mar', () => {});it('returns sorted array for unsorted inputs', () => {- const normalizeTransactions = transactionsRaw.map((tx) =>+ const normalizeTransactions = transactionsRaw.map(tx =>SpkMarburgBiedenkopfHeladef1mar.normalizeTransaction(tx, true),);const originalOrder = Array.from(normalizeTransactions);@@ -227,7 +227,7 @@ describe('SpkMarburgBiedenkopfHeladef1mar', () => {});it('should calculate the starting balance correctly', () => {- const normalizeTransactions = transactionsRaw.map((tx) =>+ const normalizeTransactions = transactionsRaw.map(tx =>SpkMarburgBiedenkopfHeladef1mar.normalizeTransaction(tx, true),);const sortedTransactions =diff --git a/packages/sync-server/src/app-gocardless/link.html b/packages/sync-server/src/app-gocardless/link.htmlindex cd3155849e..4ddffd1cf8 100644--- a/packages/sync-server/src/app-gocardless/link.html+++ b/packages/sync-server/src/app-gocardless/link.html@@ -1,4 +1,4 @@-<!DOCTYPE html>+<!doctype html><html lang="en"><head><meta charset="utf-8" />diff --git a/packages/sync-server/src/app-gocardless/services/gocardless-service.js b/packages/sync-server/src/app-gocardless/services/gocardless-service.jsindex 81e5c77d57..755e63c78a 100644--- a/packages/sync-server/src/app-gocardless/services/gocardless-service.js+++ b/packages/sync-server/src/app-gocardless/services/gocardless-service.js@@ -36,7 +36,7 @@ const getGocardlessClient = () => {return clients.get(hash);};-export const handleGoCardlessError = (error) => {+export const handleGoCardlessError = error => {const status = error?.response?.status;switch (status) {@@ -77,7 +77,7 @@ export const goCardlessService = {* @returns {Promise<void>}*/setToken: async () => {- const isExpiredJwtToken = (token) => {+ const isExpiredJwtToken = token => {const decodedToken = jwt.decode(token);if (!decodedToken) {return true;@@ -112,7 +112,7 @@ export const goCardlessService = {* @throws {ServiceError}* @returns {Promise<import('../gocardless-node.types.js').Requisition>}*/- getLinkedRequisition: async (requisitionId) => {+ getLinkedRequisition: async requisitionId => {const requisition = await goCardlessService.getRequisition(requisitionId);const { status } = requisition;@@ -141,14 +141,13 @@ export const goCardlessService = {* @throws {ServiceError}* @returns {Promise<{requisition: import('../gocardless-node.types.js').Requisition, accounts: Array<import('../gocardless.types.js').NormalizedAccountDetails>}>}*/- getRequisitionWithAccounts: async (requisitionId) => {- const requisition = await goCardlessService.getLinkedRequisition(- requisitionId,- );+ getRequisitionWithAccounts: async requisitionId => {+ const requisition =+ await goCardlessService.getLinkedRequisition(requisitionId);let institutionIdSet = new Set();const detailedAccounts = await Promise.all(- requisition.accounts.map(async (accountId) => {+ requisition.accounts.map(async accountId => {const account = await goCardlessService.getDetailedAccount(accountId);institutionIdSet.add(account.institution_id);return account;@@ -156,7 +155,7 @@ export const goCardlessService = {);const institutions = await Promise.all(- Array.from(institutionIdSet).map(async (institutionId) => {+ Array.from(institutionIdSet).map(async institutionId => {return await goCardlessService.getInstitution(institutionId);}),);@@ -167,7 +166,7 @@ export const goCardlessService = {institutions,});- const normalizedAccounts = extendedAccounts.map((account) => {+ const normalizedAccounts = extendedAccounts.map(account => {const bankAccount = BankFactory(account.institution_id);return bankAccount.normalizeAccount(account);});@@ -278,10 +277,10 @@ export const goCardlessService = {const sortedPendingTransactions = bank.sortTransactions(transactions.transactions?.pending,);- const allTransactions = sortedBookedTransactions.map((t) => {+ const allTransactions = sortedBookedTransactions.map(t => {return { ...t, booked: true };});- sortedPendingTransactions.forEach((t) =>+ sortedPendingTransactions.forEach(t =>allTransactions.push({ ...t, booked: false }),);const sortedAllTransactions = bank.sortTransactions(allTransactions);@@ -356,7 +355,7 @@ export const goCardlessService = {* @throws {ServiceError}* @returns {Promise<{summary: string, detail: string}>}*/- deleteRequisition: async (requisitionId) => {+ deleteRequisition: async requisitionId => {await goCardlessService.getRequisition(requisitionId);let response;@@ -383,7 +382,7 @@ export const goCardlessService = {* @throws {ServiceError}* @returns { Promise<import('../gocardless-node.types.js').Requisition> }*/- getRequisition: async (requisitionId) => {+ getRequisition: async requisitionId => {await goCardlessService.setToken();let response;@@ -401,7 +400,7 @@ export const goCardlessService = {* @param accountId* @returns {Promise<import('../gocardless.types.js').DetailedAccount>}*/- getDetailedAccount: async (accountId) => {+ getDetailedAccount: async accountId => {let detailedAccount, metadataAccount;try {[detailedAccount, metadataAccount] = await Promise.all([@@ -426,7 +425,7 @@ export const goCardlessService = {* @param accountId* @returns {Promise<import('../gocardless-node.types.js').GoCardlessAccountMetadata>}*/- getAccountMetadata: async (accountId) => {+ getAccountMetadata: async accountId => {let response;try {response = await client.getMetadata(accountId);@@ -450,7 +449,7 @@ export const goCardlessService = {* @throws {ServiceError}* @returns {Promise<Array<import('../gocardless-node.types.js').Institution>>}*/- getInstitutions: async (country) => {+ getInstitutions: async country => {let response;try {response = await client.getInstitutions(country);@@ -474,7 +473,7 @@ export const goCardlessService = {* @throws {ServiceError}* @returns {Promise<import('../gocardless-node.types.js').Institution>}*/- getInstitution: async (institutionId) => {+ getInstitution: async institutionId => {let response;try {response = await client.getInstitutionById(institutionId);@@ -496,7 +495,7 @@ export const goCardlessService = {return acc;}, {});- return accounts.map((account) => {+ return accounts.map(account => {const institution = institutionsById[account.institution_id] || null;return {...account,@@ -532,11 +531,11 @@ export const goCardlessService = {const bank = BankFactory(institutionId);response.transactions.booked = response.transactions.booked- .map((transaction) => bank.normalizeTransaction(transaction, true))- .filter((transaction) => transaction);+ .map(transaction => bank.normalizeTransaction(transaction, true))+ .filter(transaction => transaction);response.transactions.pending = response.transactions.pending- .map((transaction) => bank.normalizeTransaction(transaction, false))- .filter((transaction) => transaction);+ .map(transaction => bank.normalizeTransaction(transaction, false))+ .filter(transaction => transaction);return response;},@@ -554,7 +553,7 @@ export const goCardlessService = {* @throws {ServiceError}* @returns {Promise<import('../gocardless.types.js').GetBalances>}*/- getBalances: async (accountId) => {+ getBalances: async accountId => {let response;try {response = await client.getBalances(accountId);@@ -572,7 +571,7 @@ export const goCardlessService = {* In that way we can mock the `client` const instead of nordigen library*/export const client = {- getBalances: async (accountId) =>+ getBalances: async accountId =>await getGocardlessClient().account(accountId).getBalances(),getTransactions: async ({ accountId, dateFrom, dateTo }) =>await getGocardlessClient().account(accountId).getTransactions({@@ -580,17 +579,17 @@ export const client = {dateTo,country: undefined,}),- getInstitutions: async (country) =>+ getInstitutions: async country =>await getGocardlessClient().institution.getInstitutions({ country }),- getInstitutionById: async (institutionId) =>+ getInstitutionById: async institutionId =>await getGocardlessClient().institution.getInstitutionById(institutionId),- getDetails: async (accountId) =>+ getDetails: async accountId =>await getGocardlessClient().account(accountId).getDetails(),- getMetadata: async (accountId) =>+ getMetadata: async accountId =>await getGocardlessClient().account(accountId).getMetadata(),- getRequisitionById: async (requisitionId) =>+ getRequisitionById: async requisitionId =>await getGocardlessClient().requisition.getRequisitionById(requisitionId),- deleteRequisition: async (requisitionId) =>+ deleteRequisition: async requisitionId =>await getGocardlessClient().requisition.deleteRequisition(requisitionId),initSession: async ({redirectUrl,diff --git a/packages/sync-server/src/app-gocardless/tests/bank-factory.spec.js b/packages/sync-server/src/app-gocardless/tests/bank-factory.spec.jsindex 61dec1ddbf..a8ed6d0225 100644--- a/packages/sync-server/src/app-gocardless/tests/bank-factory.spec.js+++ b/packages/sync-server/src/app-gocardless/tests/bank-factory.spec.js@@ -3,9 +3,9 @@ import { banks } from '../bank-factory.js';import IntegrationBank from '../banks/integration-bank.js';describe('BankFactory', () => {- it.each(banks.flatMap((bank) => bank.institutionIds))(+ it.each(banks.flatMap(bank => bank.institutionIds))(`should return same institutionId`,- (institutionId) => {+ institutionId => {const result = BankFactory(institutionId);expect(result.institutionIds).toContain(institutionId);diff --git a/packages/sync-server/src/app-gocardless/util/handle-error.js b/packages/sync-server/src/app-gocardless/util/handle-error.jsindex 7aa4519273..7539e1c465 100644--- a/packages/sync-server/src/app-gocardless/util/handle-error.js+++ b/packages/sync-server/src/app-gocardless/util/handle-error.js@@ -2,7 +2,7 @@ import { inspect } from 'util';export function handleError(func) {return (req, res) => {- func(req, res).catch((err) => {+ func(req, res).catch(err => {console.log('Error', req.originalUrl, inspect(err, { depth: null }));res.send({status: 'ok',diff --git a/packages/sync-server/src/app-gocardless/utils.js b/packages/sync-server/src/app-gocardless/utils.jsindex 147276427c..51ab923dee 100644--- a/packages/sync-server/src/app-gocardless/utils.js+++ b/packages/sync-server/src/app-gocardless/utils.js@@ -1,4 +1,4 @@-export const printIban = (account) => {+export const printIban = account => {if (account.iban) {return '(XXX ' + account.iban.slice(-4) + ')';} else {@@ -42,4 +42,4 @@ export const sortByBookingDateOrValueDate = (transactions = []) =>return 0;});-export const amountToInteger = (n) => Math.round(n * 100);+export const amountToInteger = n => Math.round(n * 100);diff --git a/packages/sync-server/src/app-simplefin/app-simplefin.js b/packages/sync-server/src/app-simplefin/app-simplefin.jsindex 44bc5d53bd..e401824f2f 100644--- a/packages/sync-server/src/app-simplefin/app-simplefin.js+++ b/packages/sync-server/src/app-simplefin/app-simplefin.js@@ -144,13 +144,13 @@ function logAccountError(results, accountId, data) {function getAccountResponse(results, accountId, startDate) {const account =- !results?.accounts || results.accounts.find((a) => a.id === accountId);+ !results?.accounts || results.accounts.find(a => a.id === accountId);if (!account) {console.log(`The account "${accountId}" was not found. Here were the accounts returned:`,);if (results?.accounts)- results.accounts.forEach((a) => console.log(`${a.id} - ${a.org.name}`));+ results.accounts.forEach(a => console.log(`${a.id} - ${a.org.name}`));logAccountError(results, accountId, {error_type: 'ACCOUNT_MISSING',error_code: 'ACCOUNT_MISSING',@@ -160,7 +160,7 @@ function getAccountResponse(results, accountId, startDate) {}const needsAttention = results.sferrors.find(- (e) => e === `Connection to ${account.org.name} may need attention`,+ e => e === `Connection to ${account.org.name} may need attention`,);if (needsAttention) {logAccountError(results, accountId, {@@ -290,12 +290,12 @@ async function getAccessKey(base64Token) {headers: { 'Content-Length': 0 },};return new Promise((resolve, reject) => {- const req = https.request(new URL(token), options, (res) => {- res.on('data', (d) => {+ const req = https.request(new URL(token), options, res => {+ res.on('data', d => {resolve(d.toString());});});- req.on('error', (e) => {+ req.on('error', e => {reject(e);});req.end();@@ -348,7 +348,7 @@ async function getAccounts(}if (accounts) {- accounts.forEach((id) => {+ accounts.forEach(id => {params.push(`account=${encodeURIComponent(id)}`);});}@@ -361,9 +361,9 @@ async function getAccounts(const req = https.request(new URL(`${sfin.baseUrl}/accounts${queryString}`),options,- (res) => {+ res => {let data = '';- res.on('data', (d) => {+ res.on('data', d => {data += d;});res.on('end', () => {@@ -384,7 +384,7 @@ async function getAccounts(});},);- req.on('error', (e) => {+ req.on('error', e => {reject(e);});req.end();diff --git a/packages/sync-server/src/app-sync.js b/packages/sync-server/src/app-sync.jsindex 92fdf30133..c84882d85e 100644--- a/packages/sync-server/src/app-sync.js+++ b/packages/sync-server/src/app-sync.js@@ -105,7 +105,7 @@ app.post('/sync', async (req, res) => {// encode it back...let responsePb = new SyncProtoBuf.SyncResponse();responsePb.setMerkle(JSON.stringify(trie));- newMessages.forEach((msg) => responsePb.addMessages(msg));+ newMessages.forEach(msg => responsePb.addMessages(msg));res.set('Content-Type', 'application/actual-sync');res.set('X-ACTUAL-SYNC-METHOD', 'simple');@@ -315,19 +315,17 @@ app.get('/list-user-files', (req, res) => {const rows = fileService.find({ userId: res.locals.user_id });res.send({status: 'ok',- data: rows.map((row) => ({+ data: rows.map(row => ({deleted: boolToInt(row.deleted),fileId: row.id,groupId: row.groupId,name: row.name,encryptKeyId: row.encryptKeyId,owner: row.owner,- usersWithAccess: fileService- .findUsersWithAccess(row.id)- .map((access) => ({- ...access,- owner: access.userId === row.owner,- })),+ usersWithAccess: fileService.findUsersWithAccess(row.id).map(access => ({+ ...access,+ owner: access.userId === row.owner,+ })),})),});});@@ -363,12 +361,10 @@ app.get('/get-user-file-info', (req, res) => {groupId: file.groupId,name: file.name,encryptMeta: file.encryptMeta ? JSON.parse(file.encryptMeta) : null,- usersWithAccess: fileService- .findUsersWithAccess(file.id)- .map((access) => ({- ...access,- owner: access.userId === file.owner,- })),+ usersWithAccess: fileService.findUsersWithAccess(file.id).map(access => ({+ ...access,+ owner: access.userId === file.owner,+ })),},});});diff --git a/packages/sync-server/src/app-sync.test.js b/packages/sync-server/src/app-sync.test.jsindex 3d3dd10bde..005a0691b2 100644--- a/packages/sync-server/src/app-sync.test.js+++ b/packages/sync-server/src/app-sync.test.js@@ -294,7 +294,7 @@ describe('/upload-user-file', () => {],);- await fs.writeFile(getPathForUserFile(fileId), oldFileContent, (err) => {+ await fs.writeFile(getPathForUserFile(fileId), oldFileContent, err => {if (err) throw err;});diff --git a/packages/sync-server/src/app-sync/services/files-service.js b/packages/sync-server/src/app-sync/services/files-service.jsindex a01ba41723..a7234de92b 100644--- a/packages/sync-server/src/app-sync/services/files-service.js+++ b/packages/sync-server/src/app-sync/services/files-service.js@@ -84,7 +84,7 @@ class FileUpdate extends FileBase {}}-const boolToInt = (bool) => {+const boolToInt = bool => {return bool ? 1 : 0;};diff --git a/packages/sync-server/src/app-sync/tests/services/files-service.test.js b/packages/sync-server/src/app-sync/tests/services/files-service.test.jsindex 9807d99a0d..c33a799855 100644--- a/packages/sync-server/src/app-sync/tests/services/files-service.test.js+++ b/packages/sync-server/src/app-sync/tests/services/files-service.test.js@@ -32,18 +32,18 @@ describe('FilesService', () => {accountDb.mutate('DELETE FROM files');};- beforeAll((done) => {+ beforeAll(done => {accountDb = getAccountDb();filesService = new FilesService(accountDb);done();});- beforeEach((done) => {+ beforeEach(done => {insertToyExampleData();done();});- afterEach((done) => {+ afterEach(done => {clearDatabase();done();});@@ -93,7 +93,7 @@ describe('FilesService', () => {test.each([true, false])('set should insert a new file with deleted: %p',- (deleted) => {+ deleted => {const fileId = crypto.randomBytes(16).toString('hex');const newFile = new File({id: fileId,@@ -225,7 +225,7 @@ describe('FilesService', () => {test.each([['update-group', null]])('update should modify a single attribute with groupId = $groupId',- (newGroupId) => {+ newGroupId => {const fileUpdate = new FileUpdate({groupId: newGroupId,});diff --git a/packages/sync-server/src/app.js b/packages/sync-server/src/app.jsindex 2a3269ce9d..0f37039175 100644--- a/packages/sync-server/src/app.js+++ b/packages/sync-server/src/app.js@@ -16,7 +16,7 @@ import * as openidApp from './app-openid.js';const app = express();-process.on('unhandledRejection', (reason) => {+process.on('unhandledRejection', reason => {console.log('Rejection:', reason);});diff --git a/packages/sync-server/src/load-config.js b/packages/sync-server/src/load-config.jsindex 7f1a57c6d1..e08bc6dfee 100644--- a/packages/sync-server/src/load-config.js+++ b/packages/sync-server/src/load-config.js@@ -126,17 +126,17 @@ const finalConfig = {: config.multiuser,allowedLoginMethods: process.env.ACTUAL_ALLOWED_LOGIN_METHODS? process.env.ACTUAL_ALLOWED_LOGIN_METHODS.split(',')- .map((q) => q.trim().toLowerCase())+ .map(q => q.trim().toLowerCase()).filter(Boolean): config.allowedLoginMethods,trustedProxies: process.env.ACTUAL_TRUSTED_PROXIES? process.env.ACTUAL_TRUSTED_PROXIES.split(',')- .map((q) => q.trim())+ .map(q => q.trim()).filter(Boolean): config.trustedProxies,trustedAuthProxies: process.env.ACTUAL_TRUSTED_AUTH_PROXIES? process.env.ACTUAL_TRUSTED_AUTH_PROXIES.split(',')- .map((q) => q.trim())+ .map(q => q.trim()).filter(Boolean): config.trustedAuthProxies,port: +process.env.ACTUAL_PORT || +process.env.PORT || config.port,diff --git a/packages/sync-server/src/migrations.js b/packages/sync-server/src/migrations.jsindex cba7db0fd7..2cfa0f47f0 100644--- a/packages/sync-server/src/migrations.js+++ b/packages/sync-server/src/migrations.js@@ -7,7 +7,7 @@ export default function run(direction = 'up') {`Checking if there are any migrations to run for direction "${direction}"...`,);- return new Promise((resolve) =>+ return new Promise(resolve =>migrate.load({stateStore: `${path.join(config.dataDir, '.migrate')}${@@ -20,7 +20,7 @@ export default function run(direction = 'up') {throw err;}- set[direction]((err) => {+ set[direction](err => {if (err) {throw err;}diff --git a/packages/sync-server/src/run-migrations.js b/packages/sync-server/src/run-migrations.jsindex b5ed269401..b0de64e8c6 100644--- a/packages/sync-server/src/run-migrations.js+++ b/packages/sync-server/src/run-migrations.js@@ -2,7 +2,7 @@ import run from './migrations.js';const direction = process.argv[2] || 'up';-run(direction).catch((err) => {+run(direction).catch(err => {console.error('Migration failed:', err);process.exit(1);});diff --git a/packages/sync-server/src/scripts/health-check.js b/packages/sync-server/src/scripts/health-check.jsindex 6cce6d1352..6aef339b90 100644--- a/packages/sync-server/src/scripts/health-check.js+++ b/packages/sync-server/src/scripts/health-check.js@@ -5,8 +5,8 @@ let protocol = config.https ? 'https' : 'http';let hostname = config.hostname === '::' ? 'localhost' : config.hostname;fetch(`${protocol}://${hostname}:${config.port}/health`)- .then((res) => res.json())- .then((res) => {+ .then(res => res.json())+ .then(res => {if (res.status !== 'UP') {throw new Error('Health check failed: Server responded to health check with status ' +@@ -14,7 +14,7 @@ fetch(`${protocol}://${hostname}:${config.port}/health`));}})- .catch((err) => {+ .catch(err => {console.log('Health check failed:', err);process.exit(1);});diff --git a/packages/sync-server/src/services/secrets-service.js b/packages/sync-server/src/services/secrets-service.jsindex fb56825fe2..bc7c7db4c0 100644--- a/packages/sync-server/src/services/secrets-service.js+++ b/packages/sync-server/src/services/secrets-service.js@@ -60,7 +60,7 @@ export const secretsService = {* @param {SecretName} name - The name of the secret to retrieve.* @returns {string|null} The value of the secret, or null if the secret does not exist.*/- get: (name) => {+ get: name => {return _cachedSecrets.get(name) ?? secretsDb.get(name)?.value ?? null;},@@ -84,7 +84,7 @@ export const secretsService = {* @param {SecretName} name - The name of the secret to check for existence.* @returns {boolean} True if a secret with the given name exists, false otherwise.*/- exists: (name) => {+ exists: name => {return Boolean(secretsService.get(name));},};diff --git a/packages/sync-server/src/services/user-service.js b/packages/sync-server/src/services/user-service.jsindex ee353780ca..5400054e49 100644--- a/packages/sync-server/src/services/user-service.js+++ b/packages/sync-server/src/services/user-service.js@@ -32,7 +32,7 @@ export function getFileById(fileId) {export function validateRole(roleId) {const possibleRoles = ['BASIC', 'ADMIN'];- return possibleRoles.some((a) => a === roleId);+ return possibleRoles.some(a => a === roleId);}export function getOwnerCount() {diff --git a/packages/sync-server/src/sync-simple.js b/packages/sync-server/src/sync-simple.jsindex af0f99f93e..989c20dabe 100644--- a/packages/sync-server/src/sync-simple.js+++ b/packages/sync-server/src/sync-simple.js@@ -84,7 +84,7 @@ export function sync(messages, since, groupId) {return {trie,- newMessages: newMessages.map((msg) => {+ newMessages: newMessages.map(msg => {const envelopePb = new SyncProtoBuf.MessageEnvelope();envelopePb.setTimestamp(msg.timestamp);envelopePb.setIsencrypted(msg.is_encrypted);diff --git a/packages/sync-server/src/util/middlewares.js b/packages/sync-server/src/util/middlewares.jsindex f8d6b4f189..99eb821280 100644--- a/packages/sync-server/src/util/middlewares.js+++ b/packages/sync-server/src/util/middlewares.js@@ -46,7 +46,7 @@ const requestLoggerMiddleware = expressWinston.logger({format: winston.format.combine(winston.format.colorize(),winston.format.timestamp(),- winston.format.printf((args) => {+ winston.format.printf(args => {const { timestamp, level, meta } = args;const { res, req } = meta;diff --git a/packages/sync-server/src/util/payee-name.js b/packages/sync-server/src/util/payee-name.jsindex 1967aa4950..14df467b9d 100644--- a/packages/sync-server/src/util/payee-name.js+++ b/packages/sync-server/src/util/payee-name.js@@ -4,7 +4,7 @@ function formatPayeeIban(iban) {return '(' + iban.slice(0, 4) + ' XXX ' + iban.slice(-4) + ')';}-export const formatPayeeName = (trans) => {+export const formatPayeeName = trans => {const amount = trans.transactionAmount.amount;const nameParts = [];diff --git a/packages/sync-server/src/util/prompt.js b/packages/sync-server/src/util/prompt.jsindex f66f0f7605..d6597b001d 100644--- a/packages/sync-server/src/util/prompt.js+++ b/packages/sync-server/src/util/prompt.js@@ -6,8 +6,8 @@ export async function prompt(message) {output: process.stdout,});- let promise = new Promise((resolve) => {- rl.question(message, (answer) => {+ let promise = new Promise(resolve => {+ rl.question(message, answer => {resolve(answer);rl.close();});@@ -41,12 +41,12 @@ export async function promptPassword() {async function askForPassword(prompt) {let dataListener, endListener;- let promise = new Promise((resolve) => {+ let promise = new Promise(resolve => {let result = '';process.stdout.write(prompt);process.stdin.setRawMode(true);process.stdin.resume();- dataListener = (key) => {+ dataListener = key => {switch (key[0]) {case 0x03: // ^Cprocess.exit();diff --git a/packages/sync-server/src/util/title/index.js b/packages/sync-server/src/util/title/index.jsindex a77f48a258..2995c76aef 100644--- a/packages/sync-server/src/util/title/index.js+++ b/packages/sync-server/src/util/title/index.js@@ -9,8 +9,8 @@ const regex = new RegExp('g',);-const convertToRegExp = (specials) =>- specials.map((s) => [new RegExp(`\\b${s}\\b`, 'gi'), s]);+const convertToRegExp = specials =>+ specials.map(s => [new RegExp(`\\b${s}\\b`, 'gi'), s]);function parseMatch(match) {const firstCharacter = match[0];diff --git a/packages/sync-server/src/util/validate-user.js b/packages/sync-server/src/util/validate-user.jsindex 934bc9806c..16abc421c1 100644--- a/packages/sync-server/src/util/validate-user.js+++ b/packages/sync-server/src/util/validate-user.js@@ -50,7 +50,7 @@ export function validateAuthHeader(req) {let peer = req.socket.remoteAddress;let peerIp = ipaddr.process(peer);const rangeList = {- allowed_ips: trustedAuthProxies.map((q) => ipaddr.parseCIDR(q)),+ allowed_ips: trustedAuthProxies.map(q => ipaddr.parseCIDR(q)),};/* eslint-disable @typescript-eslint/ban-ts-comment */// @ts-ignore : there is an error in the ts definition for the function, but this is validdiff --git a/packages/sync-server/upcoming-release-notes/README.md b/packages/sync-server/upcoming-release-notes/README.mddeleted file mode 100644index 988027c3dd..0000000000--- a/packages/sync-server/upcoming-release-notes/README.md+++ /dev/null@@ -1 +0,0 @@-See the [Writing Good Release Notes](https://actualbudget.org/docs/contributing/#writing-good-release-notes) section of the documentation for more information on how to create a release notes file.diff --git a/packages/sync-server/upcoming-release-notes/557.md b/upcoming-release-notes/557.mdsimilarity index 100%rename from packages/sync-server/upcoming-release-notes/557.mdrename to upcoming-release-notes/557.mddiff --git a/packages/sync-server/upcoming-release-notes/560.md b/upcoming-release-notes/560.mdsimilarity index 100%rename from packages/sync-server/upcoming-release-notes/560.mdrename to upcoming-release-notes/560.mddiff --git a/packages/sync-server/upcoming-release-notes/566.md b/upcoming-release-notes/566.mdsimilarity index 100%rename from packages/sync-server/upcoming-release-notes/566.mdrename to upcoming-release-notes/566.md