@actual-app/api 6.9.0 → 24.10.0

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 (82) hide show
  1. package/@types/jest.config.d.ts +7 -7
  2. package/@types/loot-core/client/constants.d.ts +1 -0
  3. package/@types/loot-core/client/state-types/index.d.ts +1 -1
  4. package/@types/loot-core/client/state-types/modals.d.ts +35 -17
  5. package/@types/loot-core/client/state-types/notifications.d.ts +18 -1
  6. package/@types/loot-core/client/state-types/prefs.d.ts +4 -4
  7. package/@types/loot-core/client/state-types/queries.d.ts +4 -4
  8. package/@types/loot-core/mocks/index.d.ts +2 -7
  9. package/@types/loot-core/server/accounts/parse-file.d.ts +1 -0
  10. package/@types/loot-core/server/accounts/rules.d.ts +5 -6
  11. package/@types/loot-core/server/accounts/sync.d.ts +2 -2
  12. package/@types/loot-core/server/accounts/transaction-rules.d.ts +1 -3
  13. package/@types/loot-core/server/accounts/transactions.d.ts +3 -5
  14. package/@types/loot-core/server/api-models.d.ts +6 -6
  15. package/@types/loot-core/server/aql/schema/index.d.ts +34 -3
  16. package/@types/loot-core/server/budget/statements.d.ts +9 -0
  17. package/@types/loot-core/server/budget/template-notes.d.ts +5 -0
  18. package/@types/loot-core/server/budget/types/templates.d.ts +82 -0
  19. package/@types/loot-core/server/cloud-storage.d.ts +0 -1
  20. package/@types/loot-core/server/dashboard/app.d.ts +12 -0
  21. package/@types/loot-core/server/dashboard/types/handlers.d.ts +24 -0
  22. package/@types/loot-core/server/db/index.d.ts +5 -4
  23. package/@types/loot-core/server/db/types.d.ts +9 -0
  24. package/@types/loot-core/server/encryption-internals.d.ts +0 -1
  25. package/@types/loot-core/server/encryption-internals.web.d.ts +0 -1
  26. package/@types/loot-core/server/encryption.d.ts +0 -1
  27. package/@types/loot-core/server/errors.d.ts +2 -0
  28. package/@types/loot-core/server/importers/actual.d.ts +0 -1
  29. package/@types/loot-core/server/importers/index.d.ts +0 -1
  30. package/@types/loot-core/server/importers/ynab4.d.ts +0 -1
  31. package/@types/loot-core/server/importers/ynab5.d.ts +0 -1
  32. package/@types/loot-core/server/main-app.d.ts +1 -1
  33. package/@types/loot-core/server/models.d.ts +4 -4
  34. package/@types/loot-core/server/preferences/app.d.ts +12 -0
  35. package/@types/loot-core/server/preferences/types/handlers.d.ts +8 -0
  36. package/@types/loot-core/server/prefs.d.ts +8 -5
  37. package/@types/loot-core/server/reports/app.d.ts +46 -0
  38. package/@types/loot-core/server/rules/types/handlers.d.ts +4 -6
  39. package/@types/loot-core/server/sync/make-test-message.d.ts +0 -1
  40. package/@types/loot-core/server/util/rschedule.d.ts +0 -1
  41. package/@types/loot-core/shared/dashboard.d.ts +2 -0
  42. package/@types/loot-core/shared/errors.d.ts +1 -1
  43. package/@types/loot-core/shared/months.d.ts +9 -6
  44. package/@types/loot-core/shared/rules.d.ts +6 -29
  45. package/@types/loot-core/shared/schedules.d.ts +22 -22
  46. package/@types/loot-core/shared/transactions.d.ts +26 -73
  47. package/@types/loot-core/shared/util.d.ts +13 -14
  48. package/@types/loot-core/types/api-handlers.d.ts +14 -3
  49. package/@types/loot-core/types/handlers.d.ts +4 -0
  50. package/@types/loot-core/types/models/category-group.d.ts +6 -2
  51. package/@types/loot-core/types/models/category.d.ts +4 -2
  52. package/@types/loot-core/types/models/dashboard.d.ts +89 -0
  53. package/@types/loot-core/types/models/index.d.ts +1 -0
  54. package/@types/loot-core/types/models/payee.d.ts +5 -7
  55. package/@types/loot-core/types/models/reports.d.ts +5 -18
  56. package/@types/loot-core/types/models/rule.d.ts +103 -7
  57. package/@types/loot-core/types/models/schedule.d.ts +18 -14
  58. package/@types/loot-core/types/models/transaction-filter.d.ts +4 -2
  59. package/@types/loot-core/types/models/transaction.d.ts +14 -25
  60. package/@types/loot-core/types/prefs.d.ts +65 -55
  61. package/@types/loot-core/types/server-events.d.ts +1 -0
  62. package/@types/loot-core/types/server-handlers.d.ts +9 -13
  63. package/@types/loot-core/types/util.d.ts +6 -0
  64. package/@types/methods.d.ts +4 -11
  65. package/@types/migrations/1722717601000_reports_move_selected_categories.d.ts +1 -0
  66. package/@types/migrations/1722804019000_create_dashboard_table.d.ts +1 -0
  67. package/@types/migrations/1723665565000_prefs.d.ts +4 -0
  68. package/dist/app/bundle.api.js +5534 -1851
  69. package/dist/app/query.js +1 -2
  70. package/dist/index.js +3 -3
  71. package/dist/injected.js +2 -2
  72. package/dist/methods.js +53 -45
  73. package/dist/methods.test.js +8 -14
  74. package/dist/migrations/1632571489012_remove_cache.js +1 -1
  75. package/dist/migrations/1722717601000_reports_move_selected_categories.js +39 -0
  76. package/dist/migrations/1722804019000_create_dashboard_table.js +38 -0
  77. package/dist/migrations/1723665565000_prefs.js +51 -0
  78. package/dist/package.json +2 -2
  79. package/dist/utils.js +2 -3
  80. package/dist/validateNodeVersion.js +1 -2
  81. package/package.json +2 -2
  82. /package/@types/loot-core/server/budget/{rollover.d.ts → envelope.d.ts} +0 -0
