@actual-app/api 6.10.0 → 24.10.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/loot-core/client/constants.d.ts +1 -0
- package/@types/loot-core/client/state-types/modals.d.ts +17 -11
- package/@types/loot-core/client/state-types/prefs.d.ts +12 -5
- package/@types/loot-core/client/state-types/queries.d.ts +4 -4
- package/@types/loot-core/mocks/index.d.ts +2 -7
- package/@types/loot-core/server/accounts/rules.d.ts +3 -4
- package/@types/loot-core/server/aql/schema/index.d.ts +8 -0
- package/@types/loot-core/server/db/index.d.ts +2 -2
- package/@types/loot-core/server/main-app.d.ts +1 -1
- package/@types/loot-core/server/preferences/app.d.ts +12 -0
- package/@types/loot-core/server/preferences/types/handlers.d.ts +10 -0
- package/@types/loot-core/server/prefs.d.ts +4 -6
- package/@types/loot-core/server/util/rschedule.d.ts +0 -1
- package/@types/loot-core/shared/errors.d.ts +1 -1
- package/@types/loot-core/shared/months.d.ts +2 -0
- package/@types/loot-core/shared/rules.d.ts +5 -32
- package/@types/loot-core/shared/transactions.d.ts +2 -0
- package/@types/loot-core/shared/util.d.ts +4 -2
- package/@types/loot-core/types/handlers.d.ts +2 -0
- package/@types/loot-core/types/models/dashboard.d.ts +37 -4
- package/@types/loot-core/types/models/reports.d.ts +3 -13
- package/@types/loot-core/types/models/rule.d.ts +4 -1
- package/@types/loot-core/types/models/schedule.d.ts +18 -14
- package/@types/loot-core/types/models/transaction-filter.d.ts +4 -2
- package/@types/loot-core/types/models/transaction.d.ts +2 -0
- package/@types/loot-core/types/prefs.d.ts +38 -50
- package/@types/loot-core/types/server-events.d.ts +1 -0
- package/@types/loot-core/types/server-handlers.d.ts +4 -6
- package/@types/loot-core/types/util.d.ts +2 -0
- package/@types/migrations/1723665565000_prefs.d.ts +4 -0
- package/dist/app/bundle.api.js +1172 -781
- package/dist/migrations/1723665565000_prefs.js +51 -0
- package/dist/package.json +1 -1
- package/package.json +1 -1
- /package/@types/loot-core/server/budget/{rollover.d.ts → envelope.d.ts} +0 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = runMigration;
|
|
4
|
+
const SYNCED_PREF_KEYS = [
|
|
5
|
+
'firstDayOfWeekIdx',
|
|
6
|
+
'dateFormat',
|
|
7
|
+
'numberFormat',
|
|
8
|
+
'hideFraction',
|
|
9
|
+
'isPrivacyEnabled',
|
|
10
|
+
/^show-extra-balances-/,
|
|
11
|
+
/^hide-cleared-/,
|
|
12
|
+
/^parse-date-/,
|
|
13
|
+
/^csv-mappings-/,
|
|
14
|
+
/^csv-delimiter-/,
|
|
15
|
+
/^csv-has-header-/,
|
|
16
|
+
/^ofx-fallback-missing-payee-/,
|
|
17
|
+
/^flip-amount-/,
|
|
18
|
+
'budgetType',
|
|
19
|
+
/^flags\./,
|
|
20
|
+
];
|
|
21
|
+
async function runMigration(db, { fs, fileId }) {
|
|
22
|
+
await db.execQuery(`
|
|
23
|
+
CREATE TABLE preferences
|
|
24
|
+
(id TEXT PRIMARY KEY,
|
|
25
|
+
value TEXT);
|
|
26
|
+
`);
|
|
27
|
+
try {
|
|
28
|
+
const budgetDir = fs.getBudgetDir(fileId);
|
|
29
|
+
const fullpath = fs.join(budgetDir, 'metadata.json');
|
|
30
|
+
const prefs = JSON.parse(await fs.readFile(fullpath));
|
|
31
|
+
if (typeof prefs !== 'object') {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
await Promise.all(Object.keys(prefs).map(async (key) => {
|
|
35
|
+
// Check if the current key is of synced-keys type
|
|
36
|
+
if (!SYNCED_PREF_KEYS.find(keyMatcher => keyMatcher instanceof RegExp
|
|
37
|
+
? keyMatcher.test(key)
|
|
38
|
+
: keyMatcher === key)) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
// insert the synced prefs in the new table
|
|
42
|
+
await db.runQuery('INSERT INTO preferences (id, value) VALUES (?, ?)', [
|
|
43
|
+
key,
|
|
44
|
+
String(prefs[key]),
|
|
45
|
+
]);
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
catch (e) {
|
|
49
|
+
// Do nothing
|
|
50
|
+
}
|
|
51
|
+
}
|
package/dist/package.json
CHANGED
package/package.json
CHANGED
|
File without changes
|