@actual-app/api 25.12.0-nightly.20251121 → 25.12.0-nightly.20251123
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/src/server/api-models.d.ts +12 -16
- package/@types/loot-core/src/server/budget/app.d.ts +2 -2
- package/@types/loot-core/src/types/api-handlers.d.ts +60 -51
- package/@types/loot-core/src/types/models/schedule.d.ts +2 -2
- package/@types/loot-core/src/types/server-handlers.d.ts +3 -1
- package/@types/loot-core/typings/window.d.ts +1 -0
- package/@types/methods.d.ts +63 -53
- package/dist/app/bundle.api.js +14 -48
- package/dist/methods.js +3 -3
- package/dist/package.json +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Budget } from '../types/budget';
|
|
2
|
-
import type { AccountEntity, CategoryEntity, CategoryGroupEntity, PayeeEntity, ScheduleEntity
|
|
2
|
+
import type { AccountEntity, CategoryEntity, CategoryGroupEntity, PayeeEntity, ScheduleEntity } from '../types/models';
|
|
3
3
|
import { RemoteFile } from './cloud-storage';
|
|
4
4
|
export type APIAccountEntity = Pick<AccountEntity, 'id' | 'name'> & {
|
|
5
|
-
offbudget
|
|
6
|
-
closed
|
|
5
|
+
offbudget?: boolean;
|
|
6
|
+
closed?: boolean;
|
|
7
7
|
};
|
|
8
8
|
export declare const accountModel: {
|
|
9
9
|
toExternal(account: AccountEntity): APIAccountEntity;
|
|
@@ -27,7 +27,7 @@ export declare const categoryModel: {
|
|
|
27
27
|
fromDb(category: import("./db").DbCategory): CategoryEntity;
|
|
28
28
|
};
|
|
29
29
|
export type APICategoryGroupEntity = Pick<CategoryGroupEntity, 'id' | 'name' | 'is_income' | 'hidden'> & {
|
|
30
|
-
categories
|
|
30
|
+
categories?: APICategoryEntity[];
|
|
31
31
|
};
|
|
32
32
|
export declare const categoryGroupModel: {
|
|
33
33
|
toExternal(group: CategoryGroupEntity): APICategoryGroupEntity;
|
|
@@ -72,19 +72,15 @@ export declare const budgetModel: {
|
|
|
72
72
|
fromExternal(file: APIFileEntity): Budget;
|
|
73
73
|
};
|
|
74
74
|
export type AmountOPType = 'is' | 'isapprox' | 'isbetween';
|
|
75
|
-
export type APIScheduleEntity = Pick<ScheduleEntity, 'id' | 'name'> & {
|
|
76
|
-
rule?:
|
|
77
|
-
next_date?:
|
|
78
|
-
completed?:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
amount: number | {
|
|
83
|
-
num1: number;
|
|
84
|
-
num2: number;
|
|
85
|
-
};
|
|
75
|
+
export type APIScheduleEntity = Pick<ScheduleEntity, 'id' | 'name' | 'posts_transaction'> & {
|
|
76
|
+
rule?: ScheduleEntity['rule'];
|
|
77
|
+
next_date?: ScheduleEntity['next_date'];
|
|
78
|
+
completed?: ScheduleEntity['completed'];
|
|
79
|
+
payee?: ScheduleEntity['_payee'];
|
|
80
|
+
account?: ScheduleEntity['_account'];
|
|
81
|
+
amount?: ScheduleEntity['_amount'];
|
|
86
82
|
amountOp: AmountOPType;
|
|
87
|
-
date:
|
|
83
|
+
date: ScheduleEntity['_date'];
|
|
88
84
|
};
|
|
89
85
|
export declare const scheduleModel: {
|
|
90
86
|
toExternal(schedule: ScheduleEntity): APIScheduleEntity;
|
|
@@ -88,10 +88,10 @@ declare function createCategory({ name, groupId, isIncome, hidden, }: {
|
|
|
88
88
|
hidden?: boolean;
|
|
89
89
|
}): Promise<CategoryEntity['id']>;
|
|
90
90
|
declare function updateCategory(category: CategoryEntity): Promise<{
|
|
91
|
-
error
|
|
91
|
+
error: {
|
|
92
92
|
type: 'category-exists';
|
|
93
93
|
};
|
|
94
|
-
}>;
|
|
94
|
+
} | object>;
|
|
95
95
|
declare function moveCategory({ id, groupId, targetId, }: {
|
|
96
96
|
id: CategoryEntity['id'];
|
|
97
97
|
groupId: CategoryGroupEntity['id'];
|
|
@@ -3,10 +3,11 @@ import type { ImportTransactionsResult } from '../server/accounts/app';
|
|
|
3
3
|
import type { APIAccountEntity, APICategoryEntity, APICategoryGroupEntity, APIFileEntity, APIPayeeEntity, APIScheduleEntity } from '../server/api-models';
|
|
4
4
|
import { BudgetFileHandlers } from '../server/budgetfiles/app';
|
|
5
5
|
import { type batchUpdateTransactions } from '../server/transactions';
|
|
6
|
+
import type { QueryState } from '../shared/query';
|
|
6
7
|
import type { ImportTransactionEntity, NewRuleEntity, RuleEntity, TransactionEntity, ScheduleEntity } from './models';
|
|
7
8
|
export interface ApiHandlers {
|
|
8
|
-
'api/batch-budget-start': () => Promise<
|
|
9
|
-
'api/batch-budget-end': () => Promise<
|
|
9
|
+
'api/batch-budget-start': () => Promise<void>;
|
|
10
|
+
'api/batch-budget-end': () => Promise<void>;
|
|
10
11
|
'api/load-budget': (...args: Parameters<BudgetFileHandlers['load-budget']>) => Promise<void>;
|
|
11
12
|
'api/download-budget': (arg: {
|
|
12
13
|
syncId: string;
|
|
@@ -19,11 +20,11 @@ export interface ApiHandlers {
|
|
|
19
20
|
'api/finish-import': () => Promise<void>;
|
|
20
21
|
'api/abort-import': () => Promise<void>;
|
|
21
22
|
'api/query': (arg: {
|
|
22
|
-
query:
|
|
23
|
+
query: QueryState;
|
|
23
24
|
}) => Promise<unknown>;
|
|
24
25
|
'api/budget-months': () => Promise<string[]>;
|
|
25
26
|
'api/budget-month': (arg: {
|
|
26
|
-
month:
|
|
27
|
+
month: string;
|
|
27
28
|
}) => Promise<{
|
|
28
29
|
month: string;
|
|
29
30
|
incomeAvailable: number;
|
|
@@ -61,104 +62,110 @@ export interface ApiHandlers {
|
|
|
61
62
|
accounts: any;
|
|
62
63
|
}) => Promise<unknown>;
|
|
63
64
|
'api/transactions-import': (arg: {
|
|
64
|
-
accountId:
|
|
65
|
+
accountId: APIAccountEntity['id'];
|
|
65
66
|
transactions: ImportTransactionEntity[];
|
|
66
|
-
isPreview?:
|
|
67
|
+
isPreview?: boolean;
|
|
67
68
|
opts?: ImportTransactionsOpts;
|
|
68
69
|
}) => Promise<ImportTransactionsResult>;
|
|
69
70
|
'api/transactions-add': (arg: {
|
|
70
|
-
accountId:
|
|
71
|
-
transactions:
|
|
71
|
+
accountId: APIAccountEntity['id'];
|
|
72
|
+
transactions: Omit<ImportTransactionEntity, 'account'>[];
|
|
72
73
|
runTransfers?: boolean;
|
|
73
74
|
learnCategories?: boolean;
|
|
74
75
|
}) => Promise<'ok'>;
|
|
75
76
|
'api/transactions-get': (arg: {
|
|
76
|
-
accountId?:
|
|
77
|
+
accountId?: APIAccountEntity['id'];
|
|
77
78
|
startDate?: string;
|
|
78
79
|
endDate?: string;
|
|
79
80
|
}) => Promise<TransactionEntity[]>;
|
|
80
81
|
'api/transaction-update': (arg: {
|
|
81
|
-
id:
|
|
82
|
+
id: TransactionEntity['id'];
|
|
82
83
|
fields: any;
|
|
83
84
|
}) => Promise<Awaited<ReturnType<typeof batchUpdateTransactions>>['updated']>;
|
|
84
85
|
'api/transaction-delete': (arg: {
|
|
85
|
-
id:
|
|
86
|
+
id: TransactionEntity['id'];
|
|
86
87
|
}) => Promise<Awaited<ReturnType<typeof batchUpdateTransactions>>['deleted']>;
|
|
87
88
|
'api/sync': () => Promise<void>;
|
|
88
89
|
'api/bank-sync': (arg?: {
|
|
89
|
-
accountId:
|
|
90
|
+
accountId: APIAccountEntity['id'];
|
|
90
91
|
}) => Promise<void>;
|
|
91
92
|
'api/accounts-get': () => Promise<APIAccountEntity[]>;
|
|
92
93
|
'api/account-create': (arg: {
|
|
93
|
-
account:
|
|
94
|
-
initialBalance?:
|
|
94
|
+
account: Omit<APIAccountEntity, 'id'>;
|
|
95
|
+
initialBalance?: number;
|
|
95
96
|
}) => Promise<string>;
|
|
96
97
|
'api/account-update': (arg: {
|
|
97
|
-
id:
|
|
98
|
+
id: APIAccountEntity['id'];
|
|
98
99
|
fields: any;
|
|
99
100
|
}) => Promise<void>;
|
|
100
101
|
'api/account-close': (arg: {
|
|
101
|
-
id:
|
|
102
|
-
transferAccountId
|
|
103
|
-
transferCategoryId
|
|
104
|
-
}) => Promise<
|
|
102
|
+
id: APIAccountEntity['id'];
|
|
103
|
+
transferAccountId?: APIAccountEntity['id'];
|
|
104
|
+
transferCategoryId?: APICategoryEntity['id'];
|
|
105
|
+
}) => Promise<void>;
|
|
105
106
|
'api/account-reopen': (arg: {
|
|
106
|
-
id:
|
|
107
|
-
}) => Promise<
|
|
107
|
+
id: APIAccountEntity['id'];
|
|
108
|
+
}) => Promise<void>;
|
|
108
109
|
'api/account-delete': (arg: {
|
|
109
|
-
id:
|
|
110
|
-
}) => Promise<
|
|
110
|
+
id: APIAccountEntity['id'];
|
|
111
|
+
}) => Promise<void>;
|
|
111
112
|
'api/account-balance': (arg: {
|
|
112
|
-
id:
|
|
113
|
+
id: APIAccountEntity['id'];
|
|
113
114
|
cutoff?: Date;
|
|
114
115
|
}) => Promise<number>;
|
|
115
116
|
'api/categories-get': (arg: {
|
|
116
|
-
grouped
|
|
117
|
+
grouped?: boolean;
|
|
117
118
|
}) => Promise<Array<APICategoryGroupEntity | APICategoryEntity>>;
|
|
118
119
|
'api/category-groups-get': () => Promise<APICategoryGroupEntity[]>;
|
|
119
120
|
'api/category-group-create': (arg: {
|
|
120
|
-
group:
|
|
121
|
-
}) => Promise<
|
|
121
|
+
group: Omit<APICategoryGroupEntity, 'id'>;
|
|
122
|
+
}) => Promise<APICategoryGroupEntity['id']>;
|
|
122
123
|
'api/category-group-update': (arg: {
|
|
123
|
-
id:
|
|
124
|
+
id: APICategoryGroupEntity['id'];
|
|
124
125
|
fields: any;
|
|
125
|
-
}) => Promise<
|
|
126
|
+
}) => Promise<void>;
|
|
126
127
|
'api/category-group-delete': (arg: {
|
|
127
|
-
id:
|
|
128
|
-
transferCategoryId
|
|
129
|
-
}) => Promise<
|
|
128
|
+
id: APICategoryGroupEntity['id'];
|
|
129
|
+
transferCategoryId?: APICategoryEntity['id'];
|
|
130
|
+
}) => Promise<void>;
|
|
130
131
|
'api/category-create': (arg: {
|
|
131
|
-
category:
|
|
132
|
-
}) => Promise<
|
|
132
|
+
category: Omit<APICategoryEntity, 'id'>;
|
|
133
|
+
}) => Promise<APICategoryEntity['id']>;
|
|
133
134
|
'api/category-update': (arg: {
|
|
134
|
-
id:
|
|
135
|
+
id: APICategoryEntity['id'];
|
|
135
136
|
fields: any;
|
|
136
|
-
}) => Promise<
|
|
137
|
+
}) => Promise<{
|
|
138
|
+
error: {
|
|
139
|
+
type: 'category-exists';
|
|
140
|
+
};
|
|
141
|
+
} | object>;
|
|
137
142
|
'api/category-delete': (arg: {
|
|
138
|
-
id:
|
|
139
|
-
transferCategoryId?:
|
|
143
|
+
id: APICategoryEntity['id'];
|
|
144
|
+
transferCategoryId?: APICategoryEntity['id'];
|
|
140
145
|
}) => Promise<{
|
|
141
|
-
error
|
|
142
|
-
}
|
|
146
|
+
error: 'no-categories';
|
|
147
|
+
} | {
|
|
148
|
+
error: 'category-type';
|
|
149
|
+
} | object>;
|
|
143
150
|
'api/payees-get': () => Promise<APIPayeeEntity[]>;
|
|
144
151
|
'api/common-payees-get': () => Promise<APIPayeeEntity[]>;
|
|
145
152
|
'api/payee-create': (arg: {
|
|
146
|
-
payee:
|
|
147
|
-
}) => Promise<
|
|
153
|
+
payee: Omit<APIPayeeEntity, 'id'>;
|
|
154
|
+
}) => Promise<APIPayeeEntity['id']>;
|
|
148
155
|
'api/payee-update': (arg: {
|
|
149
|
-
id:
|
|
156
|
+
id: APIPayeeEntity['id'];
|
|
150
157
|
fields: any;
|
|
151
|
-
}) => Promise<
|
|
158
|
+
}) => Promise<void>;
|
|
152
159
|
'api/payee-delete': (arg: {
|
|
153
|
-
id:
|
|
154
|
-
}) => Promise<
|
|
160
|
+
id: APIPayeeEntity['id'];
|
|
161
|
+
}) => Promise<void>;
|
|
155
162
|
'api/payees-merge': (arg: {
|
|
156
|
-
targetId:
|
|
163
|
+
targetId: APIPayeeEntity['id'];
|
|
157
164
|
mergeIds: string[];
|
|
158
165
|
}) => Promise<void>;
|
|
159
166
|
'api/rules-get': () => Promise<RuleEntity[]>;
|
|
160
167
|
'api/payee-rules-get': (arg: {
|
|
161
|
-
id:
|
|
168
|
+
id: APIPayeeEntity['id'];
|
|
162
169
|
}) => Promise<RuleEntity[]>;
|
|
163
170
|
'api/rule-create': (arg: {
|
|
164
171
|
rule: NewRuleEntity;
|
|
@@ -166,8 +173,8 @@ export interface ApiHandlers {
|
|
|
166
173
|
'api/rule-update': (arg: {
|
|
167
174
|
rule: RuleEntity;
|
|
168
175
|
}) => Promise<RuleEntity>;
|
|
169
|
-
'api/rule-delete': (id:
|
|
170
|
-
'api/schedule-create': (schedule: APIScheduleEntity) => Promise<ScheduleEntity['id']>;
|
|
176
|
+
'api/rule-delete': (id: RuleEntity['id']) => Promise<boolean>;
|
|
177
|
+
'api/schedule-create': (schedule: Omit<APIScheduleEntity, 'id'>) => Promise<ScheduleEntity['id']>;
|
|
171
178
|
'api/schedule-update': (arg: {
|
|
172
179
|
id: ScheduleEntity['id'];
|
|
173
180
|
fields: Partial<APIScheduleEntity>;
|
|
@@ -180,7 +187,9 @@ export interface ApiHandlers {
|
|
|
180
187
|
name: string;
|
|
181
188
|
}) => Promise<string>;
|
|
182
189
|
'api/get-server-version': () => Promise<{
|
|
183
|
-
error
|
|
190
|
+
error: 'no-server';
|
|
191
|
+
} | {
|
|
192
|
+
error: 'network-failure';
|
|
184
193
|
} | {
|
|
185
194
|
version: string;
|
|
186
195
|
}>;
|
|
@@ -31,7 +31,7 @@ export interface ScheduleEntity {
|
|
|
31
31
|
num2: number;
|
|
32
32
|
};
|
|
33
33
|
_amountOp: string;
|
|
34
|
-
_date: RecurConfig;
|
|
34
|
+
_date: RecurConfig | string;
|
|
35
35
|
_conditions: RuleConditionEntity[];
|
|
36
36
|
_actions: Array<{
|
|
37
37
|
op: unknown;
|
|
@@ -41,7 +41,7 @@ export type DiscoverScheduleEntity = {
|
|
|
41
41
|
id: ScheduleEntity['id'];
|
|
42
42
|
account: AccountEntity['id'];
|
|
43
43
|
payee: PayeeEntity['id'];
|
|
44
|
-
date:
|
|
44
|
+
date: RecurConfig;
|
|
45
45
|
amount: ScheduleEntity['_amount'];
|
|
46
46
|
_conditions: ScheduleEntity['_conditions'];
|
|
47
47
|
};
|
package/@types/methods.d.ts
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { APIAccountEntity, APICategoryEntity, APICategoryGroupEntity, APIFileEntity, APIPayeeEntity, APIScheduleEntity } from './loot-core/src/server/api-models';
|
|
2
|
+
import type { Query } from './loot-core/src/shared/query';
|
|
3
|
+
import type { ImportTransactionEntity, RuleEntity, TransactionEntity } from './loot-core/src/types/models';
|
|
2
4
|
export { q } from './app/query';
|
|
3
|
-
export declare function runImport(
|
|
4
|
-
export declare function loadBudget(budgetId:
|
|
5
|
-
export declare function downloadBudget(syncId:
|
|
6
|
-
password?:
|
|
5
|
+
export declare function runImport(budgetName: APIFileEntity['name'], func: () => Promise<void>): Promise<void>;
|
|
6
|
+
export declare function loadBudget(budgetId: string): Promise<void>;
|
|
7
|
+
export declare function downloadBudget(syncId: string, { password }?: {
|
|
8
|
+
password?: string;
|
|
7
9
|
}): Promise<void>;
|
|
8
|
-
export declare function getBudgets(): Promise<
|
|
10
|
+
export declare function getBudgets(): Promise<APIFileEntity[]>;
|
|
9
11
|
export declare function sync(): Promise<void>;
|
|
10
12
|
export declare function runBankSync(args?: {
|
|
11
|
-
accountId:
|
|
13
|
+
accountId: APIAccountEntity['id'];
|
|
12
14
|
}): Promise<void>;
|
|
13
|
-
export declare function batchBudgetUpdates(func:
|
|
15
|
+
export declare function batchBudgetUpdates(func: () => Promise<void>): Promise<void>;
|
|
14
16
|
/**
|
|
15
17
|
* @deprecated Please use `aqlQuery` instead.
|
|
16
18
|
* This function will be removed in a future release.
|
|
17
19
|
*/
|
|
18
|
-
export declare function runQuery(query:
|
|
19
|
-
export declare function aqlQuery(query:
|
|
20
|
+
export declare function runQuery(query: Query): Promise<unknown>;
|
|
21
|
+
export declare function aqlQuery(query: Query): Promise<unknown>;
|
|
20
22
|
export declare function getBudgetMonths(): Promise<string[]>;
|
|
21
|
-
export declare function getBudgetMonth(month:
|
|
23
|
+
export declare function getBudgetMonth(month: string): Promise<{
|
|
22
24
|
month: string;
|
|
23
25
|
incomeAvailable: number;
|
|
24
26
|
lastMonthOverspent: number;
|
|
@@ -31,9 +33,9 @@ export declare function getBudgetMonth(month: any): Promise<{
|
|
|
31
33
|
totalBalance: number;
|
|
32
34
|
categoryGroups: Record<string, unknown>[];
|
|
33
35
|
}>;
|
|
34
|
-
export declare function setBudgetAmount(month:
|
|
35
|
-
export declare function setBudgetCarryover(month:
|
|
36
|
-
export declare function addTransactions(accountId:
|
|
36
|
+
export declare function setBudgetAmount(month: string, categoryId: APICategoryEntity['id'], value: number): Promise<void>;
|
|
37
|
+
export declare function setBudgetCarryover(month: string, categoryId: APICategoryEntity['id'], flag: boolean): Promise<void>;
|
|
38
|
+
export declare function addTransactions(accountId: APIAccountEntity['id'], transactions: Omit<ImportTransactionEntity, 'account'>[], { learnCategories, runTransfers, }?: {
|
|
37
39
|
learnCategories?: boolean;
|
|
38
40
|
runTransfers?: boolean;
|
|
39
41
|
}): Promise<"ok">;
|
|
@@ -41,57 +43,65 @@ export interface ImportTransactionsOpts {
|
|
|
41
43
|
defaultCleared?: boolean;
|
|
42
44
|
dryRun?: boolean;
|
|
43
45
|
}
|
|
44
|
-
export declare function importTransactions(accountId:
|
|
46
|
+
export declare function importTransactions(accountId: APIAccountEntity['id'], transactions: ImportTransactionEntity[], opts?: ImportTransactionsOpts): Promise<import("./@types/loot-core/src/server/accounts/sync").ReconcileTransactionsResult & {
|
|
45
47
|
errors: Array<{
|
|
46
48
|
message: string;
|
|
47
49
|
}>;
|
|
48
50
|
}>;
|
|
49
|
-
export declare function getTransactions(accountId:
|
|
50
|
-
export declare function updateTransaction(id:
|
|
51
|
+
export declare function getTransactions(accountId: APIAccountEntity['id'], startDate: string, endDate: string): Promise<TransactionEntity[]>;
|
|
52
|
+
export declare function updateTransaction(id: TransactionEntity['id'], fields: Partial<TransactionEntity>): Promise<TransactionEntity[] | ({
|
|
51
53
|
id: any;
|
|
52
54
|
transfer_id: any;
|
|
53
55
|
} | {
|
|
54
56
|
id: any;
|
|
55
57
|
category: any;
|
|
56
58
|
})[]>;
|
|
57
|
-
export declare function deleteTransaction(id:
|
|
58
|
-
export declare function getAccounts(): Promise<
|
|
59
|
-
export declare function createAccount(account:
|
|
60
|
-
export declare function updateAccount(id:
|
|
61
|
-
export declare function closeAccount(id:
|
|
62
|
-
export declare function reopenAccount(id:
|
|
63
|
-
export declare function deleteAccount(id:
|
|
64
|
-
export declare function getAccountBalance(id:
|
|
65
|
-
export declare function getCategoryGroups(): Promise<
|
|
66
|
-
export declare function createCategoryGroup(group:
|
|
67
|
-
export declare function updateCategoryGroup(id:
|
|
68
|
-
export declare function deleteCategoryGroup(id:
|
|
69
|
-
export declare function getCategories(): Promise<(
|
|
70
|
-
export declare function createCategory(category:
|
|
71
|
-
export declare function updateCategory(id:
|
|
72
|
-
|
|
73
|
-
|
|
59
|
+
export declare function deleteTransaction(id: TransactionEntity['id']): Promise<TransactionEntity[]>;
|
|
60
|
+
export declare function getAccounts(): Promise<APIAccountEntity[]>;
|
|
61
|
+
export declare function createAccount(account: Omit<APIAccountEntity, 'id'>, initialBalance?: number): Promise<string>;
|
|
62
|
+
export declare function updateAccount(id: APIAccountEntity['id'], fields: Partial<APIAccountEntity>): Promise<void>;
|
|
63
|
+
export declare function closeAccount(id: APIAccountEntity['id'], transferAccountId?: APIAccountEntity['id'], transferCategoryId?: APICategoryEntity['id']): Promise<void>;
|
|
64
|
+
export declare function reopenAccount(id: APIAccountEntity['id']): Promise<void>;
|
|
65
|
+
export declare function deleteAccount(id: APIAccountEntity['id']): Promise<void>;
|
|
66
|
+
export declare function getAccountBalance(id: APIAccountEntity['id'], cutoff?: Date): Promise<number>;
|
|
67
|
+
export declare function getCategoryGroups(): Promise<APICategoryGroupEntity[]>;
|
|
68
|
+
export declare function createCategoryGroup(group: Omit<APICategoryGroupEntity, 'id'>): Promise<string>;
|
|
69
|
+
export declare function updateCategoryGroup(id: APICategoryGroupEntity['id'], fields: Partial<APICategoryGroupEntity>): Promise<void>;
|
|
70
|
+
export declare function deleteCategoryGroup(id: APICategoryGroupEntity['id'], transferCategoryId?: APICategoryEntity['id']): Promise<void>;
|
|
71
|
+
export declare function getCategories(): Promise<(APICategoryEntity | APICategoryGroupEntity)[]>;
|
|
72
|
+
export declare function createCategory(category: Omit<APICategoryEntity, 'id'>): Promise<string>;
|
|
73
|
+
export declare function updateCategory(id: APICategoryEntity['id'], fields: Partial<APICategoryEntity>): Promise<object | {
|
|
74
|
+
error: {
|
|
75
|
+
type: "category-exists";
|
|
76
|
+
};
|
|
74
77
|
}>;
|
|
75
|
-
export declare function
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
export declare function
|
|
81
|
-
export declare function
|
|
82
|
-
export declare function
|
|
83
|
-
export declare function
|
|
84
|
-
export declare function
|
|
85
|
-
export declare function
|
|
86
|
-
export declare function
|
|
87
|
-
export declare function
|
|
88
|
-
export declare function
|
|
89
|
-
export declare function
|
|
90
|
-
export declare function
|
|
91
|
-
export declare function
|
|
92
|
-
export declare function
|
|
78
|
+
export declare function deleteCategory(id: APICategoryEntity['id'], transferCategoryId?: APICategoryEntity['id']): Promise<object | {
|
|
79
|
+
error: "no-categories";
|
|
80
|
+
} | {
|
|
81
|
+
error: "category-type";
|
|
82
|
+
}>;
|
|
83
|
+
export declare function getCommonPayees(): Promise<APIPayeeEntity[]>;
|
|
84
|
+
export declare function getPayees(): Promise<APIPayeeEntity[]>;
|
|
85
|
+
export declare function createPayee(payee: Omit<APIPayeeEntity, 'id'>): Promise<string>;
|
|
86
|
+
export declare function updatePayee(id: APIPayeeEntity['id'], fields: Partial<APIPayeeEntity>): Promise<void>;
|
|
87
|
+
export declare function deletePayee(id: APIPayeeEntity['id']): Promise<void>;
|
|
88
|
+
export declare function mergePayees(targetId: APIPayeeEntity['id'], mergeIds: APIPayeeEntity['id'][]): Promise<void>;
|
|
89
|
+
export declare function getRules(): Promise<RuleEntity[]>;
|
|
90
|
+
export declare function getPayeeRules(id: RuleEntity['id']): Promise<RuleEntity[]>;
|
|
91
|
+
export declare function createRule(rule: Omit<RuleEntity, 'id'>): Promise<RuleEntity>;
|
|
92
|
+
export declare function updateRule(rule: RuleEntity): Promise<RuleEntity>;
|
|
93
|
+
export declare function deleteRule(id: RuleEntity['id']): Promise<boolean>;
|
|
94
|
+
export declare function holdBudgetForNextMonth(month: string, amount: number): Promise<boolean>;
|
|
95
|
+
export declare function resetBudgetHold(month: string): Promise<void>;
|
|
96
|
+
export declare function createSchedule(schedule: Omit<APIScheduleEntity, 'id'>): Promise<string>;
|
|
97
|
+
export declare function updateSchedule(id: APIScheduleEntity['id'], fields: Partial<APIScheduleEntity>, resetNextDate?: boolean): Promise<string>;
|
|
98
|
+
export declare function deleteSchedule(scheduleId: APIScheduleEntity['id']): Promise<void>;
|
|
99
|
+
export declare function getSchedules(): Promise<APIScheduleEntity[]>;
|
|
100
|
+
export declare function getIDByName(type: 'accounts' | 'schedules' | 'categories' | 'payees', name: string): Promise<string>;
|
|
93
101
|
export declare function getServerVersion(): Promise<{
|
|
94
|
-
error
|
|
102
|
+
error: "no-server";
|
|
103
|
+
} | {
|
|
104
|
+
error: "network-failure";
|
|
95
105
|
} | {
|
|
96
106
|
version: string;
|
|
97
107
|
}>;
|
package/dist/app/bundle.api.js
CHANGED
|
@@ -12643,7 +12643,7 @@ proto.SyncResponse.prototype.setMerkle = function (value) {
|
|
|
12643
12643
|
};
|
|
12644
12644
|
goog.object.extend(exports, proto);
|
|
12645
12645
|
function emptyTrie() {
|
|
12646
|
-
return
|
|
12646
|
+
return { hash: 0 };
|
|
12647
12647
|
}
|
|
12648
12648
|
function isNumberTrieNodeKey(input) {
|
|
12649
12649
|
return ["0", "1", "2"].includes(input);
|
|
@@ -12651,22 +12651,6 @@ function isNumberTrieNodeKey(input) {
|
|
|
12651
12651
|
function getKeys(trie) {
|
|
12652
12652
|
return Object.keys(trie).filter(isNumberTrieNodeKey);
|
|
12653
12653
|
}
|
|
12654
|
-
function createTrieNode(props = {}) {
|
|
12655
|
-
const result = {};
|
|
12656
|
-
if (props["0"] !== void 0) {
|
|
12657
|
-
result["0"] = props["0"];
|
|
12658
|
-
}
|
|
12659
|
-
if (props["1"] !== void 0) {
|
|
12660
|
-
result["1"] = props["1"];
|
|
12661
|
-
}
|
|
12662
|
-
if (props["2"] !== void 0) {
|
|
12663
|
-
result["2"] = props["2"];
|
|
12664
|
-
}
|
|
12665
|
-
if (props.hash !== void 0) {
|
|
12666
|
-
result.hash = props.hash;
|
|
12667
|
-
}
|
|
12668
|
-
return result;
|
|
12669
|
-
}
|
|
12670
12654
|
function keyToTimestamp(key) {
|
|
12671
12655
|
const fullkey = key + "0".repeat(16 - key.length);
|
|
12672
12656
|
return parseInt(fullkey, 3) * 1e3 * 60;
|
|
@@ -12674,12 +12658,7 @@ function keyToTimestamp(key) {
|
|
|
12674
12658
|
function insert$1(trie, timestamp) {
|
|
12675
12659
|
const hash = timestamp.hash();
|
|
12676
12660
|
const key = Number(Math.floor(timestamp.millis() / 1e3 / 60)).toString(3);
|
|
12677
|
-
trie =
|
|
12678
|
-
"0": trie["0"],
|
|
12679
|
-
"1": trie["1"],
|
|
12680
|
-
"2": trie["2"],
|
|
12681
|
-
hash: (trie.hash || 0) ^ hash
|
|
12682
|
-
});
|
|
12661
|
+
trie = Object.assign({}, trie, { hash: (trie.hash || 0) ^ hash });
|
|
12683
12662
|
return insertKey(trie, key, hash);
|
|
12684
12663
|
}
|
|
12685
12664
|
function insertKey(trie, key, hash) {
|
|
@@ -12689,18 +12668,10 @@ function insertKey(trie, key, hash) {
|
|
|
12689
12668
|
const c = key[0];
|
|
12690
12669
|
const t2 = isNumberTrieNodeKey(c) ? trie[c] : void 0;
|
|
12691
12670
|
const n = t2 || {};
|
|
12692
|
-
|
|
12693
|
-
|
|
12694
|
-
|
|
12695
|
-
|
|
12696
|
-
"2": childWithInserted["2"],
|
|
12697
|
-
hash: (n.hash || 0) ^ hash
|
|
12698
|
-
});
|
|
12699
|
-
return createTrieNode({
|
|
12700
|
-
"0": c === "0" ? updatedChild : trie["0"],
|
|
12701
|
-
"1": c === "1" ? updatedChild : trie["1"],
|
|
12702
|
-
"2": c === "2" ? updatedChild : trie["2"],
|
|
12703
|
-
hash: trie.hash
|
|
12671
|
+
return Object.assign({}, trie, {
|
|
12672
|
+
[c]: Object.assign({}, n, insertKey(n, key.slice(1), hash), {
|
|
12673
|
+
hash: (n.hash || 0) ^ hash
|
|
12674
|
+
})
|
|
12704
12675
|
});
|
|
12705
12676
|
}
|
|
12706
12677
|
function diff(trie1, trie2) {
|
|
@@ -12742,20 +12713,15 @@ function prune(trie, n = 2) {
|
|
|
12742
12713
|
}
|
|
12743
12714
|
const keys2 = getKeys(trie);
|
|
12744
12715
|
keys2.sort();
|
|
12745
|
-
const
|
|
12716
|
+
const next = { hash: trie.hash };
|
|
12746
12717
|
for (const k of keys2.slice(-n)) {
|
|
12747
12718
|
const node2 = trie[k];
|
|
12748
12719
|
if (!node2) {
|
|
12749
12720
|
throw new Error(`TrieNode for key ${k} could not be found`);
|
|
12750
12721
|
}
|
|
12751
|
-
|
|
12722
|
+
next[k] = prune(node2, n);
|
|
12752
12723
|
}
|
|
12753
|
-
return
|
|
12754
|
-
"0": prunedChildren["0"],
|
|
12755
|
-
"1": prunedChildren["1"],
|
|
12756
|
-
"2": prunedChildren["2"],
|
|
12757
|
-
hash: trie.hash
|
|
12758
|
-
});
|
|
12724
|
+
return next;
|
|
12759
12725
|
}
|
|
12760
12726
|
var murmurhash$1 = { exports: {} };
|
|
12761
12727
|
var hasRequiredMurmurhash;
|
|
@@ -109340,7 +109306,7 @@ const categoryGroupModel = {
|
|
|
109340
109306
|
},
|
|
109341
109307
|
fromExternal(group) {
|
|
109342
109308
|
const result = { ...group };
|
|
109343
|
-
if ("categories" in group) {
|
|
109309
|
+
if ("categories" in group && group.categories) {
|
|
109344
109310
|
result.categories = group.categories.map(categoryModel.fromExternal);
|
|
109345
109311
|
}
|
|
109346
109312
|
return result;
|
|
@@ -109406,6 +109372,7 @@ const scheduleModel = {
|
|
|
109406
109372
|
},
|
|
109407
109373
|
//just an update
|
|
109408
109374
|
fromExternal(schedule) {
|
|
109375
|
+
const amount = schedule.amount ?? 0;
|
|
109409
109376
|
const result = {
|
|
109410
109377
|
id: schedule.id,
|
|
109411
109378
|
name: schedule.name,
|
|
@@ -109416,7 +109383,7 @@ const scheduleModel = {
|
|
|
109416
109383
|
tombstone: false,
|
|
109417
109384
|
_payee: String(schedule.payee),
|
|
109418
109385
|
_account: String(schedule.account),
|
|
109419
|
-
_amount:
|
|
109386
|
+
_amount: amount,
|
|
109420
109387
|
_amountOp: schedule.amountOp,
|
|
109421
109388
|
// e.g. 'isapprox', 'is', etc.
|
|
109422
109389
|
_date: schedule.date,
|
|
@@ -109424,7 +109391,7 @@ const scheduleModel = {
|
|
|
109424
109391
|
{ op: "is", field: "payee", value: String(schedule.payee) },
|
|
109425
109392
|
{ op: "is", field: "account", value: String(schedule.account) },
|
|
109426
109393
|
{ op: "isapprox", field: "date", value: schedule.date },
|
|
109427
|
-
{ op: schedule.amountOp, field: "amount", value:
|
|
109394
|
+
{ op: schedule.amountOp, field: "amount", value: amount }
|
|
109428
109395
|
],
|
|
109429
109396
|
_actions: []
|
|
109430
109397
|
// empty array, as you requested
|
|
@@ -109939,7 +109906,7 @@ handlers["api/schedules-get"] = async function () {
|
|
|
109939
109906
|
};
|
|
109940
109907
|
handlers["api/schedule-create"] = withMutation(async function (schedule) {
|
|
109941
109908
|
checkFileOpen();
|
|
109942
|
-
const internalSchedule = scheduleModel.fromExternal(schedule);
|
|
109909
|
+
const internalSchedule = scheduleModel.fromExternal({ ...schedule, id: "" });
|
|
109943
109910
|
const partialSchedule = {
|
|
109944
109911
|
name: internalSchedule.name,
|
|
109945
109912
|
posts_transaction: internalSchedule.posts_transaction
|
|
@@ -120578,7 +120545,6 @@ async function importPayees$1(data, entityIdMap) {
|
|
|
120578
120545
|
if (!payee.isTombstone) {
|
|
120579
120546
|
const id2 = await createPayee$1({
|
|
120580
120547
|
name: payee.name,
|
|
120581
|
-
category: entityIdMap.get(payee.autoFillCategoryId) || null,
|
|
120582
120548
|
transfer_acct: entityIdMap.get(payee.targetAccountId) || null
|
|
120583
120549
|
});
|
|
120584
120550
|
entityIdMap.set(payee.entityId, id2);
|
package/dist/methods.js
CHANGED
|
@@ -92,8 +92,8 @@ Object.defineProperty(exports, "q", { enumerable: true, get: function () { retur
|
|
|
92
92
|
function send(name, args) {
|
|
93
93
|
return injected.send(name, args);
|
|
94
94
|
}
|
|
95
|
-
async function runImport(
|
|
96
|
-
await send('api/start-import', { budgetName
|
|
95
|
+
async function runImport(budgetName, func) {
|
|
96
|
+
await send('api/start-import', { budgetName });
|
|
97
97
|
try {
|
|
98
98
|
await func();
|
|
99
99
|
}
|
|
@@ -149,7 +149,7 @@ function setBudgetAmount(month, categoryId, value) {
|
|
|
149
149
|
function setBudgetCarryover(month, categoryId, flag) {
|
|
150
150
|
return send('api/budget-set-carryover', { month, categoryId, flag });
|
|
151
151
|
}
|
|
152
|
-
function addTransactions(accountId, transactions, { learnCategories = false, runTransfers = false } = {}) {
|
|
152
|
+
function addTransactions(accountId, transactions, { learnCategories = false, runTransfers = false, } = {}) {
|
|
153
153
|
return send('api/transactions-add', {
|
|
154
154
|
accountId,
|
|
155
155
|
transactions,
|
package/dist/package.json
CHANGED