@actual-app/api 26.5.0 → 26.5.2
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/dist/index.js
CHANGED
|
@@ -38,9 +38,9 @@ let path = require("path");
|
|
|
38
38
|
path = __toESM(path);
|
|
39
39
|
let better_sqlite3 = require("better-sqlite3");
|
|
40
40
|
better_sqlite3 = __toESM(better_sqlite3);
|
|
41
|
+
let node_crypto = require("node:crypto");
|
|
41
42
|
let crypto$1 = require("crypto");
|
|
42
43
|
crypto$1 = __toESM(crypto$1);
|
|
43
|
-
let node_crypto = require("node:crypto");
|
|
44
44
|
//#region ../../node_modules/google-protobuf/google-protobuf.js
|
|
45
45
|
var require_google_protobuf = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
46
46
|
var aa = "function" == typeof Object.defineProperties ? Object.defineProperty : function(a, b, c) {
|
|
@@ -3533,6 +3533,45 @@ var getNumClients = function() {
|
|
|
3533
3533
|
return 1;
|
|
3534
3534
|
};
|
|
3535
3535
|
//#endregion
|
|
3536
|
+
//#region ../../node_modules/uuid/dist/stringify.js
|
|
3537
|
+
var byteToHex = [];
|
|
3538
|
+
for (let i = 0; i < 256; ++i) byteToHex.push((i + 256).toString(16).slice(1));
|
|
3539
|
+
function unsafeStringify(arr, offset = 0) {
|
|
3540
|
+
return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
|
3541
|
+
}
|
|
3542
|
+
//#endregion
|
|
3543
|
+
//#region ../../node_modules/uuid/dist/rng.js
|
|
3544
|
+
var getRandomValues;
|
|
3545
|
+
var rnds8 = new Uint8Array(16);
|
|
3546
|
+
function rng() {
|
|
3547
|
+
if (!getRandomValues) {
|
|
3548
|
+
if (typeof crypto === "undefined" || !crypto.getRandomValues) throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
3549
|
+
getRandomValues = crypto.getRandomValues.bind(crypto);
|
|
3550
|
+
}
|
|
3551
|
+
return getRandomValues(rnds8);
|
|
3552
|
+
}
|
|
3553
|
+
var native_default = { randomUUID: typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto) };
|
|
3554
|
+
//#endregion
|
|
3555
|
+
//#region ../../node_modules/uuid/dist/v4.js
|
|
3556
|
+
function _v4(options, buf, offset) {
|
|
3557
|
+
options = options || {};
|
|
3558
|
+
const rnds = options.random ?? options.rng?.() ?? rng();
|
|
3559
|
+
if (rnds.length < 16) throw new Error("Random bytes length must be >= 16");
|
|
3560
|
+
rnds[6] = rnds[6] & 15 | 64;
|
|
3561
|
+
rnds[8] = rnds[8] & 63 | 128;
|
|
3562
|
+
if (buf) {
|
|
3563
|
+
offset = offset || 0;
|
|
3564
|
+
if (offset < 0 || offset + 16 > buf.length) throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
|
|
3565
|
+
for (let i = 0; i < 16; ++i) buf[offset + i] = rnds[i];
|
|
3566
|
+
return buf;
|
|
3567
|
+
}
|
|
3568
|
+
return unsafeStringify(rnds);
|
|
3569
|
+
}
|
|
3570
|
+
function v4(options, buf, offset) {
|
|
3571
|
+
if (native_default.randomUUID && !buf && !options) return native_default.randomUUID();
|
|
3572
|
+
return _v4(options, buf, offset);
|
|
3573
|
+
}
|
|
3574
|
+
//#endregion
|
|
3536
3575
|
//#region ../loot-core/src/shared/normalisation.ts
|
|
3537
3576
|
var iMap = {
|
|
3538
3577
|
ł: "l",
|
|
@@ -4288,7 +4327,7 @@ function closeDatabase$1(db) {
|
|
|
4288
4327
|
db.close();
|
|
4289
4328
|
}
|
|
4290
4329
|
async function exportDatabase(db) {
|
|
4291
|
-
const name = `${getDataDir()}/backup-for-export-${
|
|
4330
|
+
const name = `${getDataDir()}/backup-for-export-${v4()}.db`;
|
|
4292
4331
|
await db.backup(name);
|
|
4293
4332
|
const data = await readFile(name, "binary");
|
|
4294
4333
|
await removeFile$1(name);
|
|
@@ -12072,6 +12111,7 @@ var import_dist = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((expor
|
|
|
12072
12111
|
}) : target, mod));
|
|
12073
12112
|
var murmurhash = require_murmurhash();
|
|
12074
12113
|
murmurhash = __toESM(murmurhash);
|
|
12114
|
+
var node_crypto$1 = require("node:crypto");
|
|
12075
12115
|
(/* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
12076
12116
|
/**
|
|
12077
12117
|
* @fileoverview
|
|
@@ -13151,6 +13191,39 @@ var import_dist = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((expor
|
|
|
13151
13191
|
return debug(node, key, indent + 2);
|
|
13152
13192
|
}).join("");
|
|
13153
13193
|
}
|
|
13194
|
+
var byteToHex = [];
|
|
13195
|
+
for (let i = 0; i < 256; ++i) byteToHex.push((i + 256).toString(16).slice(1));
|
|
13196
|
+
function unsafeStringify(arr, offset = 0) {
|
|
13197
|
+
return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
|
13198
|
+
}
|
|
13199
|
+
var rnds8Pool = new Uint8Array(256);
|
|
13200
|
+
var poolPtr = rnds8Pool.length;
|
|
13201
|
+
function rng() {
|
|
13202
|
+
if (poolPtr > rnds8Pool.length - 16) {
|
|
13203
|
+
(0, node_crypto$1.randomFillSync)(rnds8Pool);
|
|
13204
|
+
poolPtr = 0;
|
|
13205
|
+
}
|
|
13206
|
+
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
|
13207
|
+
}
|
|
13208
|
+
var native_default = { randomUUID: node_crypto$1.randomUUID };
|
|
13209
|
+
function _v4(options, buf, offset) {
|
|
13210
|
+
options = options || {};
|
|
13211
|
+
const rnds = options.random ?? options.rng?.() ?? rng();
|
|
13212
|
+
if (rnds.length < 16) throw new Error("Random bytes length must be >= 16");
|
|
13213
|
+
rnds[6] = rnds[6] & 15 | 64;
|
|
13214
|
+
rnds[8] = rnds[8] & 63 | 128;
|
|
13215
|
+
if (buf) {
|
|
13216
|
+
offset = offset || 0;
|
|
13217
|
+
if (offset < 0 || offset + 16 > buf.length) throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
|
|
13218
|
+
for (let i = 0; i < 16; ++i) buf[offset + i] = rnds[i];
|
|
13219
|
+
return buf;
|
|
13220
|
+
}
|
|
13221
|
+
return unsafeStringify(rnds);
|
|
13222
|
+
}
|
|
13223
|
+
function v4(options, buf, offset) {
|
|
13224
|
+
if (native_default.randomUUID && !buf && !options) return native_default.randomUUID();
|
|
13225
|
+
return _v4(options, buf, offset);
|
|
13226
|
+
}
|
|
13154
13227
|
var clock;
|
|
13155
13228
|
function setClock(clock_) {
|
|
13156
13229
|
clock = clock_;
|
|
@@ -13188,7 +13261,7 @@ var import_dist = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((expor
|
|
|
13188
13261
|
};
|
|
13189
13262
|
}
|
|
13190
13263
|
function makeClientId() {
|
|
13191
|
-
return
|
|
13264
|
+
return v4().replace(/-/g, "").slice(-16);
|
|
13192
13265
|
}
|
|
13193
13266
|
var config = { maxDrift: 300 * 1e3 };
|
|
13194
13267
|
var MAX_COUNTER = parseInt("0xFFFF");
|
|
@@ -62227,7 +62300,7 @@ var Key = class {
|
|
|
62227
62300
|
id;
|
|
62228
62301
|
value;
|
|
62229
62302
|
constructor({ id }) {
|
|
62230
|
-
this.id = id ||
|
|
62303
|
+
this.id = id || v4();
|
|
62231
62304
|
}
|
|
62232
62305
|
async createFromPassword({ password, salt }) {
|
|
62233
62306
|
this.value = await createKey$1({
|
|
@@ -64525,7 +64598,7 @@ async function upload() {
|
|
|
64525
64598
|
uploadContent = encrypted.value;
|
|
64526
64599
|
uploadMeta = encrypted.meta;
|
|
64527
64600
|
}
|
|
64528
|
-
if (!cloudFileId) cloudFileId =
|
|
64601
|
+
if (!cloudFileId) cloudFileId = v4();
|
|
64529
64602
|
let res;
|
|
64530
64603
|
try {
|
|
64531
64604
|
res = await fetchJSON(getServer().SYNC_SERVER + "/upload-user-file", {
|
|
@@ -65400,7 +65473,7 @@ async function update(table, params) {
|
|
|
65400
65473
|
async function insertWithUUID(table, row) {
|
|
65401
65474
|
if (!row.id) row = {
|
|
65402
65475
|
...row,
|
|
65403
|
-
id:
|
|
65476
|
+
id: v4()
|
|
65404
65477
|
};
|
|
65405
65478
|
await insert(table, row);
|
|
65406
65479
|
return row.id;
|
|
@@ -65443,7 +65516,7 @@ async function selectFirstWithSchema(table, sql, params) {
|
|
|
65443
65516
|
function insertWithSchema(table, row) {
|
|
65444
65517
|
if (!row.id) row = {
|
|
65445
65518
|
...row,
|
|
65446
|
-
id:
|
|
65519
|
+
id: v4()
|
|
65447
65520
|
};
|
|
65448
65521
|
return insertWithUUID(table, convertForInsert(schema, schemaConfig, table, row));
|
|
65449
65522
|
}
|
|
@@ -65829,7 +65902,7 @@ async function findOrCreateBank(institution, requisitionId) {
|
|
|
65829
65902
|
const bank = await first$2("SELECT id, bank_id FROM banks WHERE bank_id = ?", [requisitionId]);
|
|
65830
65903
|
if (bank) return bank;
|
|
65831
65904
|
const bankData = {
|
|
65832
|
-
id:
|
|
65905
|
+
id: v4(),
|
|
65833
65906
|
bank_id: requisitionId,
|
|
65834
65907
|
name: institution.name
|
|
65835
65908
|
};
|
|
@@ -110023,7 +110096,7 @@ function makeChild(parent, data = {}) {
|
|
|
110023
110096
|
...data,
|
|
110024
110097
|
category: "category" in data ? data.category : parent.category,
|
|
110025
110098
|
payee: "payee" in data ? data.payee : parent.payee,
|
|
110026
|
-
id: "id" in data ? data.id : prefix +
|
|
110099
|
+
id: "id" in data ? data.id : prefix + v4(),
|
|
110027
110100
|
account: parent.account,
|
|
110028
110101
|
date: parent.date,
|
|
110029
110102
|
cleared: parent.cleared != null ? parent.cleared : null,
|
|
@@ -111430,7 +111503,7 @@ async function resolvePayee(trans, payeeName, payeesToCreate) {
|
|
|
111430
111503
|
if (payee != null) return payee.id;
|
|
111431
111504
|
else {
|
|
111432
111505
|
const newPayee = {
|
|
111433
|
-
id:
|
|
111506
|
+
id: v4(),
|
|
111434
111507
|
name: payeeName
|
|
111435
111508
|
};
|
|
111436
111509
|
payeesToCreate.set(payeeName.toLowerCase(), newPayee);
|
|
@@ -111597,7 +111670,7 @@ async function reconcileTransactions(acctId, transactions, isBankSyncAccount = f
|
|
|
111597
111670
|
const { forceAddTransaction: _forceAddTransaction, ...newTrans } = trans;
|
|
111598
111671
|
const finalTransaction = {
|
|
111599
111672
|
...newTrans,
|
|
111600
|
-
id:
|
|
111673
|
+
id: v4(),
|
|
111601
111674
|
category: trans.category || null,
|
|
111602
111675
|
cleared: trans.cleared ?? defaultCleared
|
|
111603
111676
|
};
|
|
@@ -111721,7 +111794,7 @@ async function addTransactions$1(acctId, transactions, { runTransfers = true, le
|
|
|
111721
111794
|
for (const { trans: originalTrans, subtransactions } of normalized) {
|
|
111722
111795
|
const trans = await runRules$1(originalTrans, accountsMap);
|
|
111723
111796
|
const finalTransaction = {
|
|
111724
|
-
id:
|
|
111797
|
+
id: v4(),
|
|
111725
111798
|
...trans,
|
|
111726
111799
|
account: acctId,
|
|
111727
111800
|
cleared: trans.cleared != null ? trans.cleared : true
|
|
@@ -111922,7 +111995,7 @@ async function linkGoCardlessAccount({ requisitionId, account, upgradingId, offB
|
|
|
111922
111995
|
account_sync_source: "goCardless"
|
|
111923
111996
|
});
|
|
111924
111997
|
} else {
|
|
111925
|
-
id =
|
|
111998
|
+
id = v4();
|
|
111926
111999
|
await insertWithUUID("accounts", {
|
|
111927
112000
|
id,
|
|
111928
112001
|
account_id: account.account_id,
|
|
@@ -111959,7 +112032,7 @@ async function linkSimpleFinAccount({ externalAccount, upgradingId, offBudget =
|
|
|
111959
112032
|
account_sync_source: "simpleFin"
|
|
111960
112033
|
});
|
|
111961
112034
|
} else {
|
|
111962
|
-
id =
|
|
112035
|
+
id = v4();
|
|
111963
112036
|
await insertWithUUID("accounts", {
|
|
111964
112037
|
id,
|
|
111965
112038
|
account_id: externalAccount.account_id,
|
|
@@ -111995,7 +112068,7 @@ async function linkPluggyAiAccount({ externalAccount, upgradingId, offBudget = f
|
|
|
111995
112068
|
account_sync_source: "pluggyai"
|
|
111996
112069
|
});
|
|
111997
112070
|
} else {
|
|
111998
|
-
id =
|
|
112071
|
+
id = v4();
|
|
111999
112072
|
await insertWithUUID("accounts", {
|
|
112000
112073
|
id,
|
|
112001
112074
|
account_id: externalAccount.account_id,
|
|
@@ -112075,7 +112148,7 @@ async function closeAccount$1({ id, transferAccountId, categoryId, forced = fals
|
|
|
112075
112148
|
const transferPayee = await first$2("SELECT id FROM payees WHERE transfer_acct = ?", [transferAccountId]);
|
|
112076
112149
|
if (!transferPayee) throw new Error(`Transfer payee with account ID ${transferAccountId} not found.`);
|
|
112077
112150
|
await app$19.handlers["transaction-add"]({
|
|
112078
|
-
id:
|
|
112151
|
+
id: v4(),
|
|
112079
112152
|
payee: transferPayee.id,
|
|
112080
112153
|
amount: -balance,
|
|
112081
112154
|
account: id,
|
|
@@ -114651,7 +114724,7 @@ async function findSchedules() {
|
|
|
114651
114724
|
schedules.sort((s1, s2) => s2.rank - s1.rank);
|
|
114652
114725
|
const winner = schedules[0];
|
|
114653
114726
|
return {
|
|
114654
|
-
id:
|
|
114727
|
+
id: v4(),
|
|
114655
114728
|
account: winner.account,
|
|
114656
114729
|
payee: winner.payee,
|
|
114657
114730
|
date: winner.date,
|
|
@@ -114791,7 +114864,7 @@ async function checkIfScheduleExists(name, scheduleId) {
|
|
|
114791
114864
|
return true;
|
|
114792
114865
|
}
|
|
114793
114866
|
async function createSchedule$1({ schedule = null, conditions = [] } = {}) {
|
|
114794
|
-
const scheduleId = schedule?.id ||
|
|
114867
|
+
const scheduleId = schedule?.id || v4();
|
|
114795
114868
|
const { date: dateCond } = extractScheduleConds(conditions);
|
|
114796
114869
|
if (dateCond == null) throw new Error("A date condition is required to create a schedule");
|
|
114797
114870
|
if (dateCond.value == null) throw new Error("Date is required");
|
|
@@ -118617,7 +118690,7 @@ async function fillPrimaryChecking(handlers, account, payees, groups) {
|
|
|
118617
118690
|
else amount = integer(0, random() < .05 ? -8e3 : -700);
|
|
118618
118691
|
const currentDate = subDays(currentDay(), Math.floor(i / 3));
|
|
118619
118692
|
const transaction = {
|
|
118620
|
-
id:
|
|
118693
|
+
id: v4(),
|
|
118621
118694
|
amount,
|
|
118622
118695
|
payee: payee.id,
|
|
118623
118696
|
account: account.id,
|
|
@@ -118630,21 +118703,21 @@ async function fillPrimaryChecking(handlers, account, payees, groups) {
|
|
|
118630
118703
|
const pick = () => payee === incomePayee ? incomeGroup.categories.find((c) => c.name === "Income").id : pickRandom(expenseCategories).id;
|
|
118631
118704
|
transaction.subtransactions = [
|
|
118632
118705
|
{
|
|
118633
|
-
id:
|
|
118706
|
+
id: v4(),
|
|
118634
118707
|
date: currentDate,
|
|
118635
118708
|
account: account.id,
|
|
118636
118709
|
amount: a,
|
|
118637
118710
|
category: pick()
|
|
118638
118711
|
},
|
|
118639
118712
|
{
|
|
118640
|
-
id:
|
|
118713
|
+
id: v4(),
|
|
118641
118714
|
date: currentDate,
|
|
118642
118715
|
account: account.id,
|
|
118643
118716
|
amount: a,
|
|
118644
118717
|
category: pick()
|
|
118645
118718
|
},
|
|
118646
118719
|
{
|
|
118647
|
-
id:
|
|
118720
|
+
id: v4(),
|
|
118648
118721
|
date: currentDate,
|
|
118649
118722
|
account: account.id,
|
|
118650
118723
|
amount: transaction.amount - a * 2,
|
|
@@ -118838,7 +118911,7 @@ async function fillOther(handlers, account, payees, groups) {
|
|
|
118838
118911
|
const numTransactions = integer(3, 6);
|
|
118839
118912
|
const category = incomeGroup.categories.find((c) => c.name === "Income");
|
|
118840
118913
|
const transactions = [{
|
|
118841
|
-
id:
|
|
118914
|
+
id: v4(),
|
|
118842
118915
|
amount: integer(3250, 3700) * 100 * 100,
|
|
118843
118916
|
payee: payees.find((p) => p.name === "Starting Balance").id,
|
|
118844
118917
|
account: account.id,
|
|
@@ -118850,7 +118923,7 @@ async function fillOther(handlers, account, payees, groups) {
|
|
|
118850
118923
|
const payee = incomePayee;
|
|
118851
118924
|
const amount = integer(4, 9) * 100 * 100;
|
|
118852
118925
|
transactions.push({
|
|
118853
|
-
id:
|
|
118926
|
+
id: v4(),
|
|
118854
118927
|
amount,
|
|
118855
118928
|
payee: payee.id,
|
|
118856
118929
|
account: account.id,
|
|
@@ -119331,8 +119404,8 @@ async function importTransactions$2(data, entityIdMap) {
|
|
|
119331
119404
|
return acct.offbudget;
|
|
119332
119405
|
}
|
|
119333
119406
|
for (const transaction of data.transactions) {
|
|
119334
|
-
entityIdMap.set(transaction.entityId,
|
|
119335
|
-
if (transaction.subTransactions) for (const subTransaction of transaction.subTransactions) entityIdMap.set(subTransaction.entityId,
|
|
119407
|
+
entityIdMap.set(transaction.entityId, v4());
|
|
119408
|
+
if (transaction.subTransactions) for (const subTransaction of transaction.subTransactions) entityIdMap.set(subTransaction.entityId, v4());
|
|
119336
119409
|
}
|
|
119337
119410
|
const transactionsGrouped = groupBy$1(data.transactions, "accountId");
|
|
119338
119411
|
await Promise.all([...transactionsGrouped.keys()].map(async (accountId) => {
|
|
@@ -119858,14 +119931,14 @@ async function importTransactions$1(data, entityIdMap, flagNameConflicts) {
|
|
|
119858
119931
|
const orphanSubtransferAcctIdByTrxIdMap = /* @__PURE__ */ new Map();
|
|
119859
119932
|
const orphanSubtransferDateByTrxIdMap = /* @__PURE__ */ new Map();
|
|
119860
119933
|
for (const transaction of data.subtransactions) {
|
|
119861
|
-
entityIdMap.set(transaction.id,
|
|
119934
|
+
entityIdMap.set(transaction.id, v4());
|
|
119862
119935
|
if (transaction.transfer_account_id) {
|
|
119863
119936
|
orphanSubtransfer.push(transaction);
|
|
119864
119937
|
orphanSubtransferTrxId.push(transaction.transaction_id);
|
|
119865
119938
|
}
|
|
119866
119939
|
}
|
|
119867
119940
|
for (const transaction of data.transactions) {
|
|
119868
|
-
entityIdMap.set(transaction.id,
|
|
119941
|
+
entityIdMap.set(transaction.id, v4());
|
|
119869
119942
|
if (transaction.transfer_account_id && !transaction.transfer_transaction_id) {
|
|
119870
119943
|
const key = transaction.account_id + "#" + transaction.transfer_account_id;
|
|
119871
119944
|
if (!orphanTransferMap.has(key)) orphanTransferMap.set(key, [transaction]);
|
|
@@ -120625,7 +120698,7 @@ async function runMigration$2(db) {
|
|
|
120625
120698
|
if (reports.length === 0) {
|
|
120626
120699
|
DEFAULT_DASHBOARD_STATE.forEach((widget) => {
|
|
120627
120700
|
db.runQuery(`INSERT INTO dashboard (id, type, width, height, x, y, meta) VALUES (?, ?, ?, ?, ?, ?, ?)`, [
|
|
120628
|
-
|
|
120701
|
+
v4(),
|
|
120629
120702
|
widget.type,
|
|
120630
120703
|
widget.width,
|
|
120631
120704
|
widget.height,
|
|
@@ -120639,13 +120712,13 @@ async function runMigration$2(db) {
|
|
|
120639
120712
|
db.execQuery(`
|
|
120640
120713
|
INSERT INTO dashboard (id, type, width, height, x, y)
|
|
120641
120714
|
VALUES
|
|
120642
|
-
('${
|
|
120643
|
-
('${
|
|
120644
|
-
('${
|
|
120715
|
+
('${v4()}', 'net-worth-card', 8, 2, 0, 0),
|
|
120716
|
+
('${v4()}', 'cash-flow-card', 4, 2, 8, 0),
|
|
120717
|
+
('${v4()}', 'spending-card', 4, 2, 0, 2);
|
|
120645
120718
|
`);
|
|
120646
120719
|
reports.forEach((report, id) => {
|
|
120647
120720
|
db.runQuery(`INSERT INTO dashboard (id, type, width, height, x, y, meta) VALUES (?, ?, ?, ?, ?, ?, ?)`, [
|
|
120648
|
-
|
|
120721
|
+
v4(),
|
|
120649
120722
|
"custom-report",
|
|
120650
120723
|
4,
|
|
120651
120724
|
2,
|
|
@@ -120705,7 +120778,7 @@ async function runMigration(db) {
|
|
|
120705
120778
|
db.execQuery(`
|
|
120706
120779
|
ALTER TABLE dashboard ADD COLUMN dashboard_page_id TEXT;
|
|
120707
120780
|
`);
|
|
120708
|
-
const defaultDashboardId =
|
|
120781
|
+
const defaultDashboardId = v4();
|
|
120709
120782
|
db.runQuery(`INSERT INTO dashboard_pages (id, name) VALUES (?, ?)`, [defaultDashboardId, "Main"]);
|
|
120710
120783
|
db.runQuery(`UPDATE dashboard SET dashboard_page_id = ?`, [defaultDashboardId]);
|
|
120711
120784
|
});
|
|
@@ -120846,7 +120919,7 @@ async function validateBudgetName(name) {
|
|
|
120846
120919
|
} : { valid: true };
|
|
120847
120920
|
}
|
|
120848
120921
|
async function idFromBudgetName(name) {
|
|
120849
|
-
let id = name.replace(/( |[^A-Za-z0-9])/g, "-") + "-" +
|
|
120922
|
+
let id = name.replace(/( |[^A-Za-z0-9])/g, "-") + "-" + v4().slice(0, 7);
|
|
120850
120923
|
let index = 0;
|
|
120851
120924
|
let budgetDir = getBudgetDir(id);
|
|
120852
120925
|
while (await exists$1(budgetDir)) {
|
|
@@ -123366,7 +123439,7 @@ async function reportNameExists(name, reportId, newItem) {
|
|
|
123366
123439
|
return true;
|
|
123367
123440
|
}
|
|
123368
123441
|
async function createReport(report) {
|
|
123369
|
-
const reportId =
|
|
123442
|
+
const reportId = v4();
|
|
123370
123443
|
const item = {
|
|
123371
123444
|
...report,
|
|
123372
123445
|
id: reportId
|
|
@@ -123431,7 +123504,7 @@ var exportModel = { validate(dashboard) {
|
|
|
123431
123504
|
});
|
|
123432
123505
|
} };
|
|
123433
123506
|
async function createDashboardPage({ name }) {
|
|
123434
|
-
const id =
|
|
123507
|
+
const id = v4();
|
|
123435
123508
|
await insertWithSchema("dashboard_pages", {
|
|
123436
123509
|
id,
|
|
123437
123510
|
name
|
|
@@ -123563,7 +123636,7 @@ async function keyMake({ password }) {
|
|
|
123563
123636
|
if (!getPrefs()) throw new Error("key-make must be called with file loaded");
|
|
123564
123637
|
const salt = randomBytes(32).toString("base64");
|
|
123565
123638
|
const key = await createKey({
|
|
123566
|
-
id:
|
|
123639
|
+
id: v4(),
|
|
123567
123640
|
password,
|
|
123568
123641
|
salt
|
|
123569
123642
|
});
|
|
@@ -123671,7 +123744,7 @@ function filterOptionsMatch(options1, options2) {
|
|
|
123671
123744
|
return keys1.every((key) => opt1[key] === opt2[key]);
|
|
123672
123745
|
}
|
|
123673
123746
|
async function createFilter(filter) {
|
|
123674
|
-
const filterId =
|
|
123747
|
+
const filterId = v4();
|
|
123675
123748
|
const item = {
|
|
123676
123749
|
id: filterId,
|
|
123677
123750
|
conditions: filter.state.conditions,
|