@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.
Files changed (35) hide show
  1. package/@types/loot-core/client/constants.d.ts +1 -0
  2. package/@types/loot-core/client/state-types/modals.d.ts +17 -11
  3. package/@types/loot-core/client/state-types/prefs.d.ts +12 -5
  4. package/@types/loot-core/client/state-types/queries.d.ts +4 -4
  5. package/@types/loot-core/mocks/index.d.ts +2 -7
  6. package/@types/loot-core/server/accounts/rules.d.ts +3 -4
  7. package/@types/loot-core/server/aql/schema/index.d.ts +8 -0
  8. package/@types/loot-core/server/db/index.d.ts +2 -2
  9. package/@types/loot-core/server/main-app.d.ts +1 -1
  10. package/@types/loot-core/server/preferences/app.d.ts +12 -0
  11. package/@types/loot-core/server/preferences/types/handlers.d.ts +10 -0
  12. package/@types/loot-core/server/prefs.d.ts +4 -6
  13. package/@types/loot-core/server/util/rschedule.d.ts +0 -1
  14. package/@types/loot-core/shared/errors.d.ts +1 -1
  15. package/@types/loot-core/shared/months.d.ts +2 -0
  16. package/@types/loot-core/shared/rules.d.ts +5 -32
  17. package/@types/loot-core/shared/transactions.d.ts +2 -0
  18. package/@types/loot-core/shared/util.d.ts +4 -2
  19. package/@types/loot-core/types/handlers.d.ts +2 -0
  20. package/@types/loot-core/types/models/dashboard.d.ts +37 -4
  21. package/@types/loot-core/types/models/reports.d.ts +3 -13
  22. package/@types/loot-core/types/models/rule.d.ts +4 -1
  23. package/@types/loot-core/types/models/schedule.d.ts +18 -14
  24. package/@types/loot-core/types/models/transaction-filter.d.ts +4 -2
  25. package/@types/loot-core/types/models/transaction.d.ts +2 -0
  26. package/@types/loot-core/types/prefs.d.ts +38 -50
  27. package/@types/loot-core/types/server-events.d.ts +1 -0
  28. package/@types/loot-core/types/server-handlers.d.ts +4 -6
  29. package/@types/loot-core/types/util.d.ts +2 -0
  30. package/@types/migrations/1723665565000_prefs.d.ts +4 -0
  31. package/dist/app/bundle.api.js +1172 -781
  32. package/dist/migrations/1723665565000_prefs.js +51 -0
  33. package/dist/package.json +1 -1
  34. package/package.json +1 -1
  35. /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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@actual-app/api",
3
- "version": "6.10.0",
3
+ "version": "24.10.1",
4
4
  "license": "MIT",
5
5
  "description": "An API for Actual",
6
6
  "engines": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@actual-app/api",
3
- "version": "6.10.0",
3
+ "version": "24.10.1",
4
4
  "license": "MIT",
5
5
  "description": "An API for Actual",
6
6
  "engines": {