A local-first personal finance app
style: apply prettier fixes
Tom French80a2b34d4360
diff --git a/app-plaid.js b/app-plaid.jsindex c895ea1a7d..3e53338ead 100644--- a/app-plaid.js+++ b/app-plaid.js@@ -190,7 +190,7 @@ app.post('Content-Type': 'application/json','User-Agent': 'Actual Budget'}- }).then(res => res.json());+ }).then((res) => res.json());await req.runQuery('INSERT INTO access_tokens (item_id, user_id, access_token) VALUES ($1, $2, $3)',@@ -233,7 +233,7 @@ app.post('Content-Type': 'application/json','User-Agent': 'Actual Budget'}- }).then(res => res.json());+ }).then((res) => res.json());if (resData.removed !== true) {console.log('[Error] Item not removed: ' + access_token.slice(0, 3));@@ -286,7 +286,7 @@ app.post('Content-Type': 'application/json','User-Agent': 'Actual Budget'}- }).then(res => res.json());+ }).then((res) => res.json());res.send(JSON.stringify({@@ -342,7 +342,7 @@ app.post('Content-Type': 'application/json','User-Agent': 'Actual Budget'}- }).then(res => res.json());+ }).then((res) => res.json());res.send(JSON.stringify({diff --git a/app-sync.js b/app-sync.jsindex 0751f37619..bcc8a3c0ed 100644--- a/app-sync.js+++ b/app-sync.js@@ -136,7 +136,7 @@ app.post('/sync', async (req, res) => {let responsePb = new SyncPb.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.send(Buffer.from(responsePb.serializeBinary()));@@ -376,7 +376,7 @@ app.get('/list-user-files', (req, res) => {res.send(JSON.stringify({status: 'ok',- data: rows.map(row => ({+ data: rows.map((row) => ({deleted: row.deleted,fileId: row.id,groupId: row.group_id,diff --git a/app.js b/app.jsindex a44d6fefe0..e8f9b13205 100644--- a/app.js+++ b/app.js@@ -10,7 +10,7 @@ const syncApp = require('./app-sync');const app = express();-process.on('unhandledRejection', reason => {+process.on('unhandledRejection', (reason) => {console.log('Rejection:', reason);});@@ -59,7 +59,7 @@ async function run() {app.listen(config.port, config.hostname);}-run().catch(err => {+run().catch((err) => {console.log('Error starting app:', err);process.exit(1);});diff --git a/migrations/1632571489012_remove_cache.js b/migrations/1632571489012_remove_cache.jsindex 3d6b7c9ee5..a765bd6f63 100644--- a/migrations/1632571489012_remove_cache.js+++ b/migrations/1632571489012_remove_cache.js@@ -37,7 +37,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);true);db.transaction(() => {- budget.map(monthBudget => {+ budget.map((monthBudget) => {let match = monthBudget.name.match(/^(budget-report|budget)(\d+)!budget-(.+)$/);@@ -84,7 +84,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);true);db.transaction(() => {- buffers.map(buffer => {+ buffers.map((buffer) => {let match = buffer.name.match(/^budget(\d+)!buffered$/);if (match) {let month = match[1].slice(0, 4) + '-' + match[1].slice(4);@@ -108,7 +108,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);true);- let parseNote = str => {+ let parseNote = (str) => {try {let value = JSON.parse(str);return value && value !== '' ? value : null;@@ -118,7 +118,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);};db.transaction(() => {- notes.forEach(note => {+ notes.forEach((note) => {let parsed = parseNote(getValue(note));if (parsed) {let [, id] = note.name.split('!');diff --git a/sync-full.js b/sync-full.jsindex 8367f5bbe1..6c8be3544f 100644--- a/sync-full.js+++ b/sync-full.js@@ -15,7 +15,7 @@ const sync = sequential(async function syncAPI(messages, since, fileId) {await actual.internal.send('load-budget', { id: fileId });}- messages = messages.map(envPb => {+ messages = messages.map((envPb) => {let timestamp = envPb.getTimestamp();let msg = SyncPb.Message.deserializeBinary(envPb.getContent());return {@@ -27,11 +27,14 @@ const sync = sequential(async function syncAPI(messages, since, fileId) {};});- const newMessages = await actual.internal.syncAndReceiveMessages(messages, since);+ const newMessages = await actual.internal.syncAndReceiveMessages(+ messages,+ since+ );return {trie: actual.internal.timestamp.getClock().merkle,- newMessages: newMessages.map(msg => {+ newMessages: newMessages.map((msg) => {const envelopePb = new SyncPb.MessageEnvelope();const messagePb = new SyncPb.Message();diff --git a/sync-simple.js b/sync-simple.jsindex 7a53f68986..d33ed3951c 100644--- a/sync-simple.js+++ b/sync-simple.js@@ -74,7 +74,7 @@ function sync(messages, since, fileId) {`SELECT * FROM messages_binaryWHERE timestamp > ?ORDER BY timestamp`,- [since],+ [since]);let trie = addMessages(db, messages);diff --git a/util/async.js b/util/async.jsindex 71fca4fde3..5acc6c1b08 100644--- a/util/async.js+++ b/util/async.js@@ -17,11 +17,11 @@ function sequential(fn) {sequenceState.running = fn(...args);sequenceState.running.then(- val => {+ (val) => {pump();resolve(val);},- err => {+ (err) => {pump();reject(err);}diff --git a/util/handle-error.js b/util/handle-error.jsindex f2975261f9..6955150506 100644--- a/util/handle-error.js+++ b/util/handle-error.js@@ -1,11 +1,11 @@function handleError(func) {return (req, res) => {- func(req, res).catch(err => {- console.log('Error', req.originalUrl, err);+ func(req, res).catch((err) => {+ console.log('Error', req.originalUrl, err);res.status(500);res.send({ status: 'error', reason: 'internal-error' });});};}-module.exports = { handleError }+module.exports = { handleError };