@actual-app/api 25.2.1 → 25.3.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/index.d.ts +0 -1
- package/@types/loot-core/client/state-types/modals.d.ts +8 -2
- package/@types/loot-core/client/state-types/notifications.d.ts +14 -12
- package/@types/loot-core/mocks/index.d.ts +1 -4
- package/@types/loot-core/platform/client/fetch/index.d.ts +15 -9
- package/@types/loot-core/platform/server/asyncStorage/index.d.ts +20 -6
- package/@types/loot-core/server/accounts/app.d.ts +149 -0
- package/@types/loot-core/server/accounts/payees.d.ts +3 -3
- package/@types/loot-core/server/accounts/sync.d.ts +19 -13
- package/@types/loot-core/server/aql/exec.d.ts +1 -1
- package/@types/loot-core/server/aql/schema/index.d.ts +6 -0
- package/@types/loot-core/server/budget/categoryTemplate.d.ts +3 -1
- package/@types/loot-core/server/budget/statements.d.ts +2 -2
- package/@types/loot-core/server/budget/types/templates.d.ts +2 -1
- package/@types/loot-core/server/db/index.d.ts +30 -24
- package/@types/loot-core/server/db/types/index.d.ts +259 -0
- package/@types/loot-core/server/errors.d.ts +11 -4
- package/@types/loot-core/server/importers/ynab5-types.d.ts +2 -0
- package/@types/loot-core/server/main-app.d.ts +1 -1
- package/@types/loot-core/server/main.d.ts +1 -0
- package/@types/loot-core/server/post.d.ts +1 -1
- package/@types/loot-core/server/preferences/app.d.ts +29 -2
- package/@types/loot-core/server/rules/types/handlers.d.ts +1 -1
- package/@types/loot-core/server/schedules/app.d.ts +1 -1
- package/@types/loot-core/server/transactions/app.d.ts +58 -0
- package/@types/loot-core/server/{accounts → transactions/import}/parse-file.d.ts +1 -1
- package/@types/loot-core/server/{accounts → transactions}/transaction-rules.d.ts +4 -3
- package/@types/loot-core/server/util/custom-sync-mapping.d.ts +4 -0
- package/@types/loot-core/shared/transactions.d.ts +4 -0
- package/@types/loot-core/shared/util.d.ts +3 -4
- package/@types/loot-core/types/api-handlers.d.ts +2 -1
- package/@types/loot-core/types/handlers.d.ts +6 -2
- package/@types/loot-core/types/models/account.d.ts +3 -0
- package/@types/loot-core/types/models/bank-sync.d.ts +2 -0
- package/@types/loot-core/types/models/bank.d.ts +6 -0
- package/@types/loot-core/types/models/gocardless.d.ts +8 -0
- package/@types/loot-core/types/models/simplefin.d.ts +8 -0
- package/@types/loot-core/types/models/transaction.d.ts +1 -0
- package/@types/loot-core/types/prefs.d.ts +26 -0
- package/@types/loot-core/types/server-handlers.d.ts +19 -169
- package/@types/methods.d.ts +12 -12
- package/dist/app/bundle.api.js +20819 -19585
- package/dist/index.js +1 -3
- package/dist/migrations/1739139550000_bank_sync_page.sql +7 -0
- package/dist/package.json +1 -1
- package/package.json +1 -1
- package/@types/loot-core/server/db/types.d.ts +0 -9
- package/@types/loot-core/server/preferences/types/handlers.d.ts +0 -10
- /package/@types/loot-core/server/{accounts/rules.d.ts → rules/index.d.ts} +0 -0
- /package/@types/loot-core/server/{accounts → transactions/export}/export-to-csv.d.ts +0 -0
- /package/@types/loot-core/server/{accounts → transactions/import}/ofx2json.d.ts +0 -0
- /package/@types/loot-core/server/{accounts → transactions/import}/qif2json.d.ts +0 -0
- /package/@types/loot-core/server/{accounts → transactions/import}/xmlcamt2json.d.ts +0 -0
- /package/@types/loot-core/server/{accounts/transactions.d.ts → transactions/index.d.ts} +0 -0
- /package/@types/loot-core/server/{accounts → transactions}/transfer.d.ts +0 -0
- /package/dist/migrations/{1736640000000__custom_report_sorting.sql → 1736640000000_custom_report_sorting.sql} +0 -0
- /package/dist/migrations/{1738491452000__sorting_rename.sql → 1738491452000_sorting_rename.sql} +0 -0
package/@types/index.d.ts
CHANGED
|
@@ -42,7 +42,7 @@ type FinanceModals = {
|
|
|
42
42
|
'select-linked-accounts': {
|
|
43
43
|
accounts: unknown[];
|
|
44
44
|
requisitionId?: string;
|
|
45
|
-
upgradingAccountId?: string;
|
|
45
|
+
upgradingAccountId?: string | undefined;
|
|
46
46
|
syncSource?: AccountSyncSource;
|
|
47
47
|
};
|
|
48
48
|
|
|
@@ -74,7 +74,7 @@ type FinanceModals = {
|
|
|
74
74
|
onMoveExternal: (arg: {
|
|
75
75
|
institutionId: string;
|
|
76
76
|
}) => Promise<{ error: string } | { data: unknown }>;
|
|
77
|
-
onClose?: () => void;
|
|
77
|
+
onClose?: (() => void) | undefined;
|
|
78
78
|
onSuccess: (data: GoCardlessToken) => Promise<void>;
|
|
79
79
|
};
|
|
80
80
|
|
|
@@ -186,6 +186,11 @@ type FinanceModals = {
|
|
|
186
186
|
'schedules-upcoming-length': null;
|
|
187
187
|
|
|
188
188
|
'schedule-posts-offline-notification': null;
|
|
189
|
+
|
|
190
|
+
'synced-account-edit': {
|
|
191
|
+
account: AccountEntity;
|
|
192
|
+
};
|
|
193
|
+
|
|
189
194
|
'account-menu': {
|
|
190
195
|
accountId: string;
|
|
191
196
|
onSave: (account: AccountEntity) => void;
|
|
@@ -342,6 +347,7 @@ type FinanceModals = {
|
|
|
342
347
|
};
|
|
343
348
|
'keyboard-shortcuts': EmptyObject;
|
|
344
349
|
'goal-templates': EmptyObject;
|
|
350
|
+
'category-automations-edit': EmptyObject;
|
|
345
351
|
};
|
|
346
352
|
|
|
347
353
|
export type PushModalAction = {
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import type * as constants from '../constants';
|
|
2
2
|
|
|
3
3
|
export type Notification = {
|
|
4
|
-
id?: string;
|
|
4
|
+
id?: string | undefined;
|
|
5
5
|
// 'warning' is unhandled??
|
|
6
6
|
type?: 'message' | 'error' | 'warning';
|
|
7
|
-
pre?: string;
|
|
8
|
-
title?: string;
|
|
7
|
+
pre?: string | undefined;
|
|
8
|
+
title?: string | undefined;
|
|
9
9
|
message: string;
|
|
10
|
-
sticky?: boolean;
|
|
11
|
-
timeout?: number;
|
|
12
|
-
button?:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
sticky?: boolean | undefined;
|
|
11
|
+
timeout?: number | undefined;
|
|
12
|
+
button?:
|
|
13
|
+
| {
|
|
14
|
+
title: string;
|
|
15
|
+
action: () => void | Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
| undefined;
|
|
18
|
+
messageActions?: Record<string, () => void> | undefined;
|
|
19
|
+
onClose?: (() => void) | undefined;
|
|
20
|
+
internal?: string | undefined;
|
|
19
21
|
};
|
|
20
22
|
type NotificationWithId = Notification & { id: string };
|
|
21
23
|
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import type { AccountEntity, CategoryEntity, CategoryGroupEntity, NewCategoryGroupEntity, TransactionEntity } from '../types/models';
|
|
2
|
-
export declare function generateAccount(name: AccountEntity['name'], isConnected?: boolean, offbudget?: boolean): AccountEntity
|
|
3
|
-
bankId: number | null;
|
|
4
|
-
bankName: string | null;
|
|
5
|
-
};
|
|
2
|
+
export declare function generateAccount(name: AccountEntity['name'], isConnected?: boolean, offbudget?: boolean): AccountEntity;
|
|
6
3
|
export declare function generateCategory(name: string, group: string, isIncome?: boolean): CategoryEntity;
|
|
7
4
|
export declare function generateCategoryGroup(name: string, isIncome?: boolean): CategoryGroupEntity;
|
|
8
5
|
export declare function generateCategoryGroups(definition: Partial<NewCategoryGroupEntity>[]): CategoryGroupEntity[];
|
|
@@ -7,25 +7,31 @@ export type Init = typeof init;
|
|
|
7
7
|
|
|
8
8
|
export function send<K extends keyof Handlers>(
|
|
9
9
|
name: K,
|
|
10
|
-
args
|
|
11
|
-
options
|
|
12
|
-
):
|
|
13
|
-
| { data: Handlers[K] }
|
|
14
|
-
| {
|
|
10
|
+
args: Parameters<Handlers[K]>[0],
|
|
11
|
+
options: { catchErrors: true },
|
|
12
|
+
): Promise<
|
|
13
|
+
| { data: Awaited<ReturnType<Handlers[K]>>; error: undefined }
|
|
14
|
+
| {
|
|
15
|
+
data: undefined;
|
|
16
|
+
error: { type: 'APIError' | 'InternalError'; message: string };
|
|
17
|
+
}
|
|
15
18
|
>;
|
|
16
19
|
export function send<K extends keyof Handlers>(
|
|
17
20
|
name: K,
|
|
18
21
|
args?: Parameters<Handlers[K]>[0],
|
|
19
22
|
options?: { catchErrors?: boolean },
|
|
20
|
-
): ReturnType<Handlers[K]
|
|
23
|
+
): Promise<Awaited<ReturnType<Handlers[K]>>>;
|
|
21
24
|
export type Send = typeof send;
|
|
22
25
|
|
|
23
26
|
export function sendCatch<K extends keyof Handlers>(
|
|
24
27
|
name: K,
|
|
25
28
|
args?: Parameters<Handlers[K]>[0],
|
|
26
|
-
):
|
|
27
|
-
| { data: Handlers[K] }
|
|
28
|
-
| {
|
|
29
|
+
): Promise<
|
|
30
|
+
| { data: Awaited<ReturnType<Handlers[K]>>; error: undefined }
|
|
31
|
+
| {
|
|
32
|
+
data: undefined;
|
|
33
|
+
error: { type: 'APIError' | 'InternalError'; message: string };
|
|
34
|
+
}
|
|
29
35
|
>;
|
|
30
36
|
export type SendCatch = typeof sendCatch;
|
|
31
37
|
|
|
@@ -1,20 +1,34 @@
|
|
|
1
|
+
import { GlobalPrefs, GlobalPrefsJson } from '../../../types/prefs';
|
|
2
|
+
|
|
1
3
|
export function init(opts?: { persist?: boolean }): void;
|
|
2
4
|
export type Init = typeof init;
|
|
3
5
|
|
|
4
|
-
|
|
6
|
+
type InferType<K extends keyof GlobalPrefsJson> = GlobalPrefs[K];
|
|
7
|
+
|
|
8
|
+
export function getItem<K extends keyof GlobalPrefsJson>(
|
|
9
|
+
key: K,
|
|
10
|
+
): Promise<GlobalPrefsJson[K]>;
|
|
5
11
|
export type GetItem = typeof getItem;
|
|
6
12
|
|
|
7
|
-
export function setItem
|
|
13
|
+
export function setItem<K extends keyof GlobalPrefsJson>(
|
|
14
|
+
key: K,
|
|
15
|
+
value: GlobalPrefsJson[K],
|
|
16
|
+
): void;
|
|
8
17
|
export type SetItem = typeof setItem;
|
|
9
18
|
|
|
10
|
-
export function removeItem(key:
|
|
19
|
+
export function removeItem(key: keyof GlobalPrefsJson): void;
|
|
11
20
|
export type RemoveItem = typeof removeItem;
|
|
12
21
|
|
|
13
|
-
export function multiGet(
|
|
22
|
+
export async function multiGet<K extends readonly (keyof GlobalPrefsJson)[]>(
|
|
23
|
+
keys: K,
|
|
24
|
+
): Promise<{ [P in keyof K]: [K[P], GlobalPrefsJson[K[P]]] }>;
|
|
14
25
|
export type MultiGet = typeof multiGet;
|
|
15
26
|
|
|
16
|
-
export function multiSet
|
|
27
|
+
export function multiSet<K extends keyof GlobalPrefsJson>(
|
|
28
|
+
keyValues: Array<[K, GlobalPrefsJson[K]]>,
|
|
29
|
+
): void;
|
|
30
|
+
|
|
17
31
|
export type MultiSet = typeof multiSet;
|
|
18
32
|
|
|
19
|
-
export function multiRemove(keys:
|
|
33
|
+
export function multiRemove(keys: (keyof GlobalPrefsJson)[]): void;
|
|
20
34
|
export type MultiRemove = typeof multiRemove;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { AccountEntity, CategoryEntity, SyncServerGoCardlessAccount, TransactionEntity, SyncServerSimpleFinAccount } from '../../types/models';
|
|
2
|
+
import * as bankSync from './sync';
|
|
3
|
+
export type AccountHandlers = {
|
|
4
|
+
'account-update': typeof updateAccount;
|
|
5
|
+
'accounts-get': typeof getAccounts;
|
|
6
|
+
'account-balance': typeof getAccountBalance;
|
|
7
|
+
'account-properties': typeof getAccountProperties;
|
|
8
|
+
'gocardless-accounts-link': typeof linkGoCardlessAccount;
|
|
9
|
+
'simplefin-accounts-link': typeof linkSimpleFinAccount;
|
|
10
|
+
'account-create': typeof createAccount;
|
|
11
|
+
'account-close': typeof closeAccount;
|
|
12
|
+
'account-reopen': typeof reopenAccount;
|
|
13
|
+
'account-move': typeof moveAccount;
|
|
14
|
+
'secret-set': typeof setSecret;
|
|
15
|
+
'secret-check': typeof checkSecret;
|
|
16
|
+
'gocardless-poll-web-token': typeof pollGoCardlessWebToken;
|
|
17
|
+
'gocardless-poll-web-token-stop': typeof stopGoCardlessWebTokenPolling;
|
|
18
|
+
'gocardless-status': typeof goCardlessStatus;
|
|
19
|
+
'simplefin-status': typeof simpleFinStatus;
|
|
20
|
+
'simplefin-accounts': typeof simpleFinAccounts;
|
|
21
|
+
'gocardless-get-banks': typeof getGoCardlessBanks;
|
|
22
|
+
'gocardless-create-web-token': typeof createGoCardlessWebToken;
|
|
23
|
+
'accounts-bank-sync': typeof accountsBankSync;
|
|
24
|
+
'simplefin-batch-sync': typeof simpleFinBatchSync;
|
|
25
|
+
'transactions-import': typeof importTransactions;
|
|
26
|
+
'account-unlink': typeof unlinkAccount;
|
|
27
|
+
};
|
|
28
|
+
declare function updateAccount({ id, name }: Pick<AccountEntity, 'id' | 'name'>): Promise<{}>;
|
|
29
|
+
declare function getAccounts(): Promise<any[]>;
|
|
30
|
+
declare function getAccountBalance({ id, cutoff, }: {
|
|
31
|
+
id: string;
|
|
32
|
+
cutoff: string | Date;
|
|
33
|
+
}): Promise<number>;
|
|
34
|
+
declare function getAccountProperties({ id }: {
|
|
35
|
+
id: AccountEntity['id'];
|
|
36
|
+
}): Promise<{
|
|
37
|
+
balance: number;
|
|
38
|
+
numTransactions: number;
|
|
39
|
+
}>;
|
|
40
|
+
declare function linkGoCardlessAccount({ requisitionId, account, upgradingId, offBudget, }: {
|
|
41
|
+
requisitionId: string;
|
|
42
|
+
account: SyncServerGoCardlessAccount;
|
|
43
|
+
upgradingId?: AccountEntity['id'] | undefined;
|
|
44
|
+
offBudget?: boolean | undefined;
|
|
45
|
+
}): Promise<string>;
|
|
46
|
+
declare function linkSimpleFinAccount({ externalAccount, upgradingId, offBudget, }: {
|
|
47
|
+
externalAccount: SyncServerSimpleFinAccount;
|
|
48
|
+
upgradingId?: AccountEntity['id'] | undefined;
|
|
49
|
+
offBudget?: boolean | undefined;
|
|
50
|
+
}): Promise<string>;
|
|
51
|
+
declare function createAccount({ name, balance, offBudget, closed, }: {
|
|
52
|
+
name: string;
|
|
53
|
+
balance?: number | undefined;
|
|
54
|
+
offBudget?: boolean | undefined;
|
|
55
|
+
closed?: boolean | undefined;
|
|
56
|
+
}): Promise<string>;
|
|
57
|
+
declare function closeAccount({ id, transferAccountId, categoryId, forced, }: {
|
|
58
|
+
id: AccountEntity['id'];
|
|
59
|
+
transferAccountId?: AccountEntity['id'] | undefined;
|
|
60
|
+
categoryId?: CategoryEntity['id'] | undefined;
|
|
61
|
+
forced?: boolean | undefined;
|
|
62
|
+
}): Promise<void>;
|
|
63
|
+
declare function reopenAccount({ id }: {
|
|
64
|
+
id: AccountEntity['id'];
|
|
65
|
+
}): Promise<void>;
|
|
66
|
+
declare function moveAccount({ id, targetId, }: {
|
|
67
|
+
id: AccountEntity['id'];
|
|
68
|
+
targetId: AccountEntity['id'];
|
|
69
|
+
}): Promise<void>;
|
|
70
|
+
declare function setSecret({ name, value, }: {
|
|
71
|
+
name: string;
|
|
72
|
+
value: string | null;
|
|
73
|
+
}): Promise<any>;
|
|
74
|
+
declare function checkSecret(name: string): Promise<string | {
|
|
75
|
+
error: string;
|
|
76
|
+
}>;
|
|
77
|
+
declare function pollGoCardlessWebToken({ requisitionId, }: {
|
|
78
|
+
requisitionId: string;
|
|
79
|
+
}): Promise<unknown>;
|
|
80
|
+
declare function stopGoCardlessWebTokenPolling(): Promise<string>;
|
|
81
|
+
declare function goCardlessStatus(): Promise<any>;
|
|
82
|
+
declare function simpleFinStatus(): Promise<any>;
|
|
83
|
+
declare function simpleFinAccounts(): Promise<any>;
|
|
84
|
+
declare function getGoCardlessBanks(country: string): Promise<any>;
|
|
85
|
+
declare function createGoCardlessWebToken({ institutionId, accessValidForDays, }: {
|
|
86
|
+
institutionId: string;
|
|
87
|
+
accessValidForDays: number;
|
|
88
|
+
}): Promise<any>;
|
|
89
|
+
type SyncResponse = {
|
|
90
|
+
newTransactions: Array<TransactionEntity['id']>;
|
|
91
|
+
matchedTransactions: Array<TransactionEntity['id']>;
|
|
92
|
+
updatedAccounts: Array<AccountEntity['id']>;
|
|
93
|
+
};
|
|
94
|
+
type SyncError = {
|
|
95
|
+
type: 'SyncError';
|
|
96
|
+
accountId: AccountEntity['id'];
|
|
97
|
+
message: string;
|
|
98
|
+
category: string;
|
|
99
|
+
code: string;
|
|
100
|
+
} | {
|
|
101
|
+
accountId: AccountEntity['id'];
|
|
102
|
+
message: string;
|
|
103
|
+
internal?: string;
|
|
104
|
+
};
|
|
105
|
+
export type SyncResponseWithErrors = SyncResponse & {
|
|
106
|
+
errors: SyncError[];
|
|
107
|
+
};
|
|
108
|
+
declare function accountsBankSync({ ids, }: {
|
|
109
|
+
ids: Array<AccountEntity['id']>;
|
|
110
|
+
}): Promise<SyncResponseWithErrors>;
|
|
111
|
+
declare function simpleFinBatchSync({ ids, }: {
|
|
112
|
+
ids: Array<AccountEntity['id']>;
|
|
113
|
+
}): Promise<Array<{
|
|
114
|
+
accountId: AccountEntity['id'];
|
|
115
|
+
res: SyncResponseWithErrors;
|
|
116
|
+
}>>;
|
|
117
|
+
type ImportTransactionsResult = bankSync.ReconcileTransactionsResult & {
|
|
118
|
+
errors: Array<{
|
|
119
|
+
message: string;
|
|
120
|
+
}>;
|
|
121
|
+
};
|
|
122
|
+
declare function importTransactions({ accountId, transactions, isPreview, opts, }: {
|
|
123
|
+
accountId: AccountEntity['id'];
|
|
124
|
+
transactions: TransactionEntity[];
|
|
125
|
+
isPreview: boolean;
|
|
126
|
+
opts?: {
|
|
127
|
+
defaultCleared: boolean;
|
|
128
|
+
};
|
|
129
|
+
}): Promise<ImportTransactionsResult>;
|
|
130
|
+
declare function unlinkAccount({ id }: {
|
|
131
|
+
id: AccountEntity['id'];
|
|
132
|
+
}): Promise<string>;
|
|
133
|
+
export declare const app: {
|
|
134
|
+
events: import("mitt").Emitter<{
|
|
135
|
+
sync: import("../../types/server-events").ServerEvents["sync-event"];
|
|
136
|
+
'load-budget': {
|
|
137
|
+
id: string;
|
|
138
|
+
};
|
|
139
|
+
}>;
|
|
140
|
+
handlers: AccountHandlers;
|
|
141
|
+
services: (() => () => void)[];
|
|
142
|
+
unlistenServices: (() => void)[];
|
|
143
|
+
method<Name extends "account-update" | "accounts-get" | "account-balance" | "account-properties" | "gocardless-accounts-link" | "simplefin-accounts-link" | "account-create" | "account-close" | "account-reopen" | "account-move" | "secret-set" | "secret-check" | "gocardless-poll-web-token" | "gocardless-poll-web-token-stop" | "gocardless-status" | "simplefin-status" | "simplefin-accounts" | "gocardless-get-banks" | "gocardless-create-web-token" | "accounts-bank-sync" | "simplefin-batch-sync" | "transactions-import" | "account-unlink">(name: Name, func: AccountHandlers[Name]): void;
|
|
144
|
+
service(func: () => () => void): void;
|
|
145
|
+
combine(...apps: any[]): void;
|
|
146
|
+
startServices(): void;
|
|
147
|
+
stopServices(): void;
|
|
148
|
+
};
|
|
149
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare function createPayee(description: any): Promise<
|
|
1
|
+
export declare function createPayee(description: any): Promise<string>;
|
|
2
2
|
export declare function getStartingBalancePayee(): Promise<{
|
|
3
|
-
id:
|
|
4
|
-
category:
|
|
3
|
+
id: string;
|
|
4
|
+
category: string;
|
|
5
5
|
}>;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import { AccountEntity } from '../../types/models';
|
|
1
|
+
import { AccountEntity, TransactionEntity } from '../../types/models';
|
|
2
2
|
export declare function getGoCardlessAccounts(userId: any, userKey: any, id: any): Promise<any>;
|
|
3
|
-
export
|
|
4
|
-
added:
|
|
5
|
-
updated:
|
|
6
|
-
updatedPreview:
|
|
7
|
-
|
|
3
|
+
export type ReconcileTransactionsResult = {
|
|
4
|
+
added: string[];
|
|
5
|
+
updated: string[];
|
|
6
|
+
updatedPreview: Array<{
|
|
7
|
+
transaction: TransactionEntity;
|
|
8
|
+
existing?: TransactionEntity;
|
|
9
|
+
ignored?: boolean;
|
|
10
|
+
}>;
|
|
11
|
+
};
|
|
12
|
+
export declare function reconcileTransactions(acctId: any, transactions: any, isBankSyncAccount?: boolean, strictIdChecking?: boolean, isPreview?: boolean, defaultCleared?: boolean): Promise<ReconcileTransactionsResult>;
|
|
8
13
|
export declare function matchTransactions(acctId: any, transactions: any, isBankSyncAccount?: boolean, strictIdChecking?: boolean): Promise<{
|
|
9
14
|
payeesToCreate: Map<any, any>;
|
|
10
15
|
transactionsStep1: any[];
|
|
@@ -15,15 +20,16 @@ export declare function addTransactions(acctId: any, transactions: any, { runTra
|
|
|
15
20
|
runTransfers?: boolean;
|
|
16
21
|
learnCategories?: boolean;
|
|
17
22
|
}): Promise<any>;
|
|
18
|
-
export declare function syncAccount(userId: string, userKey: string, id: string, acctId: string, bankId: string): Promise<{
|
|
23
|
+
export declare function syncAccount(userId: string | undefined, userKey: string | undefined, id: string, acctId: string, bankId: string): Promise<{
|
|
19
24
|
added: any[];
|
|
20
|
-
updated:
|
|
21
|
-
updatedPreview:
|
|
25
|
+
updated: string[];
|
|
26
|
+
updatedPreview: Array<{
|
|
27
|
+
transaction: TransactionEntity;
|
|
28
|
+
existing?: TransactionEntity;
|
|
29
|
+
ignored?: boolean;
|
|
30
|
+
}>;
|
|
22
31
|
} | {
|
|
23
32
|
added: any[];
|
|
24
33
|
updated: any[];
|
|
25
34
|
}>;
|
|
26
|
-
export declare function
|
|
27
|
-
id: AccountEntity['id'];
|
|
28
|
-
accountId: AccountEntity['account_id'];
|
|
29
|
-
}[]): Promise<any[]>;
|
|
35
|
+
export declare function simpleFinBatchSync(accounts: Array<Pick<AccountEntity, 'id' | 'account_id'>>): Promise<any[]>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function execQuery(queryState: any, state: any, sqlPieces: any, params: any, outputTypes: any): Promise<any>;
|
|
1
|
+
export declare function execQuery(queryState: any, state: any, sqlPieces: any, params: any, outputTypes: any): Promise<any[]>;
|
|
2
2
|
export declare function runCompiledQuery(query: any, pieces: any, state: any, { params, executors }?: {
|
|
3
3
|
params?: {};
|
|
4
4
|
executors?: {};
|
|
@@ -61,6 +61,9 @@ export declare const schema: {
|
|
|
61
61
|
schedule: {
|
|
62
62
|
type: string;
|
|
63
63
|
};
|
|
64
|
+
raw_synced_data: {
|
|
65
|
+
type: string;
|
|
66
|
+
};
|
|
64
67
|
};
|
|
65
68
|
payees: {
|
|
66
69
|
id: {
|
|
@@ -107,6 +110,9 @@ export declare const schema: {
|
|
|
107
110
|
account_sync_source: {
|
|
108
111
|
type: string;
|
|
109
112
|
};
|
|
113
|
+
last_sync: {
|
|
114
|
+
type: string;
|
|
115
|
+
};
|
|
110
116
|
};
|
|
111
117
|
categories: {
|
|
112
118
|
id: {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { CategoryEntity } from '../../types/models';
|
|
2
2
|
import { Template } from './types/templates';
|
|
3
3
|
export declare class CategoryTemplate {
|
|
4
|
-
static init(templates: Template[], category: CategoryEntity, month: any): Promise<CategoryTemplate>;
|
|
4
|
+
static init(templates: Template[], category: CategoryEntity, month: any, budgeted: number): Promise<CategoryTemplate>;
|
|
5
|
+
getGoalOnly(): boolean;
|
|
5
6
|
getPriorities(): number[];
|
|
6
7
|
getRemainderWeight(): number;
|
|
7
8
|
getLimitExcess(): number;
|
|
@@ -30,6 +31,7 @@ export declare class CategoryTemplate {
|
|
|
30
31
|
private limitAmount;
|
|
31
32
|
private limitCheck;
|
|
32
33
|
private limitHold;
|
|
34
|
+
readonly previouslyBudgeted: number;
|
|
33
35
|
private constructor();
|
|
34
36
|
private runGoal;
|
|
35
37
|
static checkByAndScheduleAndSpend(templates: any, month: any): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DbSchedule } from '../db';
|
|
2
2
|
export declare function resetCategoryGoalDefsWithNoTemplates(): Promise<void>;
|
|
3
3
|
export type CategoryWithTemplateNote = {
|
|
4
4
|
id: string;
|
|
@@ -6,4 +6,4 @@ export type CategoryWithTemplateNote = {
|
|
|
6
6
|
note: string;
|
|
7
7
|
};
|
|
8
8
|
export declare function getCategoriesWithTemplateNotes(): Promise<CategoryWithTemplateNote[]>;
|
|
9
|
-
export declare function getActiveSchedules(): Promise<
|
|
9
|
+
export declare function getActiveSchedules(): Promise<DbSchedule[]>;
|
|
@@ -45,6 +45,7 @@ interface ScheduleTemplate extends BaseTemplate {
|
|
|
45
45
|
type: 'schedule';
|
|
46
46
|
name: string;
|
|
47
47
|
full?: boolean;
|
|
48
|
+
adjustment?: number;
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
interface RemainderTemplate extends BaseTemplate {
|
|
@@ -59,7 +60,7 @@ interface AverageTemplate extends BaseTemplate {
|
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
interface GoalTemplate extends BaseTemplate {
|
|
62
|
-
type: '
|
|
63
|
+
type: 'goal';
|
|
63
64
|
amount: number;
|
|
64
65
|
}
|
|
65
66
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Database } from '@jlongster/sql.js';
|
|
2
2
|
import { CategoryEntity, CategoryGroupEntity } from '../../types/models';
|
|
3
|
+
import { DbAccount, DbCategory, DbCategoryGroup, DbPayee, DbTransaction, DbViewTransaction } from './types';
|
|
4
|
+
export * from './types';
|
|
3
5
|
export { toDateRepr, fromDateRepr } from '../models';
|
|
4
6
|
export declare function getDatabasePath(): string;
|
|
5
7
|
export declare function openDatabase(id?: string): Promise<void>;
|
|
@@ -47,28 +49,32 @@ export declare function getDatabase(): {
|
|
|
47
49
|
run(sql: string, params?: import("@jlongster/sql.js").BindParams): any;
|
|
48
50
|
};
|
|
49
51
|
export declare function loadClock(): Promise<void>;
|
|
50
|
-
export declare function runQuery(sql: string, params?: Array<string | number>, fetchAll?: false):
|
|
51
|
-
|
|
52
|
+
export declare function runQuery(sql: string, params?: Array<string | number>, fetchAll?: false): {
|
|
53
|
+
changes: unknown;
|
|
54
|
+
};
|
|
55
|
+
export declare function runQuery<T>(sql: string, params: Array<string | number> | undefined, fetchAll: true): T[];
|
|
52
56
|
export declare function execQuery(sql: string): void;
|
|
53
|
-
export declare function cache(sql: string):
|
|
57
|
+
export declare function cache(sql: string): string;
|
|
54
58
|
export declare function transaction(fn: () => void): void;
|
|
55
59
|
export declare function asyncTransaction(fn: () => Promise<void>): Promise<void>;
|
|
56
|
-
export declare function all(sql: any, params?: (string | number)[]): Promise<any>;
|
|
60
|
+
export declare function all(sql: any, params?: (string | number)[]): Promise<any[]>;
|
|
57
61
|
export declare function first(sql: any, params?: (string | number)[]): Promise<any>;
|
|
58
62
|
export declare function firstSync(sql: any, params?: (string | number)[]): any;
|
|
59
|
-
export declare function run(sql: any, params?: (string | number)[]): Promise<
|
|
63
|
+
export declare function run(sql: any, params?: (string | number)[]): Promise<{
|
|
64
|
+
changes: unknown;
|
|
65
|
+
}>;
|
|
60
66
|
export declare function select(table: any, id: any): Promise<any>;
|
|
61
67
|
export declare function update(table: any, params: any): Promise<void>;
|
|
62
68
|
export declare function insertWithUUID(table: any, row: any): Promise<any>;
|
|
63
69
|
export declare function insert(table: any, row: any): Promise<void>;
|
|
64
70
|
export declare function delete_(table: any, id: any): Promise<void>;
|
|
65
71
|
export declare function deleteAll(table: string): Promise<void>;
|
|
66
|
-
export declare function selectWithSchema(table: any, sql: any, params: any): Promise<any>;
|
|
72
|
+
export declare function selectWithSchema(table: any, sql: any, params: any): Promise<any[]>;
|
|
67
73
|
export declare function selectFirstWithSchema(table: any, sql: any, params: any): Promise<any>;
|
|
68
74
|
export declare function insertWithSchema(table: any, row: any): Promise<any>;
|
|
69
75
|
export declare function updateWithSchema(table: any, fields: any): Promise<void>;
|
|
70
|
-
export declare function getCategories(ids?: Array<
|
|
71
|
-
export declare function getCategoriesGrouped(ids?: Array<
|
|
76
|
+
export declare function getCategories(ids?: Array<DbCategory['id']>): Promise<CategoryEntity[]>;
|
|
77
|
+
export declare function getCategoriesGrouped(ids?: Array<DbCategoryGroup['id']>): Promise<Array<CategoryGroupEntity>>;
|
|
72
78
|
export declare function insertCategoryGroup(group: any): Promise<any>;
|
|
73
79
|
export declare function updateCategoryGroup(group: any): Promise<void>;
|
|
74
80
|
export declare function moveCategoryGroup(id: any, targetId: any): Promise<void>;
|
|
@@ -77,27 +83,27 @@ export declare function insertCategory(category: any, { atEnd }?: {
|
|
|
77
83
|
atEnd: any;
|
|
78
84
|
}): Promise<any>;
|
|
79
85
|
export declare function updateCategory(category: any): Promise<void>;
|
|
80
|
-
export declare function moveCategory(id:
|
|
81
|
-
export declare function deleteCategory(category:
|
|
82
|
-
export declare function getPayee(id:
|
|
83
|
-
export declare function getAccount(id:
|
|
86
|
+
export declare function moveCategory(id: DbCategory['id'], groupId: DbCategoryGroup['id'], targetId?: DbCategory['id']): Promise<void>;
|
|
87
|
+
export declare function deleteCategory(category: Pick<DbCategory, 'id'>, transferId?: DbCategory['id']): Promise<void>;
|
|
88
|
+
export declare function getPayee(id: DbPayee['id']): Promise<any>;
|
|
89
|
+
export declare function getAccount(id: DbAccount['id']): Promise<any>;
|
|
84
90
|
export declare function insertPayee(payee: any): Promise<any>;
|
|
85
|
-
export declare function deletePayee(payee:
|
|
86
|
-
export declare function deleteTransferPayee(payee:
|
|
91
|
+
export declare function deletePayee(payee: Pick<DbPayee, 'id'>): Promise<void>;
|
|
92
|
+
export declare function deleteTransferPayee(payee: Pick<DbPayee, 'id'>): Promise<void>;
|
|
87
93
|
export declare function updatePayee(payee: any): Promise<void>;
|
|
88
|
-
export declare function mergePayees(target:
|
|
89
|
-
export declare function getPayees(): Promise<any>;
|
|
90
|
-
export declare function getCommonPayees(): Promise<any>;
|
|
91
|
-
export declare function syncGetOrphanedPayees(): Promise<any>;
|
|
92
|
-
export declare function getOrphanedPayees(): Promise<any>;
|
|
93
|
-
export declare function getPayeeByName(name:
|
|
94
|
-
export declare function getAccounts(): Promise<any>;
|
|
94
|
+
export declare function mergePayees(target: DbPayee['id'], ids: Array<DbPayee['id']>): Promise<void>;
|
|
95
|
+
export declare function getPayees(): Promise<any[]>;
|
|
96
|
+
export declare function getCommonPayees(): Promise<any[]>;
|
|
97
|
+
export declare function syncGetOrphanedPayees(): Promise<any[]>;
|
|
98
|
+
export declare function getOrphanedPayees(): Promise<any[]>;
|
|
99
|
+
export declare function getPayeeByName(name: DbPayee['name']): Promise<any>;
|
|
100
|
+
export declare function getAccounts(): Promise<any[]>;
|
|
95
101
|
export declare function insertAccount(account: any): Promise<any>;
|
|
96
102
|
export declare function updateAccount(account: any): Promise<void>;
|
|
97
103
|
export declare function deleteAccount(account: any): Promise<void>;
|
|
98
|
-
export declare function moveAccount(id:
|
|
99
|
-
export declare function getTransaction(id:
|
|
100
|
-
export declare function getTransactions(accountId:
|
|
104
|
+
export declare function moveAccount(id: DbAccount['id'], targetId: DbAccount['id']): Promise<void>;
|
|
105
|
+
export declare function getTransaction(id: DbViewTransaction['id']): Promise<any>;
|
|
106
|
+
export declare function getTransactions(accountId: DbTransaction['acct']): Promise<any[]>;
|
|
101
107
|
export declare function insertTransaction(transaction: any): Promise<any>;
|
|
102
108
|
export declare function updateTransaction(transaction: any): Promise<void>;
|
|
103
109
|
export declare function deleteTransaction(transaction: any): Promise<void>;
|