@actual-app/api 24.12.0 → 25.2.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/loot-core/client/constants.d.ts +0 -11
- package/@types/loot-core/client/state-types/index.d.ts +0 -14
- package/@types/loot-core/client/state-types/modals.d.ts +57 -2
- package/@types/loot-core/mocks/index.d.ts +9 -20
- package/@types/loot-core/platform/client/fetch/index.d.ts +10 -1
- package/@types/loot-core/platform/client/undo/index.d.ts +8 -4
- package/@types/loot-core/platform/server/connection/index.d.ts +1 -1
- package/@types/loot-core/server/accounts/sync.d.ts +1 -1
- package/@types/loot-core/server/accounts/transaction-rules.d.ts +4 -6
- package/@types/loot-core/server/accounts/transactions.d.ts +0 -3
- package/@types/loot-core/server/accounts/transfer.d.ts +0 -11
- package/@types/loot-core/server/admin/app.d.ts +17 -0
- package/@types/loot-core/server/admin/types/handlers.d.ts +43 -0
- package/@types/loot-core/server/app.d.ts +14 -4
- package/@types/loot-core/server/aql/compiler.d.ts +4 -6
- package/@types/loot-core/server/aql/schema/index.d.ts +3 -0
- package/@types/loot-core/server/budget/actions.d.ts +6 -0
- package/@types/loot-core/server/budget/app.d.ts +10 -5
- package/@types/loot-core/server/budget/categoryTemplate.d.ts +3 -2
- package/@types/loot-core/server/budget/goalsSchedule.d.ts +7 -5
- package/@types/loot-core/server/budget/types/handlers.d.ts +4 -0
- package/@types/loot-core/server/cloud-storage.d.ts +9 -0
- package/@types/loot-core/server/dashboard/app.d.ts +9 -4
- package/@types/loot-core/server/db/index.d.ts +1 -0
- package/@types/loot-core/server/filters/app.d.ts +9 -4
- package/@types/loot-core/server/importers/ynab4-types.d.ts +0 -2
- package/@types/loot-core/server/importers/ynab5-types.d.ts +0 -2
- package/@types/loot-core/server/main-app.d.ts +10 -5
- package/@types/loot-core/server/main.d.ts +2 -2
- package/@types/loot-core/server/notes/app.d.ts +9 -4
- package/@types/loot-core/server/post.d.ts +2 -0
- package/@types/loot-core/server/preferences/app.d.ts +9 -4
- package/@types/loot-core/server/reports/app.d.ts +11 -4
- package/@types/loot-core/server/rules/app.d.ts +9 -4
- package/@types/loot-core/server/rules/types/handlers.d.ts +4 -4
- package/@types/loot-core/server/schedules/app.d.ts +10 -7
- package/@types/loot-core/server/schedules/types/handlers.d.ts +5 -5
- package/@types/loot-core/server/tools/app.d.ts +9 -4
- package/@types/loot-core/server/tools/types/handlers.d.ts +4 -0
- package/@types/loot-core/server/util/budget-name.d.ts +6 -2
- package/@types/loot-core/shared/errors.d.ts +3 -0
- package/@types/loot-core/shared/query.d.ts +13 -12
- package/@types/loot-core/shared/schedules.d.ts +5 -31
- package/@types/loot-core/shared/transactions.d.ts +101 -17
- package/@types/loot-core/shared/util.d.ts +30 -10
- package/@types/loot-core/types/api-handlers.d.ts +3 -0
- package/@types/loot-core/types/budget.d.ts +1 -0
- package/@types/loot-core/types/file.d.ts +7 -0
- package/@types/loot-core/types/handlers.d.ts +2 -0
- package/@types/loot-core/types/models/dashboard.d.ts +13 -2
- package/@types/loot-core/types/models/index.d.ts +1 -0
- package/@types/loot-core/types/models/openid.d.ts +7 -0
- package/@types/loot-core/types/models/payee.d.ts +1 -0
- package/@types/loot-core/types/models/reports.d.ts +4 -0
- package/@types/loot-core/types/models/rule.d.ts +11 -5
- package/@types/loot-core/types/models/schedule.d.ts +5 -18
- package/@types/loot-core/types/models/simplefin.d.ts +2 -0
- package/@types/loot-core/types/models/transaction.d.ts +6 -0
- package/@types/loot-core/types/models/user.d.ts +26 -0
- package/@types/loot-core/types/models/userAccess.d.ts +9 -0
- package/@types/loot-core/types/prefs.d.ts +7 -3
- package/@types/loot-core/types/server-events.d.ts +80 -17
- package/@types/loot-core/types/server-handlers.d.ts +106 -17
- package/@types/loot-core/types/util.d.ts +5 -0
- package/@types/methods.d.ts +4 -4
- package/dist/app/bundle.api.js +1804 -916
- package/dist/methods.js +8 -2
- package/dist/migrations/1736640000000__custom_report_sorting.sql +7 -0
- package/dist/migrations/1737158400000_add_learn_categories_to_payees.sql +5 -0
- package/dist/migrations/1738491452000__sorting_rename.sql +13 -0
- package/dist/package.json +2 -2
- package/package.json +2 -2
- package/@types/loot-core/client/actions/types.d.ts +0 -6
- package/@types/loot-core/client/state-types/account.d.ts +0 -27
- package/@types/loot-core/client/state-types/app.d.ts +0 -37
- package/@types/loot-core/client/state-types/queries.d.ts +0 -76
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { UsersWithAccess } from '../server/cloud-storage';
|
|
2
|
+
|
|
1
3
|
import { Budget } from './budget';
|
|
2
4
|
|
|
3
5
|
export type FileState =
|
|
@@ -18,6 +20,7 @@ export type SyncableLocalFile = Budget & {
|
|
|
18
20
|
groupId: string;
|
|
19
21
|
state: 'broken' | 'unknown';
|
|
20
22
|
hasKey: boolean;
|
|
23
|
+
owner: string;
|
|
21
24
|
};
|
|
22
25
|
|
|
23
26
|
export type SyncedLocalFile = Budget & {
|
|
@@ -26,6 +29,8 @@ export type SyncedLocalFile = Budget & {
|
|
|
26
29
|
encryptKeyId?: string;
|
|
27
30
|
hasKey: boolean;
|
|
28
31
|
state: 'synced' | 'detached';
|
|
32
|
+
owner: string;
|
|
33
|
+
usersWithAccess: UsersWithAccess[];
|
|
29
34
|
};
|
|
30
35
|
|
|
31
36
|
export type RemoteFile = {
|
|
@@ -35,6 +40,8 @@ export type RemoteFile = {
|
|
|
35
40
|
encryptKeyId?: string;
|
|
36
41
|
hasKey: boolean;
|
|
37
42
|
state: 'remote';
|
|
43
|
+
owner: string;
|
|
44
|
+
usersWithAccess: UsersWithAccess[];
|
|
38
45
|
};
|
|
39
46
|
|
|
40
47
|
export type File = LocalFile | SyncableLocalFile | SyncedLocalFile | RemoteFile;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AdminHandlers } from '../server/admin/types/handlers';
|
|
1
2
|
import type { BudgetHandlers } from '../server/budget/types/handlers';
|
|
2
3
|
import type { DashboardHandlers } from '../server/dashboard/types/handlers';
|
|
3
4
|
import type { FiltersHandlers } from '../server/filters/types/handlers';
|
|
@@ -22,6 +23,7 @@ export interface Handlers
|
|
|
22
23
|
ReportsHandlers,
|
|
23
24
|
RulesHandlers,
|
|
24
25
|
SchedulesHandlers,
|
|
26
|
+
AdminHandlers,
|
|
25
27
|
ToolsHandlers {}
|
|
26
28
|
|
|
27
29
|
export type HandlerFunctions = Handlers[keyof Handlers];
|
|
@@ -4,7 +4,7 @@ import { type RuleConditionEntity } from './rule';
|
|
|
4
4
|
export type TimeFrame = {
|
|
5
5
|
start: string;
|
|
6
6
|
end: string;
|
|
7
|
-
mode: 'sliding-window' | 'static' | 'full';
|
|
7
|
+
mode: 'sliding-window' | 'static' | 'full' | 'lastYear' | 'yearToDate';
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
type AbstractWidget<
|
|
@@ -66,7 +66,8 @@ type SpecializedWidget =
|
|
|
66
66
|
| CashFlowWidget
|
|
67
67
|
| SpendingWidget
|
|
68
68
|
| MarkdownWidget
|
|
69
|
-
| SummaryWidget
|
|
69
|
+
| SummaryWidget
|
|
70
|
+
| CalendarWidget;
|
|
70
71
|
export type Widget = SpecializedWidget | CustomReportWidget;
|
|
71
72
|
export type NewWidget = Omit<Widget, 'id' | 'tombstone'>;
|
|
72
73
|
|
|
@@ -115,3 +116,13 @@ export type PercentageSummaryContent = {
|
|
|
115
116
|
};
|
|
116
117
|
|
|
117
118
|
export type SummaryContent = BaseSummaryContent | PercentageSummaryContent;
|
|
119
|
+
|
|
120
|
+
export type CalendarWidget = AbstractWidget<
|
|
121
|
+
'calendar-card',
|
|
122
|
+
{
|
|
123
|
+
name?: string;
|
|
124
|
+
conditions?: RuleConditionEntity[];
|
|
125
|
+
conditionsOp?: 'and' | 'or';
|
|
126
|
+
timeFrame?: TimeFrame;
|
|
127
|
+
} | null
|
|
128
|
+
>;
|
|
@@ -11,6 +11,7 @@ export interface CustomReportEntity {
|
|
|
11
11
|
groupBy: string;
|
|
12
12
|
interval: string;
|
|
13
13
|
balanceType: string;
|
|
14
|
+
sortBy?: sortByOpType;
|
|
14
15
|
showEmpty: boolean;
|
|
15
16
|
showOffBudget: boolean;
|
|
16
17
|
showHiddenCategories: boolean;
|
|
@@ -30,6 +31,8 @@ export type balanceTypeOpType =
|
|
|
30
31
|
| 'netAssets'
|
|
31
32
|
| 'netDebts';
|
|
32
33
|
|
|
34
|
+
export type sortByOpType = 'asc' | 'desc' | 'name' | 'budget';
|
|
35
|
+
|
|
33
36
|
export type SpendingMonthEntity = Record<
|
|
34
37
|
string | number,
|
|
35
38
|
{
|
|
@@ -122,6 +125,7 @@ export interface CustomReportData {
|
|
|
122
125
|
date_range: string;
|
|
123
126
|
mode: string;
|
|
124
127
|
group_by: string;
|
|
128
|
+
sort_by: sortByOpType;
|
|
125
129
|
balance_type: string;
|
|
126
130
|
show_empty: number;
|
|
127
131
|
show_offbudget: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ScheduleEntity } from './schedule';
|
|
1
|
+
import { type RecurConfig, type ScheduleEntity } from './schedule';
|
|
2
2
|
|
|
3
3
|
export interface NewRuleEntity {
|
|
4
4
|
stage: 'pre' | null | 'post';
|
|
@@ -27,13 +27,15 @@ export type RuleConditionOp =
|
|
|
27
27
|
| 'doesNotContain'
|
|
28
28
|
| 'hasTags'
|
|
29
29
|
| 'and'
|
|
30
|
-
| 'matches'
|
|
30
|
+
| 'matches'
|
|
31
|
+
| 'onBudget'
|
|
32
|
+
| 'offBudget';
|
|
31
33
|
|
|
32
|
-
type FieldValueTypes = {
|
|
34
|
+
export type FieldValueTypes = {
|
|
33
35
|
account: string;
|
|
34
36
|
amount: number;
|
|
35
37
|
category: string;
|
|
36
|
-
date: string;
|
|
38
|
+
date: string | RecurConfig;
|
|
37
39
|
notes: string;
|
|
38
40
|
payee: string;
|
|
39
41
|
payee_name: string;
|
|
@@ -53,7 +55,9 @@ type BaseConditionEntity<
|
|
|
53
55
|
op: Op;
|
|
54
56
|
value: Op extends 'oneOf' | 'notOneOf'
|
|
55
57
|
? Array<FieldValueTypes[Field]>
|
|
56
|
-
:
|
|
58
|
+
: Op extends 'isbetween'
|
|
59
|
+
? { num1: number; num2: number }
|
|
60
|
+
: FieldValueTypes[Field];
|
|
57
61
|
options?: {
|
|
58
62
|
inflow?: boolean;
|
|
59
63
|
outflow?: boolean;
|
|
@@ -76,6 +80,8 @@ export type RuleConditionEntity =
|
|
|
76
80
|
| 'contains'
|
|
77
81
|
| 'doesNotContain'
|
|
78
82
|
| 'matches'
|
|
83
|
+
| 'onBudget'
|
|
84
|
+
| 'offBudget'
|
|
79
85
|
>
|
|
80
86
|
| BaseConditionEntity<
|
|
81
87
|
'category',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AccountEntity } from './account';
|
|
2
2
|
import type { PayeeEntity } from './payee';
|
|
3
|
-
import type { RuleEntity } from './rule';
|
|
3
|
+
import type { RuleConditionEntity, RuleEntity } from './rule';
|
|
4
4
|
|
|
5
5
|
export interface RecurPattern {
|
|
6
6
|
value: number;
|
|
@@ -9,7 +9,7 @@ export interface RecurPattern {
|
|
|
9
9
|
|
|
10
10
|
export interface RecurConfig {
|
|
11
11
|
frequency: 'daily' | 'weekly' | 'monthly' | 'yearly';
|
|
12
|
-
interval
|
|
12
|
+
interval?: number;
|
|
13
13
|
patterns?: RecurPattern[];
|
|
14
14
|
skipWeekend?: boolean;
|
|
15
15
|
start: string;
|
|
@@ -35,8 +35,8 @@ export interface ScheduleEntity {
|
|
|
35
35
|
_amount: number | { num1: number; num2: number };
|
|
36
36
|
_amountOp: string;
|
|
37
37
|
_date: RecurConfig;
|
|
38
|
-
_conditions:
|
|
39
|
-
_actions: unknown
|
|
38
|
+
_conditions: RuleConditionEntity[];
|
|
39
|
+
_actions: Array<{ op: unknown }>;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
export type DiscoverScheduleEntity = {
|
|
@@ -45,18 +45,5 @@ export type DiscoverScheduleEntity = {
|
|
|
45
45
|
payee: PayeeEntity['id'];
|
|
46
46
|
date: ScheduleEntity['_date'];
|
|
47
47
|
amount: ScheduleEntity['_amount'];
|
|
48
|
-
_conditions:
|
|
49
|
-
| { op: 'is'; field: 'account'; value: AccountEntity['id'] }
|
|
50
|
-
| { op: 'is'; field: 'payee'; value: PayeeEntity['id'] }
|
|
51
|
-
| {
|
|
52
|
-
op: 'is' | 'isapprox';
|
|
53
|
-
field: 'date';
|
|
54
|
-
value: ScheduleEntity['_date'];
|
|
55
|
-
}
|
|
56
|
-
| {
|
|
57
|
-
op: 'is' | 'isapprox';
|
|
58
|
-
field: 'amount';
|
|
59
|
-
value: ScheduleEntity['_amount'];
|
|
60
|
-
}
|
|
61
|
-
>;
|
|
48
|
+
_conditions: ScheduleEntity['_conditions'];
|
|
62
49
|
};
|
|
@@ -2,6 +2,7 @@ import { AccountEntity } from './account';
|
|
|
2
2
|
import { BankSyncResponse } from './bank-sync';
|
|
3
3
|
|
|
4
4
|
export type SimpleFinOrganization = {
|
|
5
|
+
id: string;
|
|
5
6
|
name: string;
|
|
6
7
|
domain: string;
|
|
7
8
|
};
|
|
@@ -9,6 +10,7 @@ export type SimpleFinOrganization = {
|
|
|
9
10
|
export type SimpleFinAccount = {
|
|
10
11
|
id: string;
|
|
11
12
|
name: string;
|
|
13
|
+
balance: number;
|
|
12
14
|
org: SimpleFinOrganization;
|
|
13
15
|
};
|
|
14
16
|
|
|
@@ -22,8 +22,14 @@ export interface TransactionEntity {
|
|
|
22
22
|
cleared?: boolean;
|
|
23
23
|
reconciled?: boolean;
|
|
24
24
|
tombstone?: boolean;
|
|
25
|
+
forceUpcoming?: boolean;
|
|
25
26
|
schedule?: ScheduleEntity['id'];
|
|
26
27
|
subtransactions?: TransactionEntity[];
|
|
27
28
|
_unmatched?: boolean;
|
|
28
29
|
_deleted?: boolean;
|
|
30
|
+
error?: {
|
|
31
|
+
type: 'SplitTransactionError';
|
|
32
|
+
version: 1;
|
|
33
|
+
difference: number;
|
|
34
|
+
} | null;
|
|
29
35
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface NewUserEntity {
|
|
2
|
+
userName: string;
|
|
3
|
+
displayName: string;
|
|
4
|
+
role: string;
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface UserEntity extends NewUserEntity {
|
|
8
|
+
id: string;
|
|
9
|
+
owner: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface UserEntityDropdown {
|
|
12
|
+
userId: string;
|
|
13
|
+
userName: string;
|
|
14
|
+
displayName?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface UserAvailable {
|
|
17
|
+
userId: string;
|
|
18
|
+
displayName?: string;
|
|
19
|
+
userName: string;
|
|
20
|
+
haveAccess?: number;
|
|
21
|
+
owner?: number;
|
|
22
|
+
}
|
|
23
|
+
export declare const PossibleRoles: {
|
|
24
|
+
ADMIN: string;
|
|
25
|
+
BASIC: string;
|
|
26
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export type FeatureFlag =
|
|
2
2
|
| 'goalTemplatesEnabled'
|
|
3
3
|
| 'actionTemplating'
|
|
4
|
-
| '
|
|
5
|
-
| '
|
|
4
|
+
| 'contextMenus'
|
|
5
|
+
| 'openidAuth';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Cross-device preferences. These sync across devices when they are changed.
|
|
@@ -30,7 +30,8 @@ export type SyncedPrefs = Partial<
|
|
|
30
30
|
| `csv-has-header-${string}`
|
|
31
31
|
| `ofx-fallback-missing-payee-${string}`
|
|
32
32
|
| `flip-amount-${string}-${'csv' | 'qif'}`
|
|
33
|
-
| `flags.${FeatureFlag}
|
|
33
|
+
| `flags.${FeatureFlag}`
|
|
34
|
+
| `learn-categories`,
|
|
34
35
|
string
|
|
35
36
|
>
|
|
36
37
|
>;
|
|
@@ -76,8 +77,11 @@ export type GlobalPrefs = Partial<{
|
|
|
76
77
|
floatingSidebar: boolean;
|
|
77
78
|
maxMonths: number;
|
|
78
79
|
keyId?: string;
|
|
80
|
+
language: string;
|
|
79
81
|
theme: Theme;
|
|
80
82
|
preferredDarkTheme: DarkTheme;
|
|
81
83
|
documentDir: string; // Electron only
|
|
82
84
|
serverSelfSignedCert: string; // Electron only
|
|
83
85
|
}>;
|
|
86
|
+
|
|
87
|
+
export type AuthMethods = 'password' | 'openid';
|
|
@@ -1,23 +1,86 @@
|
|
|
1
1
|
import { type Backup } from '../server/backups';
|
|
2
2
|
import { type UndoState } from '../server/undo';
|
|
3
3
|
|
|
4
|
+
type SyncSubtype =
|
|
5
|
+
| 'out-of-sync'
|
|
6
|
+
| 'apply-failure'
|
|
7
|
+
| 'decrypt-failure'
|
|
8
|
+
| 'encrypt-failure'
|
|
9
|
+
| 'invalid-schema'
|
|
10
|
+
| 'network'
|
|
11
|
+
| 'file-old-version'
|
|
12
|
+
| 'file-key-mismatch'
|
|
13
|
+
| 'file-not-found'
|
|
14
|
+
| 'file-needs-upload'
|
|
15
|
+
| 'file-has-reset'
|
|
16
|
+
| 'file-has-new-key'
|
|
17
|
+
| 'token-expired'
|
|
18
|
+
| string;
|
|
19
|
+
|
|
20
|
+
type SyncEvent = {
|
|
21
|
+
meta?: Record<string, unknown>;
|
|
22
|
+
} & (
|
|
23
|
+
| {
|
|
24
|
+
type: 'applied';
|
|
25
|
+
tables: string[];
|
|
26
|
+
data?: Map<string, unknown>;
|
|
27
|
+
prevData?: Map<string, unknown>;
|
|
28
|
+
}
|
|
29
|
+
| {
|
|
30
|
+
type: 'success';
|
|
31
|
+
tables: string[];
|
|
32
|
+
syncDisabled?: boolean;
|
|
33
|
+
}
|
|
34
|
+
| {
|
|
35
|
+
type: 'error';
|
|
36
|
+
subtype?: SyncSubtype;
|
|
37
|
+
}
|
|
38
|
+
| {
|
|
39
|
+
type: 'start';
|
|
40
|
+
}
|
|
41
|
+
| {
|
|
42
|
+
type: 'unauthorized';
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
type BackupUpdatedEvent = Backup[];
|
|
47
|
+
|
|
48
|
+
type CellsChangedEvent = Array<{
|
|
49
|
+
name: string;
|
|
50
|
+
value: string | number | boolean;
|
|
51
|
+
}>;
|
|
52
|
+
|
|
53
|
+
type FallbackWriteErrorEvent = undefined;
|
|
54
|
+
type FinishImportEvent = undefined;
|
|
55
|
+
type FinishLoadEvent = undefined;
|
|
56
|
+
|
|
57
|
+
type OrphanedPayeesEvent = {
|
|
58
|
+
orphanedIds: string[];
|
|
59
|
+
updatedPayeeIds: string[];
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
type PrefsUpdatedEvent = undefined;
|
|
63
|
+
type SchedulesOfflineEvent = undefined;
|
|
64
|
+
type ServerErrorEvent = undefined;
|
|
65
|
+
type ShowBudgetsEvent = undefined;
|
|
66
|
+
type StartImportEvent = { budgetName: string };
|
|
67
|
+
type StartLoadEvent = undefined;
|
|
68
|
+
type ApiFetchRedirectedEvent = undefined;
|
|
69
|
+
|
|
4
70
|
export interface ServerEvents {
|
|
5
|
-
'backups-updated':
|
|
6
|
-
'cells-changed':
|
|
7
|
-
'fallback-write-error':
|
|
8
|
-
'finish-import':
|
|
9
|
-
'finish-load':
|
|
10
|
-
'orphaned-payees':
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
'
|
|
15
|
-
'
|
|
16
|
-
'
|
|
17
|
-
'
|
|
18
|
-
'start-import': unknown;
|
|
19
|
-
'start-load': unknown;
|
|
20
|
-
'sync-event': { type; subtype; meta; tables; syncDisabled };
|
|
71
|
+
'backups-updated': BackupUpdatedEvent;
|
|
72
|
+
'cells-changed': CellsChangedEvent;
|
|
73
|
+
'fallback-write-error': FallbackWriteErrorEvent;
|
|
74
|
+
'finish-import': FinishImportEvent;
|
|
75
|
+
'finish-load': FinishLoadEvent;
|
|
76
|
+
'orphaned-payees': OrphanedPayeesEvent;
|
|
77
|
+
'prefs-updated': PrefsUpdatedEvent;
|
|
78
|
+
'schedules-offline': SchedulesOfflineEvent;
|
|
79
|
+
'server-error': ServerErrorEvent;
|
|
80
|
+
'show-budgets': ShowBudgetsEvent;
|
|
81
|
+
'start-import': StartImportEvent;
|
|
82
|
+
'start-load': StartLoadEvent;
|
|
83
|
+
'sync-event': SyncEvent;
|
|
21
84
|
'undo-event': UndoState;
|
|
22
|
-
'api-fetch-redirected':
|
|
85
|
+
'api-fetch-redirected': ApiFetchRedirectedEvent;
|
|
23
86
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ImportTransactionsOpts } from '@actual-app/api';
|
|
2
|
+
|
|
1
3
|
import { ParseFileResult } from '../server/accounts/parse-file';
|
|
2
4
|
import { batchUpdateTransactions } from '../server/accounts/transactions';
|
|
3
5
|
import { Backup } from '../server/backups';
|
|
@@ -17,7 +19,9 @@ import {
|
|
|
17
19
|
RuleEntity,
|
|
18
20
|
PayeeEntity,
|
|
19
21
|
} from './models';
|
|
22
|
+
import { OpenIdConfig } from './models/openid';
|
|
20
23
|
import { GlobalPrefs, MetadataPrefs } from './prefs';
|
|
24
|
+
// eslint-disable-next-line import/no-unresolved
|
|
21
25
|
import { Query } from './query';
|
|
22
26
|
import { EmptyObject } from './util';
|
|
23
27
|
|
|
@@ -48,7 +52,7 @@ export interface ServerHandlers {
|
|
|
48
52
|
payees;
|
|
49
53
|
}) => Promise<unknown>;
|
|
50
54
|
|
|
51
|
-
'transactions-export-query': (arg: { query: QueryState }) => Promise<
|
|
55
|
+
'transactions-export-query': (arg: { query: QueryState }) => Promise<string>;
|
|
52
56
|
|
|
53
57
|
'get-categories': () => Promise<{
|
|
54
58
|
grouped: Array<CategoryGroupEntity>;
|
|
@@ -105,7 +109,7 @@ export interface ServerHandlers {
|
|
|
105
109
|
|
|
106
110
|
'payees-get': () => Promise<PayeeEntity[]>;
|
|
107
111
|
|
|
108
|
-
'payees-get-rule-counts': () => Promise<
|
|
112
|
+
'payees-get-rule-counts': () => Promise<Record<PayeeEntity['id'], number>>;
|
|
109
113
|
|
|
110
114
|
'payees-merge': (arg: { targetId; mergeIds }) => Promise<void>;
|
|
111
115
|
|
|
@@ -121,7 +125,7 @@ export interface ServerHandlers {
|
|
|
121
125
|
'payees-get-rules': (arg: { id: string }) => Promise<RuleEntity[]>;
|
|
122
126
|
|
|
123
127
|
'make-filters-from-conditions': (arg: {
|
|
124
|
-
conditions;
|
|
128
|
+
conditions: unknown;
|
|
125
129
|
}) => Promise<{ filters: unknown[] }>;
|
|
126
130
|
|
|
127
131
|
getCell: (arg: {
|
|
@@ -137,7 +141,8 @@ export interface ServerHandlers {
|
|
|
137
141
|
|
|
138
142
|
'create-query': (arg: { sheetName; name; query }) => Promise<unknown>;
|
|
139
143
|
|
|
140
|
-
|
|
144
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
145
|
+
query: (query: Query) => Promise<{ data: any; dependencies: string[] }>;
|
|
141
146
|
|
|
142
147
|
'account-update': (arg: { id; name }) => Promise<unknown>;
|
|
143
148
|
|
|
@@ -178,7 +183,10 @@ export interface ServerHandlers {
|
|
|
178
183
|
|
|
179
184
|
'account-move': (arg: { id; targetId }) => Promise<unknown>;
|
|
180
185
|
|
|
181
|
-
'secret-set': (arg: {
|
|
186
|
+
'secret-set': (arg: {
|
|
187
|
+
name: string;
|
|
188
|
+
value: string | null;
|
|
189
|
+
}) => Promise<{ error?: string; reason?: string }>;
|
|
182
190
|
'secret-check': (arg: string) => Promise<string | { error?: string }>;
|
|
183
191
|
|
|
184
192
|
'gocardless-poll-web-token': (arg: {
|
|
@@ -192,7 +200,11 @@ export interface ServerHandlers {
|
|
|
192
200
|
|
|
193
201
|
'simplefin-status': () => Promise<{ configured: boolean }>;
|
|
194
202
|
|
|
195
|
-
'simplefin-accounts': () => Promise<{
|
|
203
|
+
'simplefin-accounts': () => Promise<{
|
|
204
|
+
accounts?: SimpleFinAccount[];
|
|
205
|
+
error_code?: string;
|
|
206
|
+
reason?: string;
|
|
207
|
+
}>;
|
|
196
208
|
|
|
197
209
|
'simplefin-batch-sync': ({ ids }: { ids: string[] }) => Promise<
|
|
198
210
|
{
|
|
@@ -237,6 +249,7 @@ export interface ServerHandlers {
|
|
|
237
249
|
accountId;
|
|
238
250
|
transactions;
|
|
239
251
|
isPreview;
|
|
252
|
+
opts?: ImportTransactionsOpts;
|
|
240
253
|
}) => Promise<{
|
|
241
254
|
errors?: { message: string }[];
|
|
242
255
|
added;
|
|
@@ -269,27 +282,64 @@ export interface ServerHandlers {
|
|
|
269
282
|
|
|
270
283
|
'get-did-bootstrap': () => Promise<boolean>;
|
|
271
284
|
|
|
272
|
-
'subscribe-needs-bootstrap': (args: {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
285
|
+
'subscribe-needs-bootstrap': (args: { url }) => Promise<
|
|
286
|
+
| { error: string }
|
|
287
|
+
| {
|
|
288
|
+
bootstrapped: boolean;
|
|
289
|
+
hasServer: false;
|
|
290
|
+
}
|
|
291
|
+
| {
|
|
292
|
+
bootstrapped: boolean;
|
|
293
|
+
hasServer: true;
|
|
294
|
+
availableLoginMethods: {
|
|
295
|
+
method: string;
|
|
296
|
+
displayName: string;
|
|
297
|
+
active: boolean;
|
|
298
|
+
}[];
|
|
299
|
+
multiuser: boolean;
|
|
300
|
+
}
|
|
276
301
|
>;
|
|
277
302
|
|
|
278
|
-
'subscribe-
|
|
303
|
+
'subscribe-get-login-methods': () => Promise<{
|
|
304
|
+
methods?: { method: string; displayName: string; active: boolean }[];
|
|
305
|
+
error?: string;
|
|
306
|
+
}>;
|
|
307
|
+
|
|
308
|
+
'subscribe-bootstrap': (arg: {
|
|
309
|
+
password?: string;
|
|
310
|
+
openId?: OpenIdConfig;
|
|
311
|
+
}) => Promise<{ error?: string }>;
|
|
279
312
|
|
|
280
|
-
'subscribe-get-user': () => Promise<{
|
|
313
|
+
'subscribe-get-user': () => Promise<{
|
|
314
|
+
offline: boolean;
|
|
315
|
+
userName?: string;
|
|
316
|
+
userId?: string;
|
|
317
|
+
displayName?: string;
|
|
318
|
+
permission?: string;
|
|
319
|
+
loginMethod?: string;
|
|
320
|
+
tokenExpired?: boolean;
|
|
321
|
+
} | null>;
|
|
281
322
|
|
|
282
323
|
'subscribe-change-password': (arg: {
|
|
283
324
|
password;
|
|
284
325
|
}) => Promise<{ error?: string }>;
|
|
285
326
|
|
|
286
|
-
'subscribe-sign-in': (
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
327
|
+
'subscribe-sign-in': (
|
|
328
|
+
arg:
|
|
329
|
+
| {
|
|
330
|
+
password;
|
|
331
|
+
loginMethod?: string;
|
|
332
|
+
}
|
|
333
|
+
| {
|
|
334
|
+
return_url;
|
|
335
|
+
loginMethod?: 'openid';
|
|
336
|
+
},
|
|
337
|
+
) => Promise<{ error?: string; redirect_url?: string }>;
|
|
290
338
|
|
|
291
339
|
'subscribe-sign-out': () => Promise<'ok'>;
|
|
292
340
|
|
|
341
|
+
'subscribe-set-token': (arg: { token: string }) => Promise<void>;
|
|
342
|
+
|
|
293
343
|
'get-server-version': () => Promise<{ error?: string } | { version: string }>;
|
|
294
344
|
|
|
295
345
|
'get-server-url': () => Promise<string | null>;
|
|
@@ -304,10 +354,18 @@ export interface ServerHandlers {
|
|
|
304
354
|
| { messages: Message[] }
|
|
305
355
|
>;
|
|
306
356
|
|
|
357
|
+
'validate-budget-name': (arg: {
|
|
358
|
+
name: string;
|
|
359
|
+
}) => Promise<{ valid: boolean; message?: string }>;
|
|
360
|
+
|
|
361
|
+
'unique-budget-name': (arg: { name: string }) => Promise<string>;
|
|
362
|
+
|
|
307
363
|
'get-budgets': () => Promise<Budget[]>;
|
|
308
364
|
|
|
309
365
|
'get-remote-files': () => Promise<RemoteFile[]>;
|
|
310
366
|
|
|
367
|
+
'get-user-file-info': (fileId: string) => Promise<RemoteFile | null>;
|
|
368
|
+
|
|
311
369
|
'reset-budget-cache': () => Promise<unknown>;
|
|
312
370
|
|
|
313
371
|
'upload-budget': (arg: { id }) => Promise<{ error?: string }>;
|
|
@@ -327,7 +385,24 @@ export interface ServerHandlers {
|
|
|
327
385
|
'delete-budget': (arg: {
|
|
328
386
|
id?: string;
|
|
329
387
|
cloudFileId?: string;
|
|
330
|
-
}) => Promise<'ok'>;
|
|
388
|
+
}) => Promise<'ok' | 'fail'>;
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* Duplicates a budget file.
|
|
392
|
+
* @param {Object} arg - The arguments for duplicating a budget.
|
|
393
|
+
* @param {string} [arg.id] - The ID of the local budget to duplicate.
|
|
394
|
+
* @param {string} [arg.cloudId] - The ID of the cloud-synced budget to duplicate.
|
|
395
|
+
* @param {string} arg.newName - The name for the duplicated budget.
|
|
396
|
+
* @param {boolean} [arg.cloudSync] - Whether to sync the duplicated budget to the cloud.
|
|
397
|
+
* @returns {Promise<string>} The ID of the newly created budget.
|
|
398
|
+
*/
|
|
399
|
+
'duplicate-budget': (arg: {
|
|
400
|
+
id?: string;
|
|
401
|
+
cloudId?: string;
|
|
402
|
+
newName: string;
|
|
403
|
+
cloudSync?: boolean;
|
|
404
|
+
open: 'none' | 'original' | 'copy';
|
|
405
|
+
}) => Promise<string>;
|
|
331
406
|
|
|
332
407
|
'create-budget': (arg: {
|
|
333
408
|
budgetName?;
|
|
@@ -357,4 +432,18 @@ export interface ServerHandlers {
|
|
|
357
432
|
'get-last-opened-backup': () => Promise<string | null>;
|
|
358
433
|
|
|
359
434
|
'app-focused': () => Promise<void>;
|
|
435
|
+
|
|
436
|
+
'enable-openid': (arg: {
|
|
437
|
+
openId?: OpenIdConfig;
|
|
438
|
+
}) => Promise<{ error?: string }>;
|
|
439
|
+
|
|
440
|
+
'enable-password': (arg: { password: string }) => Promise<{ error?: string }>;
|
|
441
|
+
|
|
442
|
+
'get-openid-config': () => Promise<
|
|
443
|
+
| {
|
|
444
|
+
openId: OpenIdConfig;
|
|
445
|
+
}
|
|
446
|
+
| { error: string }
|
|
447
|
+
| null
|
|
448
|
+
>;
|
|
360
449
|
}
|
|
@@ -9,3 +9,8 @@ export type EverythingButIdOptional<T> = { id: T['id'] } & Partial<
|
|
|
9
9
|
>;
|
|
10
10
|
|
|
11
11
|
export type WithRequired<T, K extends keyof T> = T & Required<Pick<T, K>>;
|
|
12
|
+
|
|
13
|
+
// Allows use of object literals inside child elements of `Trans` tags
|
|
14
|
+
// see https://github.com/i18next/react-i18next/issues/1483
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
|
+
export type TransObjectLiteral = any;
|
package/@types/methods.d.ts
CHANGED
|
@@ -31,7 +31,10 @@ export declare function addTransactions(accountId: any, transactions: any, { lea
|
|
|
31
31
|
learnCategories?: boolean;
|
|
32
32
|
runTransfers?: boolean;
|
|
33
33
|
}): Promise<"ok">;
|
|
34
|
-
export
|
|
34
|
+
export interface ImportTransactionsOpts {
|
|
35
|
+
defaultCleared?: boolean;
|
|
36
|
+
}
|
|
37
|
+
export declare function importTransactions(accountId: any, transactions: any, opts?: ImportTransactionsOpts): Promise<{
|
|
35
38
|
errors?: {
|
|
36
39
|
message: string;
|
|
37
40
|
}[];
|
|
@@ -42,9 +45,6 @@ export declare function getTransactions(accountId: any, startDate: any, endDate:
|
|
|
42
45
|
export declare function updateTransaction(id: any, fields: any): Promise<import("./loot-core/types/models").TransactionEntity[] | ({
|
|
43
46
|
id: any;
|
|
44
47
|
transfer_id: any;
|
|
45
|
-
} | {
|
|
46
|
-
id: any;
|
|
47
|
-
payee: any;
|
|
48
48
|
} | {
|
|
49
49
|
id: any;
|
|
50
50
|
category: any;
|