@actual-app/core 26.5.0 → 26.5.1
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/@types/.tsbuildinfo +1 -1
- package/@types/migrations/1722804019000_create_dashboard_table.d.ts.map +1 -1
- package/@types/migrations/1765518577215_multiple_dashboards.d.ts.map +1 -1
- package/@types/src/mocks/budget.d.ts.map +1 -1
- package/@types/src/mocks/index.d.ts.map +1 -1
- package/@types/src/platform/client/connection/index.d.ts.map +1 -1
- package/@types/src/platform/client/connection/index.electron.d.ts.map +1 -1
- package/@types/src/platform/client/undo/index.d.ts +1 -1
- package/@types/src/platform/client/undo/index.d.ts.map +1 -1
- package/@types/src/platform/server/sqlite/index.electron.d.ts.map +1 -1
- package/@types/src/server/accounts/app.d.ts.map +1 -1
- package/@types/src/server/accounts/link.d.ts +1 -1
- package/@types/src/server/accounts/link.d.ts.map +1 -1
- package/@types/src/server/accounts/sync.d.ts.map +1 -1
- package/@types/src/server/cloud-storage.d.ts.map +1 -1
- package/@types/src/server/dashboard/app.d.ts +1 -1
- package/@types/src/server/dashboard/app.d.ts.map +1 -1
- package/@types/src/server/db/index.d.ts.map +1 -1
- package/@types/src/server/encryption/app.d.ts.map +1 -1
- package/@types/src/server/encryption/index.d.ts.map +1 -1
- package/@types/src/server/filters/app.d.ts.map +1 -1
- package/@types/src/server/importers/ynab4.d.ts.map +1 -1
- package/@types/src/server/importers/ynab5.d.ts.map +1 -1
- package/@types/src/server/reports/app.d.ts +1 -1
- package/@types/src/server/reports/app.d.ts.map +1 -1
- package/@types/src/server/schedules/app.d.ts.map +1 -1
- package/@types/src/server/schedules/find-schedules.d.ts.map +1 -1
- package/@types/src/server/util/budget-name.d.ts.map +1 -1
- package/@types/src/shared/transactions.d.ts.map +1 -1
- package/migrations/1722804019000_create_dashboard_table.js +7 -5
- package/migrations/1765518577215_multiple_dashboards.js +3 -1
- package/package.json +2 -1
- package/src/mocks/budget.ts +7 -6
- package/src/mocks/index.ts +8 -6
- package/src/mocks/setup.ts +6 -3
- package/src/platform/client/connection/index.electron.ts +2 -1
- package/src/platform/client/connection/index.ts +2 -1
- package/src/platform/client/undo/index.ts +4 -2
- package/src/platform/server/sqlite/index.electron.ts +2 -1
- package/src/server/accounts/app.ts +5 -4
- package/src/server/accounts/link.ts +2 -1
- package/src/server/accounts/sync.ts +4 -3
- package/src/server/cloud-storage.ts +2 -1
- package/src/server/dashboard/app.ts +2 -1
- package/src/server/db/index.ts +3 -2
- package/src/server/encryption/app.ts +3 -1
- package/src/server/encryption/index.ts +2 -1
- package/src/server/filters/app.ts +2 -1
- package/src/server/importers/ynab4.ts +3 -2
- package/src/server/importers/ynab5.ts +3 -2
- package/src/server/reports/app.ts +3 -1
- package/src/server/schedules/app.ts +2 -1
- package/src/server/schedules/find-schedules.ts +2 -1
- package/src/server/util/budget-name.ts +3 -4
- package/src/shared/transactions.ts +5 -3
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// @ts-strict-ignore
|
|
2
2
|
import * as dateFns from 'date-fns';
|
|
3
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
3
4
|
|
|
4
5
|
import * as asyncStorage from '#platform/server/asyncStorage';
|
|
5
6
|
import { logger } from '#platform/server/log';
|
|
@@ -322,7 +323,7 @@ async function resolvePayee(trans, payeeName, payeesToCreate) {
|
|
|
322
323
|
return payee.id;
|
|
323
324
|
} else {
|
|
324
325
|
// Otherwise we're going to create a new one
|
|
325
|
-
const newPayee = { id:
|
|
326
|
+
const newPayee = { id: uuidv4(), name: payeeName };
|
|
326
327
|
payeesToCreate.set(payeeName.toLowerCase(), newPayee);
|
|
327
328
|
return newPayee.id;
|
|
328
329
|
}
|
|
@@ -616,7 +617,7 @@ export async function reconcileTransactions(
|
|
|
616
617
|
const { forceAddTransaction: _forceAddTransaction, ...newTrans } = trans;
|
|
617
618
|
const finalTransaction = {
|
|
618
619
|
...newTrans,
|
|
619
|
-
id:
|
|
620
|
+
id: uuidv4(),
|
|
620
621
|
category: trans.category || null,
|
|
621
622
|
cleared: trans.cleared ?? defaultCleared,
|
|
622
623
|
};
|
|
@@ -880,7 +881,7 @@ export async function addTransactions(
|
|
|
880
881
|
const trans = await runRules(originalTrans, accountsMap);
|
|
881
882
|
|
|
882
883
|
const finalTransaction = {
|
|
883
|
-
id:
|
|
884
|
+
id: uuidv4(),
|
|
884
885
|
...trans,
|
|
885
886
|
account: acctId,
|
|
886
887
|
cleared: trans.cleared != null ? trans.cleared : true,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// @ts-strict-ignore
|
|
2
2
|
import AdmZip from 'adm-zip';
|
|
3
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
3
4
|
|
|
4
5
|
import * as asyncStorage from '#platform/server/asyncStorage';
|
|
5
6
|
import { fetch } from '#platform/server/fetch';
|
|
@@ -286,7 +287,7 @@ export async function upload() {
|
|
|
286
287
|
}
|
|
287
288
|
|
|
288
289
|
if (!cloudFileId) {
|
|
289
|
-
cloudFileId =
|
|
290
|
+
cloudFileId = uuidv4();
|
|
290
291
|
}
|
|
291
292
|
|
|
292
293
|
let res;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import isMatch from 'lodash/isMatch';
|
|
2
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
2
3
|
|
|
3
4
|
import { captureException } from '#platform/exceptions';
|
|
4
5
|
import * as fs from '#platform/server/fs';
|
|
@@ -101,7 +102,7 @@ const exportModel = {
|
|
|
101
102
|
};
|
|
102
103
|
|
|
103
104
|
async function createDashboardPage({ name }: { name: string }) {
|
|
104
|
-
const id =
|
|
105
|
+
const id = uuidv4();
|
|
105
106
|
await db.insertWithSchema('dashboard_pages', { id, name });
|
|
106
107
|
|
|
107
108
|
return id;
|
package/src/server/db/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
} from '@actual-app/crdt';
|
|
10
10
|
import type { Database, Statement } from '@jlongster/sql.js';
|
|
11
11
|
import { LRUCache } from 'lru-cache';
|
|
12
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
12
13
|
|
|
13
14
|
import * as fs from '#platform/server/fs';
|
|
14
15
|
import * as sqlite from '#platform/server/sqlite';
|
|
@@ -223,7 +224,7 @@ export async function update(table, params) {
|
|
|
223
224
|
|
|
224
225
|
export async function insertWithUUID(table, row) {
|
|
225
226
|
if (!row.id) {
|
|
226
|
-
row = { ...row, id:
|
|
227
|
+
row = { ...row, id: uuidv4() };
|
|
227
228
|
}
|
|
228
229
|
|
|
229
230
|
await insert(table, row);
|
|
@@ -292,7 +293,7 @@ export function insertWithSchema(table, row) {
|
|
|
292
293
|
// Even though `insertWithUUID` does this, we need to do it here so
|
|
293
294
|
// the schema validation passes
|
|
294
295
|
if (!row.id) {
|
|
295
|
-
row = { ...row, id:
|
|
296
|
+
row = { ...row, id: uuidv4() };
|
|
296
297
|
}
|
|
297
298
|
|
|
298
299
|
return insertWithUUID(
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
2
|
+
|
|
1
3
|
import * as asyncStorage from '#platform/server/asyncStorage';
|
|
2
4
|
import { logger } from '#platform/server/log';
|
|
3
5
|
import { createApp } from '#server/app';
|
|
@@ -28,7 +30,7 @@ async function keyMake({ password }: { password: string }) {
|
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
const salt = encryption.randomBytes(32).toString('base64');
|
|
31
|
-
const id =
|
|
33
|
+
const id = uuidv4();
|
|
32
34
|
const key = await encryption.createKey({ id, password, salt });
|
|
33
35
|
|
|
34
36
|
// Load the key
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// @ts-strict-ignore
|
|
2
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
2
3
|
|
|
3
4
|
import * as internals from '#server/encryption/encryption-internals';
|
|
4
5
|
|
|
@@ -11,7 +12,7 @@ class Key {
|
|
|
11
12
|
value;
|
|
12
13
|
|
|
13
14
|
constructor({ id }) {
|
|
14
|
-
this.id = id ||
|
|
15
|
+
this.id = id || uuidv4();
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
async createFromPassword({ password, salt }) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// @ts-strict-ignore
|
|
2
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
2
3
|
|
|
3
4
|
import { createApp } from '#server/app';
|
|
4
5
|
import * as db from '#server/db';
|
|
@@ -109,7 +110,7 @@ function filterOptionsMatch(options1, options2) {
|
|
|
109
110
|
}
|
|
110
111
|
|
|
111
112
|
async function createFilter(filter): Promise<TransactionFilterEntity['id']> {
|
|
112
|
-
const filterId =
|
|
113
|
+
const filterId = uuidv4();
|
|
113
114
|
const item = {
|
|
114
115
|
id: filterId,
|
|
115
116
|
conditions: filter.state.conditions,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// @ts-strict-ignore
|
|
2
2
|
import AdmZip from 'adm-zip';
|
|
3
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
3
4
|
|
|
4
5
|
import { logger } from '#platform/server/log';
|
|
5
6
|
import { send } from '#server/main-app';
|
|
@@ -164,11 +165,11 @@ async function importTransactions(
|
|
|
164
165
|
// Go ahead and generate ids for all of the transactions so we can
|
|
165
166
|
// reliably resolve transfers
|
|
166
167
|
for (const transaction of data.transactions) {
|
|
167
|
-
entityIdMap.set(transaction.entityId,
|
|
168
|
+
entityIdMap.set(transaction.entityId, uuidv4());
|
|
168
169
|
|
|
169
170
|
if (transaction.subTransactions) {
|
|
170
171
|
for (const subTransaction of transaction.subTransactions) {
|
|
171
|
-
entityIdMap.set(subTransaction.entityId,
|
|
172
|
+
entityIdMap.set(subTransaction.entityId, uuidv4());
|
|
172
173
|
}
|
|
173
174
|
}
|
|
174
175
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// @ts-strict-ignore
|
|
2
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
2
3
|
|
|
3
4
|
import { logger } from '#platform/server/log';
|
|
4
5
|
import { send } from '#server/main-app';
|
|
@@ -599,7 +600,7 @@ async function importTransactions(
|
|
|
599
600
|
// reliably resolve transfers
|
|
600
601
|
// Also identify orphan transfer transactions and subtransactions.
|
|
601
602
|
for (const transaction of data.subtransactions) {
|
|
602
|
-
entityIdMap.set(transaction.id,
|
|
603
|
+
entityIdMap.set(transaction.id, uuidv4());
|
|
603
604
|
|
|
604
605
|
if (transaction.transfer_account_id) {
|
|
605
606
|
orphanSubtransfer.push(transaction);
|
|
@@ -608,7 +609,7 @@ async function importTransactions(
|
|
|
608
609
|
}
|
|
609
610
|
|
|
610
611
|
for (const transaction of data.transactions) {
|
|
611
|
-
entityIdMap.set(transaction.id,
|
|
612
|
+
entityIdMap.set(transaction.id, uuidv4());
|
|
612
613
|
|
|
613
614
|
if (
|
|
614
615
|
transaction.transfer_account_id &&
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
2
|
+
|
|
1
3
|
import { createApp } from '#server/app';
|
|
2
4
|
import { aqlQuery } from '#server/aql';
|
|
3
5
|
import * as db from '#server/db';
|
|
@@ -128,7 +130,7 @@ async function reportNameExists(
|
|
|
128
130
|
}
|
|
129
131
|
|
|
130
132
|
async function createReport(report: CustomReportEntity) {
|
|
131
|
-
const reportId =
|
|
133
|
+
const reportId = uuidv4();
|
|
132
134
|
const item: CustomReportEntity = {
|
|
133
135
|
...report,
|
|
134
136
|
id: reportId,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// @ts-strict-ignore
|
|
2
2
|
import * as d from 'date-fns';
|
|
3
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
3
4
|
|
|
4
5
|
import { captureBreadcrumb } from '#platform/exceptions';
|
|
5
6
|
import * as connection from '#platform/server/connection';
|
|
@@ -254,7 +255,7 @@ export async function createSchedule({
|
|
|
254
255
|
schedule = null,
|
|
255
256
|
conditions = [],
|
|
256
257
|
} = {}): Promise<ScheduleEntity['id']> {
|
|
257
|
-
const scheduleId = schedule?.id ||
|
|
258
|
+
const scheduleId = schedule?.id || uuidv4();
|
|
258
259
|
|
|
259
260
|
const { date: dateCond } = extractScheduleConds(conditions);
|
|
260
261
|
if (dateCond == null) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// @ts-strict-ignore
|
|
2
2
|
import * as d from 'date-fns';
|
|
3
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
3
4
|
|
|
4
5
|
import { aqlQuery } from '#server/aql';
|
|
5
6
|
import * as db from '#server/db';
|
|
@@ -359,7 +360,7 @@ export async function findSchedules() {
|
|
|
359
360
|
|
|
360
361
|
// Convert to schedule and return it
|
|
361
362
|
return {
|
|
362
|
-
id:
|
|
363
|
+
id: uuidv4(),
|
|
363
364
|
account: winner.account,
|
|
364
365
|
payee: winner.payee,
|
|
365
366
|
date: winner.date,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
2
|
+
|
|
1
3
|
import * as fs from '#platform/server/fs';
|
|
2
4
|
import { handlers } from '#server/main';
|
|
3
5
|
|
|
@@ -37,10 +39,7 @@ export async function validateBudgetName(
|
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
export async function idFromBudgetName(name: string): Promise<string> {
|
|
40
|
-
let id =
|
|
41
|
-
name.replace(/( |[^A-Za-z0-9])/g, '-') +
|
|
42
|
-
'-' +
|
|
43
|
-
crypto.randomUUID().slice(0, 7);
|
|
42
|
+
let id = name.replace(/( |[^A-Za-z0-9])/g, '-') + '-' + uuidv4().slice(0, 7);
|
|
44
43
|
|
|
45
44
|
// Make sure the id is unique. There's a chance one could already
|
|
46
45
|
// exist (although very unlikely now that we append unique
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
2
|
+
|
|
1
3
|
import { logger } from '#platform/server/log';
|
|
2
4
|
import type { TransactionEntity } from '#types/models';
|
|
3
5
|
|
|
@@ -39,7 +41,7 @@ export function makeChild<T extends GenericTransactionEntity>(
|
|
|
39
41
|
...data,
|
|
40
42
|
category: 'category' in data ? data.category : parent.category,
|
|
41
43
|
payee: 'payee' in data ? data.payee : parent.payee,
|
|
42
|
-
id: 'id' in data ? data.id : prefix +
|
|
44
|
+
id: 'id' in data ? data.id : prefix + uuidv4(),
|
|
43
45
|
account: parent.account,
|
|
44
46
|
date: parent.date,
|
|
45
47
|
cleared: parent.cleared != null ? parent.cleared : null,
|
|
@@ -357,7 +359,7 @@ export function realizeTempTransactions(
|
|
|
357
359
|
): TransactionEntity[] {
|
|
358
360
|
const parent = {
|
|
359
361
|
...transactions.find(t => !t.is_child),
|
|
360
|
-
id:
|
|
362
|
+
id: uuidv4(),
|
|
361
363
|
sort_order: Date.now(),
|
|
362
364
|
} as TransactionEntity;
|
|
363
365
|
const children = transactions.filter(t => t.is_child);
|
|
@@ -367,7 +369,7 @@ export function realizeTempTransactions(
|
|
|
367
369
|
child =>
|
|
368
370
|
({
|
|
369
371
|
...child,
|
|
370
|
-
id:
|
|
372
|
+
id: uuidv4(),
|
|
371
373
|
parent_id: parent.id,
|
|
372
374
|
}) satisfies TransactionEntity,
|
|
373
375
|
),
|