@@ -63,13 +63,24 @@ export interface ApiHandlers {
63
63
  flag: boolean;
64
64
  }) => Promise<void>;
65
65
 
66
+ 'api/budget-hold-for-next-month': (arg: {
67
+ month: string;
68
+ amount: number;
69
+ }) => Promise<boolean>;
70
+
71
+ 'api/budget-reset-hold': (arg: { month: string }) => Promise<void>;
72
+
66
73
  'api/transactions-export': (arg: {
67
74
  transactions;
68
75
  categoryGroups;
69
76
  payees;
70
77
  }) => Promise<unknown>;
71
78
 
72
- 'api/transactions-import': (arg: { accountId; transactions }) => Promise<{
79
+ 'api/transactions-import': (arg: {
80
+ accountId;
81
+ transactions;
82
+ isPreview?;
83
+ }) => Promise<{
73
84
  errors?: { message: string }[];
74
85
  added;
75
86
  updated;
@@ -95,7 +106,7 @@ export interface ApiHandlers {
95
106
 
96
107
  'api/transaction-delete': (arg: {
97
108
  id;
98
- }) => Promise<Awaited<ReturnType<typeof batchUpdateTransactions>>['updated']>;
109
+ }) => Promise<Awaited<ReturnType<typeof batchUpdateTransactions>>['deleted']>;
99
110
 
100
111
  'api/sync': () => Promise<void>;
101
112
 
@@ -169,5 +180,5 @@ export interface ApiHandlers {
169
180
 
170
181
  'api/rule-update': (arg: { rule: RuleEntity }) => Promise<RuleEntity>;
171
182
 
172
- 'api/rule-delete': (arg: { id: string }) => Promise<boolean>;
183
+ 'api/rule-delete': (id: string) => Promise<boolean>;
173
184
  }
@@ -1,6 +1,8 @@
1
1
  import type { BudgetHandlers } from '../server/budget/types/handlers';
2
+ import type { DashboardHandlers } from '../server/dashboard/types/handlers';
2
3
  import type { FiltersHandlers } from '../server/filters/types/handlers';
3
4
  import type { NotesHandlers } from '../server/notes/types/handlers';
5
+ import type { PreferencesHandlers } from '../server/preferences/types/handlers';
4
6
  import type { ReportsHandlers } from '../server/reports/types/handlers';
5
7
  import type { RulesHandlers } from '../server/rules/types/handlers';
6
8
  import type { SchedulesHandlers } from '../server/schedules/types/handlers';
@@ -13,8 +15,10 @@ export interface Handlers
13
15
  extends ServerHandlers,
14
16
  ApiHandlers,
15
17
  BudgetHandlers,
18
+ DashboardHandlers,
16
19
  FiltersHandlers,
17
20
  NotesHandlers,
21
+ PreferencesHandlers,
18
22
  ReportsHandlers,
19
23
  RulesHandlers,
20
24
  SchedulesHandlers,
@@ -1,11 +1,15 @@
1
1
  import { CategoryEntity } from './category';
2
2
 
3
- export interface CategoryGroupEntity {
4
- id?: string;
3
+ export interface NewCategoryGroupEntity {
5
4
  name: string;
6
5
  is_income?: boolean;
7
6
  sort_order?: number;
8
7
  tombstone?: boolean;
9
8
  hidden?: boolean;
9
+ categories?: Omit<CategoryEntity, 'id'>[];
10
+ }
11
+
12
+ export interface CategoryGroupEntity extends NewCategoryGroupEntity {
13
+ id: string;
10
14
  categories?: CategoryEntity[];
11
15
  }
@@ -1,8 +1,10 @@
1
+ import { CategoryGroupEntity } from './category-group';
2
+
1
3
  export interface CategoryEntity {
2
- id?: string;
4
+ id: string;
3
5
  name: string;
4
6
  is_income?: boolean;
5
- cat_group?: string;
7
+ cat_group?: CategoryGroupEntity['id'];
6
8
  sort_order?: number;
7
9
  tombstone?: boolean;
8
10
  hidden?: boolean;
@@ -0,0 +1,89 @@
1
+ import { type CustomReportEntity } from './reports';
2
+ import { type RuleConditionEntity } from './rule';
3
+
4
+ export type TimeFrame = {
5
+ start: string;
6
+ end: string;
7
+ mode: 'sliding-window' | 'static' | 'full';
8
+ };
9
+
10
+ type AbstractWidget<
11
+ T extends string,
12
+ Meta extends Record<string, unknown> = null,
13
+ > = {
14
+ id: string;
15
+ type: T;
16
+ x: number;
17
+ y: number;
18
+ width: number;
19
+ height: number;
20
+ meta: Meta;
21
+ tombstone: boolean;
22
+ };
23
+
24
+ export type NetWorthWidget = AbstractWidget<
25
+ 'net-worth-card',
26
+ {
27
+ name?: string;
28
+ conditions?: RuleConditionEntity[];
29
+ conditionsOp?: 'and' | 'or';
30
+ timeFrame?: TimeFrame;
31
+ } | null
32
+ >;
33
+ export type CashFlowWidget = AbstractWidget<
34
+ 'cash-flow-card',
35
+ {
36
+ name?: string;
37
+ conditions?: RuleConditionEntity[];
38
+ conditionsOp?: 'and' | 'or';
39
+ timeFrame?: TimeFrame;
40
+ } | null
41
+ >;
42
+ export type SpendingWidget = AbstractWidget<
43
+ 'spending-card',
44
+ {
45
+ name?: string;
46
+ conditions?: RuleConditionEntity[];
47
+ conditionsOp?: 'and' | 'or';
48
+ compare?: string;
49
+ compareTo?: string;
50
+ isLive?: boolean;
51
+ mode?: 'single-month' | 'budget' | 'average';
52
+ } | null
53
+ >;
54
+ export type CustomReportWidget = AbstractWidget<
55
+ 'custom-report',
56
+ { id: string }
57
+ >;
58
+ export type MarkdownWidget = AbstractWidget<
59
+ 'markdown-card',
60
+ { content: string; text_align?: 'left' | 'right' | 'center' }
61
+ >;
62
+
63
+ type SpecializedWidget =
64
+ | NetWorthWidget
65
+ | CashFlowWidget
66
+ | SpendingWidget
67
+ | MarkdownWidget;
68
+ export type Widget = SpecializedWidget | CustomReportWidget;
69
+ export type NewWidget = Omit<Widget, 'id' | 'tombstone'>;
70
+
71
+ // Exported/imported (json) widget definition
72
+ export type ExportImportCustomReportWidget = Omit<
73
+ CustomReportWidget,
74
+ 'id' | 'meta' | 'tombstone'
75
+ > & {
76
+ meta: Omit<CustomReportEntity, 'tombstone'>;
77
+ };
78
+ export type ExportImportDashboardWidget = Omit<
79
+ ExportImportCustomReportWidget | SpecializedWidget,
80
+ 'tombstone'
81
+ >;
82
+
83
+ export type ExportImportDashboard = {
84
+ // Dashboard exports can be versioned; currently we support
85
+ // only a single version, but lets account for multiple
86
+ // future versions
87
+ version: 1;
88
+ widgets: ExportImportDashboardWidget[];
89
+ };
@@ -1,6 +1,7 @@
1
1
  export type * from './account';
2
2
  export type * from './category';
3
3
  export type * from './category-group';
4
+ export type * from './dashboard';
4
5
  export type * from './gocardless';
5
6
  export type * from './simplefin';
6
7
  export type * from './note';
@@ -1,11 +1,9 @@
1
- export interface NewPayeeEntity {
2
- id?: string;
1
+ import { AccountEntity } from './account';
2
+
3
+ export interface PayeeEntity {
4
+ id: string;
3
5
  name: string;
4
- transfer_acct?: string;
6
+ transfer_acct?: AccountEntity['id'];
5
7
  favorite?: boolean;
6
8
  tombstone?: boolean;
7
9
  }
8
-
9
- export interface PayeeEntity extends NewPayeeEntity {
10
- id: string;
11
- }
@@ -1,4 +1,3 @@
1
- import { CategoryEntity } from './category';
2
1
  import { type RuleConditionEntity } from './rule';
3
2
 
4
3
  export interface CustomReportEntity {
@@ -17,10 +16,9 @@ export interface CustomReportEntity {
17
16
  showHiddenCategories: boolean;
18
17
  includeCurrentInterval: boolean;
19
18
  showUncategorized: boolean;
20
- selectedCategories?: CategoryEntity[];
21
19
  graphType: string;
22
20
  conditions?: RuleConditionEntity[];
23
- conditionsOp: string;
21
+ conditionsOp: 'and' | 'or';
24
22
  data?: GroupedEntity;
25
23
  tombstone?: boolean;
26
24
  }
@@ -32,14 +30,6 @@ export type balanceTypeOpType =
32
30
  | 'netAssets'
33
31
  | 'netDebts';
34
32
 
35
- export type spendingReportTimeType =
36
- | 'average'
37
- | 'thisMonth'
38
- | 'lastMonth'
39
- | 'twoMonthsPrevious'
40
- | 'lastYear'
41
- | 'lastYearPrevious';
42
-
43
33
  export type SpendingMonthEntity = Record<
44
34
  string | number,
45
35
  {
@@ -63,11 +53,9 @@ export interface SpendingEntity {
63
53
  months: SpendingMonthEntity;
64
54
  day: string;
65
55
  average: number;
66
- thisMonth: number;
67
- lastMonth: number;
68
- twoMonthsPrevious: number;
69
- lastYear: number;
70
- lastYearPrevious: number;
56
+ compare: number;
57
+ compareTo: number;
58
+ budget: number;
71
59
  }[];
72
60
  startDate?: string;
73
61
  endDate?: string;
@@ -140,10 +128,9 @@ export interface CustomReportData {
140
128
  show_hidden: number;
141
129
  include_current: number;
142
130
  show_uncategorized: number;
143
- selected_categories?: CategoryEntity[];
144
131
  graph_type: string;
145
132
  conditions?: RuleConditionEntity[];
146
- conditions_op: string;
133
+ conditions_op: 'and' | 'or';
147
134
  metadata?: GroupedEntity;
148
135
  interval: string;
149
136
  color_scheme?: string;
@@ -25,12 +25,31 @@ export type RuleConditionOp =
25
25
  | 'lte'
26
26
  | 'contains'
27
27
  | 'doesNotContain'
28
+ | 'hasTags'
28
29
  | 'matches';
29
30
 
30
- export interface RuleConditionEntity {
31
- field?: string;
32
- op?: RuleConditionOp;
33
- value?: string | string[] | number | boolean;
31
+ type FieldValueTypes = {
32
+ account: string;
33
+ amount: number;
34
+ category: string;
35
+ date: string;
36
+ notes: string;
37
+ payee: string;
38
+ imported_payee: string;
39
+ saved: string;
40
+ cleared: boolean;
41
+ reconciled: boolean;
42
+ };
43
+
44
+ type BaseConditionEntity<
45
+ Field extends keyof FieldValueTypes,
46
+ Op extends RuleConditionOp,
47
+ > = {
48
+ field: Field;
49
+ op: Op;
50
+ value: Op extends 'oneOf' | 'notOneOf'
51
+ ? Array<FieldValueTypes[Field]>
52
+ : FieldValueTypes[Field];
34
53
  options?: {
35
54
  inflow?: boolean;
36
55
  outflow?: boolean;
@@ -38,14 +57,81 @@ export interface RuleConditionEntity {
38
57
  year?: boolean;
39
58
  };
40
59
  conditionsOp?: string;
41
- type?: string;
60
+ type?: 'id' | 'boolean' | 'date' | 'number' | 'string';
42
61
  customName?: string;
43
- }
62
+ queryFilter?: Record<string, { $oneof: string[] }>;
63
+ };
64
+
65
+ export type RuleConditionEntity =
66
+ | BaseConditionEntity<
67
+ 'account',
68
+ | 'is'
69
+ | 'isNot'
70
+ | 'oneOf'
71
+ | 'notOneOf'
72
+ | 'contains'
73
+ | 'doesNotContain'
74
+ | 'matches'
75
+ >
76
+ | BaseConditionEntity<
77
+ 'category',
78
+ | 'is'
79
+ | 'isNot'
80
+ | 'oneOf'
81
+ | 'notOneOf'
82
+ | 'contains'
83
+ | 'doesNotContain'
84
+ | 'matches'
85
+ >
86
+ | BaseConditionEntity<
87
+ 'amount',
88
+ 'is' | 'isapprox' | 'isbetween' | 'gt' | 'gte' | 'lt' | 'lte'
89
+ >
90
+ | BaseConditionEntity<
91
+ 'date',
92
+ 'is' | 'isapprox' | 'isbetween' | 'gt' | 'gte' | 'lt' | 'lte'
93
+ >
94
+ | BaseConditionEntity<
95
+ 'notes',
96
+ | 'is'
97
+ | 'isNot'
98
+ | 'oneOf'
99
+ | 'notOneOf'
100
+ | 'contains'
101
+ | 'doesNotContain'
102
+ | 'matches'
103
+ | 'hasTags'
104
+ >
105
+ | BaseConditionEntity<
106
+ 'payee',
107
+ | 'is'
108
+ | 'isNot'
109
+ | 'oneOf'
110
+ | 'notOneOf'
111
+ | 'contains'
112
+ | 'doesNotContain'
113
+ | 'matches'
114
+ >
115
+ | BaseConditionEntity<
116
+ 'imported_payee',
117
+ | 'is'
118
+ | 'isNot'
119
+ | 'oneOf'
120
+ | 'notOneOf'
121
+ | 'contains'
122
+ | 'doesNotContain'
123
+ | 'matches'
124
+ >
125
+ | BaseConditionEntity<'saved', 'is'>
126
+ | BaseConditionEntity<'cleared', 'is'>
127
+ | BaseConditionEntity<'reconciled', 'is'>;
44
128
 
45
129
  export type RuleActionEntity =
46
130
  | SetRuleActionEntity
47
131
  | SetSplitAmountRuleActionEntity
48
- | LinkScheduleRuleActionEntity;
132
+ | LinkScheduleRuleActionEntity
133
+ | PrependNoteRuleActionEntity
134
+ | AppendNoteRuleActionEntity;
49
135
 
50
136
  export interface SetRuleActionEntity {
51
137
  field: string;
@@ -70,3 +156,13 @@ export interface LinkScheduleRuleActionEntity {
70
156
  op: 'link-schedule';
71
157
  value: ScheduleEntity;
72
158
  }
159
+
160
+ export interface PrependNoteRuleActionEntity {
161
+ op: 'prepend-notes';
162
+ value: string;
163
+ }
164
+
165
+ export interface AppendNoteRuleActionEntity {
166
+ op: 'append-notes';
167
+ value: string;
168
+ }
@@ -2,6 +2,23 @@ import type { AccountEntity } from './account';
2
2
  import type { PayeeEntity } from './payee';
3
3
  import type { RuleEntity } from './rule';
4
4
 
5
+ export interface RecurPattern {
6
+ value: number;
7
+ type: 'SU' | 'MO' | 'TU' | 'WE' | 'TH' | 'FR' | 'SA' | 'day';
8
+ }
9
+
10
+ export interface RecurConfig {
11
+ frequency: 'daily' | 'weekly' | 'monthly' | 'yearly';
12
+ interval: number;
13
+ patterns?: RecurPattern[];
14
+ skipWeekend?: boolean;
15
+ start: string;
16
+ endMode: 'never' | 'after_n_occurrences' | 'on_date';
17
+ endOccurrences?: number;
18
+ endDate?: string;
19
+ weekendSolveMode?: 'before' | 'after';
20
+ }
21
+
5
22
  export interface ScheduleEntity {
6
23
  id: string;
7
24
  name?: string;
@@ -17,20 +34,7 @@ export interface ScheduleEntity {
17
34
  _account: AccountEntity['id'];
18
35
  _amount: unknown;
19
36
  _amountOp: string;
20
- _date: {
21
- interval: number;
22
- patterns: {
23
- value: number;
24
- type: 'SU' | 'MO' | 'TU' | 'WE' | 'TH' | 'FR' | 'SA' | 'day';
25
- }[];
26
- skipWeekend: boolean;
27
- start: string;
28
- endMode: 'never' | 'after_n_occurrences' | 'on_date';
29
- endOccurrences: number;
30
- endDate: string;
31
- weekendSolveMode: 'before' | 'after';
32
- frequency: 'daily' | 'weekly' | 'monthly' | 'yearly';
33
- };
37
+ _date: RecurConfig;
34
38
  _conditions: unknown;
35
39
  _actions: unknown;
36
40
  }
@@ -1,7 +1,9 @@
1
+ import { type RuleConditionEntity } from './rule';
2
+
1
3
  export interface TransactionFilterEntity {
2
4
  id: string;
3
5
  name: string;
4
- conditions_op: string;
5
- conditions: unknown;
6
+ conditionsOp: 'and' | 'or';
7
+ conditions: RuleConditionEntity[];
6
8
  tombstone: boolean;
7
9
  }
@@ -1,40 +1,29 @@
1
- import type { AccountEntity } from './account';
2
- import type { CategoryEntity } from './category';
3
- import type { PayeeEntity } from './payee';
4
- import type { ScheduleEntity } from './schedule';
1
+ import { AccountEntity } from './account';
2
+ import { CategoryEntity } from './category';
3
+ import { PayeeEntity } from './payee';
4
+ import { ScheduleEntity } from './schedule';
5
5
 
6
- export interface NewTransactionEntity {
7
- id?: string;
6
+ export interface TransactionEntity {
7
+ id: string;
8
8
  is_parent?: boolean;
9
9
  is_child?: boolean;
10
- parent_id?: string;
11
- account: string;
12
- category?: string;
10
+ parent_id?: TransactionEntity['id'];
11
+ account: AccountEntity['id'];
12
+ category?: CategoryEntity['id'];
13
13
  amount: number;
14
- payee?: string;
14
+ payee?: PayeeEntity['id'];
15
15
  notes?: string;
16
16
  date: string;
17
17
  imported_id?: string;
18
18
  imported_payee?: string;
19
19
  starting_balance_flag?: boolean;
20
- transfer_id?: string;
20
+ transfer_id?: TransactionEntity['id'];
21
21
  sort_order?: number;
22
22
  cleared?: boolean;
23
23
  reconciled?: boolean;
24
24
  tombstone?: boolean;
25
- schedule?: string;
26
- subtransactions?: Omit<NewTransactionEntity, 'account' | 'date'>[];
27
- }
28
-
29
- export interface TransactionEntity
30
- extends Omit<
31
- NewTransactionEntity,
32
- 'account' | 'category' | 'payee' | 'schedule' | 'subtransactions'
33
- > {
34
- id: string;
35
- account: AccountEntity;
36
- category?: CategoryEntity;
37
- payee?: PayeeEntity;
38
- schedule?: ScheduleEntity;
25
+ schedule?: ScheduleEntity['id'];
39
26
  subtransactions?: TransactionEntity[];
27
+ _unmatched?: boolean;
28
+ _deleted?: boolean;
40
29
  }
@@ -1,70 +1,80 @@
1
- import { type numberFormats } from '../shared/util';
2
-
3
- import { spendingReportTimeType } from './models/reports';
4
-
5
1
  export type FeatureFlag =
2
+ | 'dashboards'
6
3
  | 'reportBudget'
7
4
  | 'goalTemplatesEnabled'
8
- | 'spendingReport'
9
- | 'simpleFinSync'
10
- | 'iterableTopologicalSort';
5
+ | 'spendingReport';
11
6
 
12
- export type LocalPrefs = Partial<
13
- {
14
- firstDayOfWeekIdx: `${0 | 1 | 2 | 3 | 4 | 5 | 6}`;
15
- dateFormat:
16
- | 'MM/dd/yyyy'
17
- | 'dd/MM/yyyy'
18
- | 'yyyy-MM-dd'
19
- | 'MM.dd.yyyy'
20
- | 'dd.MM.yyyy';
21
- numberFormat: (typeof numberFormats)[number]['value'];
22
- hideFraction: boolean;
23
- isPrivacyEnabled: boolean;
24
- budgetName: string;
25
- 'ui.showClosedAccounts': boolean;
26
- 'expand-splits': boolean;
27
- [key: `show-extra-balances-${string}`]: boolean;
28
- [key: `hide-cleared-${string}`]: boolean;
29
- [key: `hide-reconciled-${string}`]: boolean;
30
- 'budget.collapsed': string[];
31
- 'budget.summaryCollapsed': boolean;
32
- 'budget.showHiddenCategories': boolean;
33
- 'budget.startMonth': string;
7
+ /**
8
+ * Cross-device preferences. These sync across devices when they are changed.
9
+ */
10
+ export type SyncedPrefs = Partial<
11
+ Record<
12
+ | 'budgetType'
13
+ | 'firstDayOfWeekIdx'
14
+ | 'dateFormat'
15
+ | 'numberFormat'
16
+ | 'hideFraction'
17
+ | 'isPrivacyEnabled'
18
+ | `show-balances-${string}`
19
+ | `show-extra-balances-${string}`
20
+ | `hide-cleared-${string}`
21
+ | `hide-reconciled-${string}`
34
22
  // TODO: pull from src/components/modals/ImportTransactions.js
35
- [key: `parse-date-${string}-${'csv' | 'qif'}`]: string;
36
- [key: `csv-mappings-${string}`]: string;
37
- [key: `csv-delimiter-${string}`]: ',' | ';' | '\t';
38
- [key: `csv-has-header-${string}`]: boolean;
39
- [key: `ofx-fallback-missing-payee-${string}`]: boolean;
40
- [key: `flip-amount-${string}-${'csv' | 'qif'}`]: boolean;
41
- 'flags.updateNotificationShownForVersion': string;
42
- id: string;
43
- lastUploaded: string;
44
- cloudFileId: string;
45
- groupId: string;
46
- budgetType: 'report' | 'rollover';
47
- encryptKeyId: string;
48
- lastSyncedTimestamp: string;
49
- userId: string;
50
- resetClock: boolean;
51
- lastScheduleRun: string;
52
- reportsViewLegend: boolean;
53
- reportsViewSummary: boolean;
54
- reportsViewLabel: boolean;
55
- spendingReportFilter: string;
56
- spendingReportTime: spendingReportTimeType;
57
- spendingReportCompare: spendingReportTimeType;
58
- sidebarWidth: number;
59
- 'mobile.showSpentColumn': boolean;
60
- } & Record<`flags.${FeatureFlag}`, boolean>
23
+ | `parse-date-${string}-${'csv' | 'qif'}`
24
+ | `csv-mappings-${string}`
25
+ | `csv-delimiter-${string}`
26
+ | `csv-skip-lines-${string}`
27
+ | `csv-has-header-${string}`
28
+ | `ofx-fallback-missing-payee-${string}`
29
+ | `flip-amount-${string}-${'csv' | 'qif'}`
30
+ | `flags.${FeatureFlag}`,
31
+ string
32
+ >
61
33
  >;
62
34
 
35
+ /**
36
+ * Preferences that are stored in the `metadata.json` file along with the
37
+ * core database.
38
+ */
39
+ export type MetadataPrefs = Partial<{
40
+ budgetName: string;
41
+ id: string;
42
+ lastUploaded: string;
43
+ cloudFileId: string;
44
+ groupId: string;
45
+ encryptKeyId: string;
46
+ lastSyncedTimestamp: string;
47
+ resetClock: boolean;
48
+ lastScheduleRun: string;
49
+ userId: string; // TODO: delete this (unused)
50
+ }>;
51
+
52
+ /**
53
+ * Local preferences applicable to a single device. Stored in local storage.
54
+ */
55
+ export type LocalPrefs = Partial<{
56
+ 'ui.showClosedAccounts': boolean;
57
+ 'expand-splits': boolean;
58
+ 'budget.collapsed': string[];
59
+ 'budget.summaryCollapsed': boolean;
60
+ 'budget.showHiddenCategories': boolean;
61
+ 'budget.startMonth': string;
62
+ 'flags.updateNotificationShownForVersion': string;
63
+ reportsViewLegend: boolean;
64
+ reportsViewSummary: boolean;
65
+ reportsViewLabel: boolean;
66
+ sidebarWidth: number;
67
+ 'mobile.showSpentColumn': boolean;
68
+ }>;
69
+
63
70
  export type Theme = 'light' | 'dark' | 'auto' | 'midnight' | 'development';
71
+ export type DarkTheme = 'dark' | 'midnight';
64
72
  export type GlobalPrefs = Partial<{
65
73
  floatingSidebar: boolean;
66
74
  maxMonths: number;
67
75
  keyId?: string;
68
76
  theme: Theme;
77
+ preferredDarkTheme: DarkTheme;
69
78
  documentDir: string; // Electron only
79
+ serverSelfSignedCert: string; // Electron only
70
80
  }>;
@@ -18,4 +18,5 @@ export interface ServerEvents {
18
18
  'start-load': unknown;
19
19
  'sync-event': { type; subtype; meta; tables; syncDisabled };
20
20
  'undo-event': UndoState;
21
+ 'api-fetch-redirected': unknown;
21
22
  }