@actual-app/api 6.8.2 → 6.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.
- package/@types/jest.config.d.ts +7 -7
- package/@types/loot-core/client/constants.d.ts +2 -0
- package/@types/loot-core/client/state-types/index.d.ts +1 -1
- package/@types/loot-core/client/state-types/modals.d.ts +27 -8
- package/@types/loot-core/client/state-types/notifications.d.ts +18 -1
- package/@types/loot-core/client/state-types/prefs.d.ts +9 -4
- package/@types/loot-core/client/state-types/queries.d.ts +8 -0
- package/@types/loot-core/server/accounts/parse-file.d.ts +1 -0
- package/@types/loot-core/server/accounts/rules.d.ts +2 -2
- package/@types/loot-core/server/accounts/sync.d.ts +12 -1
- package/@types/loot-core/server/accounts/transaction-rules.d.ts +1 -3
- package/@types/loot-core/server/accounts/transactions.d.ts +3 -5
- package/@types/loot-core/server/api-models.d.ts +21 -6
- package/@types/loot-core/server/aql/schema/index.d.ts +41 -3
- package/@types/loot-core/server/budget/actions.d.ts +2 -1
- package/@types/loot-core/server/budget/statements.d.ts +9 -0
- package/@types/loot-core/server/budget/template-notes.d.ts +5 -0
- package/@types/loot-core/server/budget/types/templates.d.ts +82 -0
- package/@types/loot-core/server/cloud-storage.d.ts +0 -1
- package/@types/loot-core/server/dashboard/app.d.ts +12 -0
- package/@types/loot-core/server/dashboard/types/handlers.d.ts +24 -0
- package/@types/loot-core/server/db/index.d.ts +4 -2
- package/@types/loot-core/server/db/types.d.ts +9 -0
- package/@types/loot-core/server/encryption-internals.d.ts +0 -1
- package/@types/loot-core/server/encryption-internals.web.d.ts +0 -1
- package/@types/loot-core/server/encryption.d.ts +0 -1
- package/@types/loot-core/server/errors.d.ts +2 -0
- package/@types/loot-core/server/importers/actual.d.ts +0 -1
- package/@types/loot-core/server/importers/index.d.ts +0 -1
- package/@types/loot-core/server/importers/ynab4.d.ts +0 -1
- package/@types/loot-core/server/importers/ynab5.d.ts +0 -1
- package/@types/loot-core/server/main-app.d.ts +1 -1
- package/@types/loot-core/server/models.d.ts +4 -4
- package/@types/loot-core/server/prefs.d.ts +7 -2
- package/@types/loot-core/server/reports/app.d.ts +46 -0
- package/@types/loot-core/server/rules/types/handlers.d.ts +4 -6
- package/@types/loot-core/server/sync/make-test-message.d.ts +0 -1
- package/@types/loot-core/shared/dashboard.d.ts +2 -0
- package/@types/loot-core/shared/months.d.ts +7 -6
- package/@types/loot-core/shared/normalisation.d.ts +1 -0
- package/@types/loot-core/shared/rules.d.ts +5 -1
- package/@types/loot-core/shared/schedules.d.ts +22 -22
- package/@types/loot-core/shared/transactions.d.ts +26 -75
- package/@types/loot-core/shared/util.d.ts +10 -13
- package/@types/loot-core/types/api-handlers.d.ts +29 -3
- package/@types/loot-core/types/file.d.ts +2 -0
- package/@types/loot-core/types/handlers.d.ts +2 -0
- package/@types/loot-core/types/models/category-group.d.ts +6 -2
- package/@types/loot-core/types/models/category.d.ts +4 -2
- package/@types/loot-core/types/models/dashboard.d.ts +56 -0
- package/@types/loot-core/types/models/index.d.ts +1 -0
- package/@types/loot-core/types/models/payee.d.ts +6 -7
- package/@types/loot-core/types/models/reports.d.ts +12 -5
- package/@types/loot-core/types/models/rule.d.ts +100 -7
- package/@types/loot-core/types/models/transaction.d.ts +12 -25
- package/@types/loot-core/types/prefs.d.ts +50 -26
- package/@types/loot-core/types/server-handlers.d.ts +13 -8
- package/@types/loot-core/types/util.d.ts +4 -0
- package/@types/methods.d.ts +8 -11
- package/@types/migrations/1722717601000_reports_move_selected_categories.d.ts +1 -0
- package/@types/migrations/1722804019000_create_dashboard_table.d.ts +1 -0
- package/dist/app/bundle.api.js +5544 -1857
- package/dist/app/query.js +1 -2
- package/dist/index.js +3 -3
- package/dist/injected.js +2 -2
- package/dist/methods.js +65 -41
- package/dist/methods.test.js +23 -15
- package/dist/migrations/1632571489012_remove_cache.js +1 -1
- package/dist/migrations/1720310586000_link_transfer_schedules.sql +19 -0
- package/dist/migrations/1720664867241_add_payee_favorite.sql +5 -0
- package/dist/migrations/1720665000000_goal_context.sql +6 -0
- package/dist/migrations/1722717601000_reports_move_selected_categories.js +39 -0
- package/dist/migrations/1722804019000_create_dashboard_table.js +38 -0
- package/dist/package.json +2 -2
- package/dist/utils.js +2 -3
- package/dist/validateNodeVersion.js +1 -2
- package/package.json +2 -2
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { CategoryGroupEntity } from './category-group';
|
|
2
|
+
|
|
1
3
|
export interface CategoryEntity {
|
|
2
|
-
id
|
|
4
|
+
id: string;
|
|
3
5
|
name: string;
|
|
4
6
|
is_income?: boolean;
|
|
5
|
-
cat_group?:
|
|
7
|
+
cat_group?: CategoryGroupEntity['id'];
|
|
6
8
|
sort_order?: number;
|
|
7
9
|
tombstone?: boolean;
|
|
8
10
|
hidden?: boolean;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type CustomReportEntity } from './reports';
|
|
2
|
+
|
|
3
|
+
type AbstractWidget<
|
|
4
|
+
T extends string,
|
|
5
|
+
Meta extends Record<string, unknown> = null,
|
|
6
|
+
> = {
|
|
7
|
+
id: string;
|
|
8
|
+
type: T;
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
meta: Meta;
|
|
14
|
+
tombstone: boolean;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type NetWorthWidget = AbstractWidget<
|
|
18
|
+
'net-worth-card',
|
|
19
|
+
{ name?: string } | null
|
|
20
|
+
>;
|
|
21
|
+
export type CashFlowWidget = AbstractWidget<
|
|
22
|
+
'cash-flow-card',
|
|
23
|
+
{ name?: string } | null
|
|
24
|
+
>;
|
|
25
|
+
export type SpendingWidget = AbstractWidget<
|
|
26
|
+
'spending-card',
|
|
27
|
+
{ name?: string } | null
|
|
28
|
+
>;
|
|
29
|
+
export type CustomReportWidget = AbstractWidget<
|
|
30
|
+
'custom-report',
|
|
31
|
+
{ id: string }
|
|
32
|
+
>;
|
|
33
|
+
|
|
34
|
+
type SpecializedWidget = NetWorthWidget | CashFlowWidget | SpendingWidget;
|
|
35
|
+
export type Widget = SpecializedWidget | CustomReportWidget;
|
|
36
|
+
export type NewWidget = Omit<Widget, 'id' | 'tombstone'>;
|
|
37
|
+
|
|
38
|
+
// Exported/imported (json) widget definition
|
|
39
|
+
export type ExportImportCustomReportWidget = Omit<
|
|
40
|
+
CustomReportWidget,
|
|
41
|
+
'id' | 'meta' | 'tombstone'
|
|
42
|
+
> & {
|
|
43
|
+
meta: Omit<CustomReportEntity, 'tombstone'>;
|
|
44
|
+
};
|
|
45
|
+
export type ExportImportDashboardWidget = Omit<
|
|
46
|
+
ExportImportCustomReportWidget | SpecializedWidget,
|
|
47
|
+
'tombstone'
|
|
48
|
+
>;
|
|
49
|
+
|
|
50
|
+
export type ExportImportDashboard = {
|
|
51
|
+
// Dashboard exports can be versioned; currently we support
|
|
52
|
+
// only a single version, but lets account for multiple
|
|
53
|
+
// future versions
|
|
54
|
+
version: 1;
|
|
55
|
+
widgets: ExportImportDashboardWidget[];
|
|
56
|
+
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
id?: string;
|
|
3
|
-
name: string;
|
|
4
|
-
transfer_acct?: string;
|
|
5
|
-
tombstone?: boolean;
|
|
6
|
-
}
|
|
1
|
+
import { AccountEntity } from './account';
|
|
7
2
|
|
|
8
|
-
export interface PayeeEntity
|
|
3
|
+
export interface PayeeEntity {
|
|
9
4
|
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
transfer_acct?: AccountEntity['id'];
|
|
7
|
+
favorite?: boolean;
|
|
8
|
+
tombstone?: boolean;
|
|
10
9
|
}
|
|
@@ -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:
|
|
21
|
+
conditionsOp: 'and' | 'or';
|
|
24
22
|
data?: GroupedEntity;
|
|
25
23
|
tombstone?: boolean;
|
|
26
24
|
}
|
|
@@ -32,6 +30,14 @@ export type balanceTypeOpType =
|
|
|
32
30
|
| 'netAssets'
|
|
33
31
|
| 'netDebts';
|
|
34
32
|
|
|
33
|
+
export type spendingReportTimeType =
|
|
34
|
+
| 'average'
|
|
35
|
+
| 'thisMonth'
|
|
36
|
+
| 'lastMonth'
|
|
37
|
+
| 'twoMonthsPrevious'
|
|
38
|
+
| 'lastYear'
|
|
39
|
+
| 'lastYearPrevious';
|
|
40
|
+
|
|
35
41
|
export type SpendingMonthEntity = Record<
|
|
36
42
|
string | number,
|
|
37
43
|
{
|
|
@@ -57,7 +63,9 @@ export interface SpendingEntity {
|
|
|
57
63
|
average: number;
|
|
58
64
|
thisMonth: number;
|
|
59
65
|
lastMonth: number;
|
|
66
|
+
twoMonthsPrevious: number;
|
|
60
67
|
lastYear: number;
|
|
68
|
+
lastYearPrevious: number;
|
|
61
69
|
}[];
|
|
62
70
|
startDate?: string;
|
|
63
71
|
endDate?: string;
|
|
@@ -130,10 +138,9 @@ export interface CustomReportData {
|
|
|
130
138
|
show_hidden: number;
|
|
131
139
|
include_current: number;
|
|
132
140
|
show_uncategorized: number;
|
|
133
|
-
selected_categories?: CategoryEntity[];
|
|
134
141
|
graph_type: string;
|
|
135
142
|
conditions?: RuleConditionEntity[];
|
|
136
|
-
conditions_op:
|
|
143
|
+
conditions_op: 'and' | 'or';
|
|
137
144
|
metadata?: GroupedEntity;
|
|
138
145
|
interval: string;
|
|
139
146
|
color_scheme?: string;
|
|
@@ -25,12 +25,29 @@ export type RuleConditionOp =
|
|
|
25
25
|
| 'lte'
|
|
26
26
|
| 'contains'
|
|
27
27
|
| 'doesNotContain'
|
|
28
|
+
| 'hasTags'
|
|
28
29
|
| 'matches';
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
+
};
|
|
41
|
+
|
|
42
|
+
type BaseConditionEntity<
|
|
43
|
+
Field extends keyof FieldValueTypes,
|
|
44
|
+
Op extends RuleConditionOp,
|
|
45
|
+
> = {
|
|
46
|
+
field: Field;
|
|
47
|
+
op: Op;
|
|
48
|
+
value: Op extends 'oneOf' | 'notOneOf'
|
|
49
|
+
? Array<FieldValueTypes[Field]>
|
|
50
|
+
: FieldValueTypes[Field];
|
|
34
51
|
options?: {
|
|
35
52
|
inflow?: boolean;
|
|
36
53
|
outflow?: boolean;
|
|
@@ -38,14 +55,80 @@ export interface RuleConditionEntity {
|
|
|
38
55
|
year?: boolean;
|
|
39
56
|
};
|
|
40
57
|
conditionsOp?: string;
|
|
41
|
-
type?:
|
|
58
|
+
type?: 'id' | 'boolean' | 'date' | 'number';
|
|
42
59
|
customName?: string;
|
|
43
|
-
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export type RuleConditionEntity =
|
|
63
|
+
| BaseConditionEntity<
|
|
64
|
+
'account',
|
|
65
|
+
| 'is'
|
|
66
|
+
| 'isNot'
|
|
67
|
+
| 'oneOf'
|
|
68
|
+
| 'notOneOf'
|
|
69
|
+
| 'contains'
|
|
70
|
+
| 'doesNotContain'
|
|
71
|
+
| 'matches'
|
|
72
|
+
>
|
|
73
|
+
| BaseConditionEntity<
|
|
74
|
+
'category',
|
|
75
|
+
| 'is'
|
|
76
|
+
| 'isNot'
|
|
77
|
+
| 'oneOf'
|
|
78
|
+
| 'notOneOf'
|
|
79
|
+
| 'contains'
|
|
80
|
+
| 'doesNotContain'
|
|
81
|
+
| 'matches'
|
|
82
|
+
>
|
|
83
|
+
| BaseConditionEntity<
|
|
84
|
+
'amount',
|
|
85
|
+
'is' | 'isapprox' | 'isbetween' | 'gt' | 'gte' | 'lt' | 'lte'
|
|
86
|
+
>
|
|
87
|
+
| BaseConditionEntity<
|
|
88
|
+
'date',
|
|
89
|
+
'is' | 'isapprox' | 'isbetween' | 'gt' | 'gte' | 'lt' | 'lte'
|
|
90
|
+
>
|
|
91
|
+
| BaseConditionEntity<
|
|
92
|
+
'notes',
|
|
93
|
+
| 'is'
|
|
94
|
+
| 'isNot'
|
|
95
|
+
| 'oneOf'
|
|
96
|
+
| 'notOneOf'
|
|
97
|
+
| 'contains'
|
|
98
|
+
| 'doesNotContain'
|
|
99
|
+
| 'matches'
|
|
100
|
+
| 'hasTags'
|
|
101
|
+
>
|
|
102
|
+
| BaseConditionEntity<
|
|
103
|
+
'payee',
|
|
104
|
+
| 'is'
|
|
105
|
+
| 'isNot'
|
|
106
|
+
| 'oneOf'
|
|
107
|
+
| 'notOneOf'
|
|
108
|
+
| 'contains'
|
|
109
|
+
| 'doesNotContain'
|
|
110
|
+
| 'matches'
|
|
111
|
+
>
|
|
112
|
+
| BaseConditionEntity<
|
|
113
|
+
'imported_payee',
|
|
114
|
+
| 'is'
|
|
115
|
+
| 'isNot'
|
|
116
|
+
| 'oneOf'
|
|
117
|
+
| 'notOneOf'
|
|
118
|
+
| 'contains'
|
|
119
|
+
| 'doesNotContain'
|
|
120
|
+
| 'matches'
|
|
121
|
+
>
|
|
122
|
+
| BaseConditionEntity<'saved', 'is'>
|
|
123
|
+
| BaseConditionEntity<'cleared', 'is'>
|
|
124
|
+
| BaseConditionEntity<'reconciled', 'is'>;
|
|
44
125
|
|
|
45
126
|
export type RuleActionEntity =
|
|
46
127
|
| SetRuleActionEntity
|
|
47
128
|
| SetSplitAmountRuleActionEntity
|
|
48
|
-
| LinkScheduleRuleActionEntity
|
|
129
|
+
| LinkScheduleRuleActionEntity
|
|
130
|
+
| PrependNoteRuleActionEntity
|
|
131
|
+
| AppendNoteRuleActionEntity;
|
|
49
132
|
|
|
50
133
|
export interface SetRuleActionEntity {
|
|
51
134
|
field: string;
|
|
@@ -70,3 +153,13 @@ export interface LinkScheduleRuleActionEntity {
|
|
|
70
153
|
op: 'link-schedule';
|
|
71
154
|
value: ScheduleEntity;
|
|
72
155
|
}
|
|
156
|
+
|
|
157
|
+
export interface PrependNoteRuleActionEntity {
|
|
158
|
+
op: 'prepend-notes';
|
|
159
|
+
value: string;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export interface AppendNoteRuleActionEntity {
|
|
163
|
+
op: 'append-notes';
|
|
164
|
+
value: string;
|
|
165
|
+
}
|
|
@@ -1,40 +1,27 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
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
|
|
7
|
-
id
|
|
6
|
+
export interface TransactionEntity {
|
|
7
|
+
id: string;
|
|
8
8
|
is_parent?: boolean;
|
|
9
9
|
is_child?: boolean;
|
|
10
|
-
parent_id?:
|
|
11
|
-
account:
|
|
12
|
-
category?:
|
|
10
|
+
parent_id?: TransactionEntity['id'];
|
|
11
|
+
account: AccountEntity['id'];
|
|
12
|
+
category?: CategoryEntity['id'];
|
|
13
13
|
amount: number;
|
|
14
|
-
payee?:
|
|
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?:
|
|
20
|
+
transfer_id?: TransactionEntity['id'];
|
|
21
21
|
sort_order?: number;
|
|
22
22
|
cleared?: boolean;
|
|
23
23
|
reconciled?: boolean;
|
|
24
24
|
tombstone?: boolean;
|
|
25
|
-
schedule?:
|
|
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[];
|
|
40
27
|
}
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { type numberFormats } from '../shared/util';
|
|
2
2
|
|
|
3
|
+
import { spendingReportTimeType } from './models/reports';
|
|
4
|
+
|
|
3
5
|
export type FeatureFlag =
|
|
6
|
+
| 'dashboards'
|
|
4
7
|
| 'reportBudget'
|
|
5
8
|
| 'goalTemplatesEnabled'
|
|
6
9
|
| 'spendingReport'
|
|
7
|
-
| 'simpleFinSync'
|
|
8
|
-
| 'iterableTopologicalSort';
|
|
10
|
+
| 'simpleFinSync';
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Cross-device preferences. These sync across devices when they are changed.
|
|
14
|
+
*/
|
|
15
|
+
export type SyncedPrefs = Partial<
|
|
11
16
|
{
|
|
12
17
|
firstDayOfWeekIdx: `${0 | 1 | 2 | 3 | 4 | 5 | 6}`;
|
|
13
18
|
dateFormat:
|
|
@@ -18,51 +23,70 @@ export type LocalPrefs = Partial<
|
|
|
18
23
|
| 'dd.MM.yyyy';
|
|
19
24
|
numberFormat: (typeof numberFormats)[number]['value'];
|
|
20
25
|
hideFraction: boolean;
|
|
21
|
-
hideClosedAccounts: boolean;
|
|
22
|
-
hideMobileMessage: boolean;
|
|
23
26
|
isPrivacyEnabled: boolean;
|
|
24
|
-
budgetName: string;
|
|
25
|
-
'ui.showClosedAccounts': boolean;
|
|
26
|
-
'expand-splits': boolean;
|
|
27
27
|
[key: `show-extra-balances-${string}`]: boolean;
|
|
28
28
|
[key: `hide-cleared-${string}`]: boolean;
|
|
29
29
|
[key: `hide-reconciled-${string}`]: boolean;
|
|
30
|
-
'budget.collapsed': string[];
|
|
31
|
-
'budget.summaryCollapsed': boolean;
|
|
32
|
-
'budget.showHiddenCategories': boolean;
|
|
33
|
-
'budget.startMonth': string;
|
|
34
30
|
// TODO: pull from src/components/modals/ImportTransactions.js
|
|
35
31
|
[key: `parse-date-${string}-${'csv' | 'qif'}`]: string;
|
|
36
32
|
[key: `csv-mappings-${string}`]: string;
|
|
37
33
|
[key: `csv-delimiter-${string}`]: ',' | ';' | '\t';
|
|
34
|
+
[key: `csv-skip-lines-${string}`]: number;
|
|
38
35
|
[key: `csv-has-header-${string}`]: boolean;
|
|
39
36
|
[key: `ofx-fallback-missing-payee-${string}`]: boolean;
|
|
40
37
|
[key: `flip-amount-${string}-${'csv' | 'qif'}`]: boolean;
|
|
41
|
-
'flags.updateNotificationShownForVersion': string;
|
|
42
|
-
id: string;
|
|
43
|
-
isCached: boolean;
|
|
44
|
-
lastUploaded: string;
|
|
45
|
-
cloudFileId: string;
|
|
46
|
-
groupId: string;
|
|
47
38
|
budgetType: 'report' | 'rollover';
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
39
|
+
} & Record<`flags.${FeatureFlag}`, boolean>
|
|
40
|
+
>;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Preferences that are stored in the `metadata.json` file along with the
|
|
44
|
+
* core database.
|
|
45
|
+
*/
|
|
46
|
+
export type MetadataPrefs = Partial<{
|
|
47
|
+
budgetName: string;
|
|
48
|
+
id: string;
|
|
49
|
+
lastUploaded: string;
|
|
50
|
+
cloudFileId: string;
|
|
51
|
+
groupId: string;
|
|
52
|
+
encryptKeyId: string;
|
|
53
|
+
lastSyncedTimestamp: string;
|
|
54
|
+
resetClock: boolean;
|
|
55
|
+
lastScheduleRun: string;
|
|
56
|
+
userId: string; // TODO: delete this (unused)
|
|
57
|
+
}>;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Local preferences applicable to a single device. Stored in local storage.
|
|
61
|
+
* TODO: eventually `LocalPrefs` type should not use `SyncedPrefs` or `MetadataPrefs`;
|
|
62
|
+
* this is only a stop-gap solution.
|
|
63
|
+
*/
|
|
64
|
+
export type LocalPrefs = SyncedPrefs &
|
|
65
|
+
MetadataPrefs &
|
|
66
|
+
Partial<{
|
|
67
|
+
'ui.showClosedAccounts': boolean;
|
|
68
|
+
'expand-splits': boolean;
|
|
69
|
+
'budget.collapsed': string[];
|
|
70
|
+
'budget.summaryCollapsed': boolean;
|
|
71
|
+
'budget.showHiddenCategories': boolean;
|
|
72
|
+
'budget.startMonth': string;
|
|
73
|
+
'flags.updateNotificationShownForVersion': string;
|
|
53
74
|
reportsViewLegend: boolean;
|
|
54
75
|
reportsViewSummary: boolean;
|
|
55
76
|
reportsViewLabel: boolean;
|
|
77
|
+
spendingReportFilter: string;
|
|
78
|
+
spendingReportTime: spendingReportTimeType;
|
|
79
|
+
spendingReportCompare: spendingReportTimeType;
|
|
80
|
+
sidebarWidth: number;
|
|
56
81
|
'mobile.showSpentColumn': boolean;
|
|
57
|
-
}
|
|
58
|
-
>;
|
|
82
|
+
}>;
|
|
59
83
|
|
|
60
84
|
export type Theme = 'light' | 'dark' | 'auto' | 'midnight' | 'development';
|
|
61
85
|
export type GlobalPrefs = Partial<{
|
|
62
86
|
floatingSidebar: boolean;
|
|
63
87
|
maxMonths: number;
|
|
64
|
-
autoUpdate: boolean;
|
|
65
88
|
keyId?: string;
|
|
66
89
|
theme: Theme;
|
|
67
90
|
documentDir: string; // Electron only
|
|
91
|
+
serverSelfSignedCert: string; // Electron only
|
|
68
92
|
}>;
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
PayeeEntity,
|
|
19
19
|
} from './models';
|
|
20
20
|
import { GlobalPrefs, LocalPrefs } from './prefs';
|
|
21
|
+
import { Query } from './query';
|
|
21
22
|
import { EmptyObject } from './util';
|
|
22
23
|
|
|
23
24
|
export interface ServerHandlers {
|
|
@@ -28,11 +29,8 @@ export interface ServerHandlers {
|
|
|
28
29
|
redo: () => Promise<void>;
|
|
29
30
|
|
|
30
31
|
'transactions-batch-update': (
|
|
31
|
-
arg:
|
|
32
|
-
|
|
33
|
-
'detectOrphanPayees'
|
|
34
|
-
>,
|
|
35
|
-
) => Promise<Awaited<ReturnType<typeof batchUpdateTransactions>>>;
|
|
32
|
+
...arg: Parameters<typeof batchUpdateTransactions>
|
|
33
|
+
) => ReturnType<typeof batchUpdateTransactions>;
|
|
36
34
|
|
|
37
35
|
'transaction-add': (transaction) => Promise<EmptyObject>;
|
|
38
36
|
|
|
@@ -105,11 +103,13 @@ export interface ServerHandlers {
|
|
|
105
103
|
|
|
106
104
|
'payee-create': (arg: { name }) => Promise<string>;
|
|
107
105
|
|
|
106
|
+
'common-payees-get': () => Promise<PayeeEntity[]>;
|
|
107
|
+
|
|
108
108
|
'payees-get': () => Promise<PayeeEntity[]>;
|
|
109
109
|
|
|
110
110
|
'payees-get-rule-counts': () => Promise<unknown>;
|
|
111
111
|
|
|
112
|
-
'payees-merge': (arg: { targetId; mergeIds }) => Promise<
|
|
112
|
+
'payees-merge': (arg: { targetId; mergeIds }) => Promise<void>;
|
|
113
113
|
|
|
114
114
|
'payees-batch-change': (arg: {
|
|
115
115
|
added?;
|
|
@@ -138,7 +138,7 @@ export interface ServerHandlers {
|
|
|
138
138
|
|
|
139
139
|
'create-query': (arg: { sheetName; name; query }) => Promise<unknown>;
|
|
140
140
|
|
|
141
|
-
query: (query) => Promise<{ data; dependencies }>;
|
|
141
|
+
query: (query: Query) => Promise<{ data: unknown; dependencies }>;
|
|
142
142
|
|
|
143
143
|
'account-update': (arg: { id; name }) => Promise<unknown>;
|
|
144
144
|
|
|
@@ -222,10 +222,15 @@ export interface ServerHandlers {
|
|
|
222
222
|
updatedAccounts;
|
|
223
223
|
}>;
|
|
224
224
|
|
|
225
|
-
'transactions-import': (arg: {
|
|
225
|
+
'transactions-import': (arg: {
|
|
226
|
+
accountId;
|
|
227
|
+
transactions;
|
|
228
|
+
isPreview;
|
|
229
|
+
}) => Promise<{
|
|
226
230
|
errors?: { message: string }[];
|
|
227
231
|
added;
|
|
228
232
|
updated;
|
|
233
|
+
updatedPreview;
|
|
229
234
|
}>;
|
|
230
235
|
|
|
231
236
|
'account-unlink': (arg: { id }) => Promise<'ok'>;
|
package/@types/methods.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export declare function loadBudget(budgetId: any): Promise<void>;
|
|
|
4
4
|
export declare function downloadBudget(syncId: any, { password }?: {
|
|
5
5
|
password?: any;
|
|
6
6
|
}): Promise<void>;
|
|
7
|
+
export declare function getBudgets(): Promise<import("./loot-core/server/api-models").APIFileEntity[]>;
|
|
7
8
|
export declare function sync(): Promise<void>;
|
|
8
9
|
export declare function runBankSync(args?: {
|
|
9
10
|
accountId: string;
|
|
@@ -48,22 +49,14 @@ export declare function updateTransaction(id: any, fields: any): Promise<import(
|
|
|
48
49
|
id: any;
|
|
49
50
|
category: any;
|
|
50
51
|
})[]>;
|
|
51
|
-
export declare function deleteTransaction(id: any): Promise<
|
|
52
|
-
id: any;
|
|
53
|
-
transfer_id: any;
|
|
54
|
-
} | {
|
|
55
|
-
id: any;
|
|
56
|
-
payee: any;
|
|
57
|
-
} | {
|
|
58
|
-
id: any;
|
|
59
|
-
category: any;
|
|
60
|
-
})[]>;
|
|
52
|
+
export declare function deleteTransaction(id: any): Promise<any>;
|
|
61
53
|
export declare function getAccounts(): Promise<import("./loot-core/server/api-models").APIAccountEntity[]>;
|
|
62
54
|
export declare function createAccount(account: any, initialBalance?: any): Promise<string>;
|
|
63
55
|
export declare function updateAccount(id: any, fields: any): Promise<void>;
|
|
64
56
|
export declare function closeAccount(id: any, transferAccountId?: any, transferCategoryId?: any): Promise<unknown>;
|
|
65
57
|
export declare function reopenAccount(id: any): Promise<unknown>;
|
|
66
58
|
export declare function deleteAccount(id: any): Promise<unknown>;
|
|
59
|
+
export declare function getAccountBalance(id: any, cutoff?: any): Promise<number>;
|
|
67
60
|
export declare function getCategoryGroups(): Promise<import("./loot-core/server/api-models").APICategoryGroupEntity[]>;
|
|
68
61
|
export declare function createCategoryGroup(group: any): Promise<string>;
|
|
69
62
|
export declare function updateCategoryGroup(id: any, fields: any): Promise<unknown>;
|
|
@@ -74,12 +67,16 @@ export declare function updateCategory(id: any, fields: any): Promise<unknown>;
|
|
|
74
67
|
export declare function deleteCategory(id: any, transferCategoryId?: any): Promise<{
|
|
75
68
|
error?: string;
|
|
76
69
|
}>;
|
|
70
|
+
export declare function getCommonPayees(): Promise<import("./loot-core/server/api-models").APIPayeeEntity[]>;
|
|
77
71
|
export declare function getPayees(): Promise<import("./loot-core/server/api-models").APIPayeeEntity[]>;
|
|
78
72
|
export declare function createPayee(payee: any): Promise<string>;
|
|
79
73
|
export declare function updatePayee(id: any, fields: any): Promise<unknown>;
|
|
80
74
|
export declare function deletePayee(id: any): Promise<unknown>;
|
|
75
|
+
export declare function mergePayees(targetId: any, mergeIds: any): Promise<void>;
|
|
81
76
|
export declare function getRules(): Promise<import("./loot-core/types/models").RuleEntity[]>;
|
|
82
77
|
export declare function getPayeeRules(id: any): Promise<import("./loot-core/types/models").RuleEntity[]>;
|
|
83
78
|
export declare function createRule(rule: any): Promise<import("./loot-core/types/models").RuleEntity>;
|
|
84
79
|
export declare function updateRule(rule: any): Promise<import("./loot-core/types/models").RuleEntity>;
|
|
85
|
-
export declare function deleteRule(id:
|
|
80
|
+
export declare function deleteRule(id: string): Promise<boolean>;
|
|
81
|
+
export declare function holdBudgetForNextMonth(month: any, amount: any): Promise<boolean>;
|
|
82
|
+
export declare function resetBudgetHold(month: any): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function runMigration(db: any): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function runMigration(db: any): Promise<void>;
|