@actual-app/api 6.8.1 → 6.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/@types/loot-core/client/constants.d.ts +1 -0
  2. package/@types/loot-core/client/state-types/modals.d.ts +14 -4
  3. package/@types/loot-core/client/state-types/queries.d.ts +8 -0
  4. package/@types/loot-core/platform/server/sqlite/index.d.ts +3 -3
  5. package/@types/loot-core/server/accounts/sync.d.ts +12 -1
  6. package/@types/loot-core/server/accounts/transactions.d.ts +4 -16
  7. package/@types/loot-core/server/api-models.d.ts +15 -0
  8. package/@types/loot-core/server/aql/schema/index.d.ts +18 -0
  9. package/@types/loot-core/server/budget/actions.d.ts +6 -1
  10. package/@types/loot-core/server/budget/app.d.ts +1 -1
  11. package/@types/loot-core/server/budget/types/handlers.d.ts +5 -0
  12. package/@types/loot-core/server/db/index.d.ts +48 -7
  13. package/@types/loot-core/server/main-app.d.ts +1 -1
  14. package/@types/loot-core/server/migrate/migrations.d.ts +1 -1
  15. package/@types/loot-core/server/post.d.ts +1 -1
  16. package/@types/loot-core/shared/normalisation.d.ts +1 -0
  17. package/@types/loot-core/shared/rules.d.ts +1 -1
  18. package/@types/loot-core/shared/transactions.d.ts +27 -2
  19. package/@types/loot-core/shared/util.d.ts +1 -1
  20. package/@types/loot-core/types/api-handlers.d.ts +15 -0
  21. package/@types/loot-core/types/file.d.ts +2 -0
  22. package/@types/loot-core/types/models/payee.d.ts +1 -0
  23. package/@types/loot-core/types/models/reports.d.ts +26 -0
  24. package/@types/loot-core/types/models/rule.d.ts +2 -1
  25. package/@types/loot-core/types/prefs.d.ts +8 -6
  26. package/@types/loot-core/types/server-handlers.d.ts +9 -2
  27. package/@types/methods.d.ts +4 -0
  28. package/dist/app/bundle.api.js +1156 -613
  29. package/dist/methods.js +17 -1
  30. package/dist/methods.test.js +15 -1
  31. package/dist/migrations/1716359441000_include_current.sql +5 -0
  32. package/dist/migrations/1720310586000_link_transfer_schedules.sql +19 -0
  33. package/dist/migrations/1720664867241_add_payee_favorite.sql +5 -0
  34. package/dist/migrations/1720665000000_goal_context.sql +6 -0
  35. package/dist/package.json +1 -1
  36. package/package.json +1 -1
@@ -5,6 +5,7 @@ export declare const MARK_ACCOUNT_READ = "MARK_ACCOUNT_READ";
5
5
  export declare const LOAD_ACCOUNTS = "LOAD_ACCOUNTS";
6
6
  export declare const UPDATE_ACCOUNT = "UPDATE_ACCOUNT";
7
7
  export declare const LOAD_CATEGORIES = "LOAD_CATEGORIES";
8
+ export declare const LOAD_COMMON_PAYEES = "LOAD_COMMON_PAYEES";
8
9
  export declare const LOAD_PAYEES = "LOAD_PAYEES";
9
10
  export declare const SET_PREFS = "SET_PREFS";
10
11
  export declare const MERGE_LOCAL_PREFS = "MERGE_LOCAL_PREFS";
@@ -4,6 +4,7 @@ import type {
4
4
  CategoryEntity,
5
5
  CategoryGroupEntity,
6
6
  GoCardlessToken,
7
+ TransactionEntity,
7
8
  } from '../../types/models';
8
9
  import type { NewRuleEntity, RuleEntity } from '../../types/models/rule';
9
10
  import type { EmptyObject, StripNever } from '../../types/util';
@@ -121,14 +122,13 @@ type FinanceModals = {
121
122
  month: string;
122
123
  };
123
124
 
124
- 'schedule-edit': { id: string } | null;
125
+ 'schedule-edit': { id: string; transaction?: TransactionEntity } | null;
125
126
 
126
127
  'schedule-link': { transactionIds: string[] } | null;
127
128
 
128
129
  'schedules-discover': null;
129
130
 
130
131
  'schedule-posts-offline-notification': null;
131
- 'switch-budget-type': { onSwitch: () => void };
132
132
  'account-menu': {
133
133
  accountId: string;
134
134
  onSave: (account: AccountEntity) => void;
@@ -142,6 +142,7 @@ type FinanceModals = {
142
142
  onSave: (category: CategoryEntity) => void;
143
143
  onEditNotes: (id: string) => void;
144
144
  onDelete: (categoryId: string) => void;
145
+ onToggleVisibility: (categoryId: string) => void;
145
146
  onBudgetAction: (month: string, action: string, args?: unknown) => void;
146
147
  onClose?: () => void;
147
148
  };
@@ -167,6 +168,7 @@ type FinanceModals = {
167
168
  onAddCategory: (groupId: string, isIncome: boolean) => void;
168
169
  onEditNotes: (id: string) => void;
169
170
  onDelete: (groupId: string) => void;
171
+ onToggleVisibility: (groupId: string) => void;
170
172
  onClose?: () => void;
171
173
  };
172
174
  notes: {
@@ -201,6 +203,7 @@ type FinanceModals = {
201
203
  'rollover-summary-to-budget-menu': {
202
204
  month: string;
203
205
  onTransfer: () => void;
206
+ onCover: () => void;
204
207
  onHoldBuffer: () => void;
205
208
  onResetHoldBuffer: () => void;
206
209
  };
@@ -217,8 +220,9 @@ type FinanceModals = {
217
220
  showToBeBudgeted?: boolean;
218
221
  };
219
222
  cover: {
220
- categoryId: string;
223
+ title: string;
221
224
  month: string;
225
+ showToBeBudgeted?: boolean;
222
226
  onSubmit: (fromCategoryId: string) => void;
223
227
  };
224
228
  'hold-buffer': {
@@ -234,7 +238,6 @@ type FinanceModals = {
234
238
  onAddCategoryGroup: () => void;
235
239
  onToggleHiddenCategories: () => void;
236
240
  onSwitchBudgetFile: () => void;
237
- onSwitchBudgetType: () => void;
238
241
  };
239
242
  'rollover-budget-month-menu': {
240
243
  month: string;
@@ -249,6 +252,7 @@ type FinanceModals = {
249
252
  'budget-list';
250
253
  'confirm-transaction-edit': {
251
254
  onConfirm: () => void;
255
+ onCancel?: () => void;
252
256
  confirmReason: string;
253
257
  };
254
258
  'confirm-transaction-delete': {
@@ -290,3 +294,9 @@ export type ModalsState = {
290
294
  modalStack: Modal[];
291
295
  isHidden: boolean;
292
296
  };
297
+
298
+ type Modal = {
299
+ name: string;
300
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
301
+ options?: any;
302
+ };
@@ -11,6 +11,8 @@ export type QueriesState = {
11
11
  accountsLoaded: boolean;
12
12
  categories: Awaited<ReturnType<Handlers['get-categories']>>;
13
13
  categoriesLoaded: boolean;
14
+ commonPayeesLoaded: boolean;
15
+ commonPayees: Awaited<ReturnType<Handlers['common-payees-get']>>;
14
16
  payees: Awaited<ReturnType<Handlers['payees-get']>>;
15
17
  payeesLoaded: boolean;
16
18
  earliestTransaction: unknown | null;
@@ -58,6 +60,11 @@ type LoadPayeesAction = {
58
60
  payees: State['payees'];
59
61
  };
60
62
 
63
+ type LoadCommonPayeesAction = {
64
+ type: typeof constants.LOAD_COMMON_PAYEES;
65
+ payees: State['common_payees'];
66
+ };
67
+
61
68
  export type QueriesActions =
62
69
  | SetNewTransactionsAction
63
70
  | UpdateNewTransactionsAction
@@ -66,4 +73,5 @@ export type QueriesActions =
66
73
  | LoadAccountsAction
67
74
  | UpdateAccountAction
68
75
  | LoadCategoriesAction
76
+ | LoadCommonPayeesAction
69
77
  | LoadPayeesAction;
@@ -1,10 +1,10 @@
1
- import { type Database } from 'better-sqlite3';
1
+ import { type Database } from '@jlongster/sql.js';
2
2
 
3
- export async function init(): unknown;
3
+ export async function init(): Promise<void>;
4
4
 
5
5
  export function _getModule(): SqlJsStatic;
6
6
 
7
- export function prepare(db, sql): unknown;
7
+ export function prepare(db: Database, sql: string): string;
8
8
 
9
9
  export function runQuery(
10
10
  db: Database,
@@ -1,7 +1,14 @@
1
1
  export declare function getGoCardlessAccounts(userId: any, userKey: any, id: any): Promise<any>;
2
- export declare function reconcileTransactions(acctId: any, transactions: any, isBankSyncAccount?: boolean): Promise<{
2
+ export declare function reconcileTransactions(acctId: any, transactions: any, isBankSyncAccount?: boolean, isPreview?: boolean): Promise<{
3
3
  added: any[];
4
4
  updated: any[];
5
+ updatedPreview: any[];
6
+ }>;
7
+ export declare function matchTransactions(acctId: any, transactions: any, isBankSyncAccount?: boolean): Promise<{
8
+ payeesToCreate: Map<any, any>;
9
+ transactionsStep1: any[];
10
+ transactionsStep2: any[];
11
+ transactionsStep3: any[];
5
12
  }>;
6
13
  export declare function addTransactions(acctId: any, transactions: any, { runTransfers, learnCategories }?: {
7
14
  runTransfers?: boolean;
@@ -10,4 +17,8 @@ export declare function addTransactions(acctId: any, transactions: any, { runTra
10
17
  export declare function syncAccount(userId: string, userKey: string, id: string, acctId: string, bankId: string): Promise<{
11
18
  added: any[];
12
19
  updated: any[];
20
+ updatedPreview: any[];
21
+ } | {
22
+ added: any[];
23
+ updated: any[];
13
24
  }>;
@@ -1,20 +1,8 @@
1
- import { TransactionEntity } from '../../types/models';
1
+ import { NewTransactionEntity, TransactionEntity } from '../../types/models';
2
2
  export declare function batchUpdateTransactions({ added, deleted, updated, learnCategories, detectOrphanPayees, runTransfers, }: {
3
- added?: Array<{
4
- id: string;
5
- payee: unknown;
6
- category: unknown;
7
- }>;
8
- deleted?: Array<{
9
- id: string;
10
- payee: unknown;
11
- }>;
12
- updated?: Array<{
13
- id: string;
14
- payee?: unknown;
15
- account?: unknown;
16
- category?: unknown;
17
- }>;
3
+ added?: Array<Partial<NewTransactionEntity | TransactionEntity>>;
4
+ deleted?: Array<Partial<NewTransactionEntity | TransactionEntity>>;
5
+ updated?: Array<Partial<NewTransactionEntity | TransactionEntity>>;
18
6
  learnCategories?: boolean;
19
7
  detectOrphanPayees?: boolean;
20
8
  runTransfers?: boolean;
@@ -1,4 +1,6 @@
1
+ import { Budget } from '../types/budget';
1
2
  import type { AccountEntity, CategoryEntity, CategoryGroupEntity, PayeeEntity } from '../types/models';
3
+ import { RemoteFile } from './cloud-storage';
2
4
  export type APIAccountEntity = Pick<AccountEntity, 'id' | 'name'> & {
3
5
  offbudget: boolean;
4
6
  closed: boolean;
@@ -64,3 +66,16 @@ export declare const payeeModel: {
64
66
  update?: boolean;
65
67
  }): PayeeEntity;
66
68
  };
69
+ export type APIFileEntity = Omit<RemoteFile, 'deleted' | 'fileId'> & {
70
+ id?: string;
71
+ cloudFileId: string;
72
+ state?: 'remote';
73
+ };
74
+ export declare const remoteFileModel: {
75
+ toExternal(file: RemoteFile): APIFileEntity | null;
76
+ fromExternal(file: APIFileEntity): RemoteFile;
77
+ };
78
+ export declare const budgetModel: {
79
+ toExternal(file: Budget): APIFileEntity;
80
+ fromExternal(file: APIFileEntity): Budget;
81
+ };
@@ -75,6 +75,9 @@ export declare const schema: {
75
75
  tombstone: {
76
76
  type: string;
77
77
  };
78
+ favorite: {
79
+ type: string;
80
+ };
78
81
  };
79
82
  accounts: {
80
83
  id: {
@@ -95,6 +98,12 @@ export declare const schema: {
95
98
  tombstone: {
96
99
  type: string;
97
100
  };
101
+ account_id: {
102
+ type: string;
103
+ };
104
+ official_name: {
105
+ type: string;
106
+ };
98
107
  account_sync_source: {
99
108
  type: string;
100
109
  };
@@ -271,6 +280,9 @@ export declare const schema: {
271
280
  show_uncategorized: {
272
281
  type: string;
273
282
  };
283
+ include_current: {
284
+ type: string;
285
+ };
274
286
  selected_categories: {
275
287
  type: string;
276
288
  };
@@ -315,6 +327,9 @@ export declare const schema: {
315
327
  goal: {
316
328
  type: string;
317
329
  };
330
+ long_goal: {
331
+ type: string;
332
+ };
318
333
  };
319
334
  zero_budgets: {
320
335
  id: {
@@ -335,6 +350,9 @@ export declare const schema: {
335
350
  goal: {
336
351
  type: string;
337
352
  };
353
+ long_goal: {
354
+ type: string;
355
+ };
338
356
  };
339
357
  };
340
358
  export declare const schemaConfig: SchemaConfig;
@@ -9,10 +9,11 @@ export declare function setBudget({ category, month, amount, }: {
9
9
  month: string;
10
10
  amount: unknown;
11
11
  }): Promise<void>;
12
- export declare function setGoal({ month, category, goal }: {
12
+ export declare function setGoal({ month, category, goal, long_goal }: {
13
13
  month: any;
14
14
  category: any;
15
15
  goal: any;
16
+ long_goal: any;
16
17
  }): Promise<void>;
17
18
  export declare function setBuffer(month: string, amount: unknown): Promise<void>;
18
19
  export declare function copyPreviousMonth({ month, }: {
@@ -50,6 +51,10 @@ export declare function transferAvailable({ month, amount, category, }: {
50
51
  amount: number;
51
52
  category: string;
52
53
  }): Promise<void>;
54
+ export declare function coverOverbudgeted({ month, category, }: {
55
+ month: string;
56
+ category: string;
57
+ }): Promise<void>;
53
58
  export declare function transferCategory({ month, amount, from, to, }: {
54
59
  month: string;
55
60
  amount: number;
@@ -4,7 +4,7 @@ export declare const app: {
4
4
  handlers: BudgetHandlers;
5
5
  services: any;
6
6
  unlistenServices: any;
7
- method<Name extends "budget/budget-amount" | "budget/copy-previous-month" | "budget/set-zero" | "budget/set-3month-avg" | "budget/check-templates" | "budget/apply-goal-template" | "budget/overwrite-goal-template" | "budget/cleanup-goal-template" | "budget/hold-for-next-month" | "budget/reset-hold" | "budget/cover-overspending" | "budget/transfer-available" | "budget/transfer-category" | "budget/set-carryover" | "budget/apply-single-template" | "budget/set-n-month-avg" | "budget/copy-single-month">(name: Name, func: BudgetHandlers[Name]): void;
7
+ method<Name extends "budget/budget-amount" | "budget/copy-previous-month" | "budget/set-zero" | "budget/set-3month-avg" | "budget/check-templates" | "budget/apply-goal-template" | "budget/overwrite-goal-template" | "budget/cleanup-goal-template" | "budget/hold-for-next-month" | "budget/reset-hold" | "budget/cover-overspending" | "budget/transfer-available" | "budget/cover-overbudgeted" | "budget/transfer-category" | "budget/set-carryover" | "budget/apply-single-template" | "budget/set-n-month-avg" | "budget/copy-single-month">(name: Name, func: BudgetHandlers[Name]): void;
8
8
  service(func: any): void;
9
9
  combine(...apps: any[]): void;
10
10
  startServices(): void;
@@ -46,6 +46,11 @@ export interface BudgetHandlers {
46
46
  category: string;
47
47
  }) => Promise<void>;
48
48
 
49
+ 'budget/cover-overbudgeted': (arg: {
50
+ month: string;
51
+ category: string;
52
+ }) => Promise<void>;
53
+
49
54
  'budget/transfer-category': (arg: {
50
55
  month: string;
51
56
  amount: number;
@@ -1,16 +1,56 @@
1
+ import { Database } from '@jlongster/sql.js';
1
2
  import { CategoryEntity, CategoryGroupEntity } from '../../types/models';
2
3
  export { toDateRepr, fromDateRepr } from '../models';
3
- export declare function getDatabasePath(): any;
4
- export declare function openDatabase(id?: any): Promise<void>;
5
- export declare function reopenDatabase(): Promise<void>;
4
+ export declare function getDatabasePath(): string;
5
+ export declare function openDatabase(id?: string): Promise<void>;
6
6
  export declare function closeDatabase(): Promise<void>;
7
- export declare function setDatabase(db_: any): void;
8
- export declare function getDatabase(): any;
7
+ export declare function setDatabase(db_: Database): void;
8
+ export declare function getDatabase(): {
9
+ close(): void;
10
+ create_function(name: string, func: (...args: any[]) => any): any;
11
+ each(sql: string, params: import("@jlongster/sql.js").BindParams, callback: import("@jlongster/sql.js").ParamsCallback, done: () => void): any;
12
+ each(sql: string, callback: import("@jlongster/sql.js").ParamsCallback, done: () => void): any;
13
+ exec(sql: string, params?: import("@jlongster/sql.js").BindParams): import("@jlongster/sql.js").QueryExecResult[];
14
+ export(): Uint8Array;
15
+ getRowsModified(): number;
16
+ handleError(): null;
17
+ iterateStatements(sql: string): {
18
+ getRemainingSql(): string;
19
+ next(): import("@jlongster/sql.js").StatementIteratorResult;
20
+ [Symbol.iterator](): Iterator<{
21
+ bind(values?: import("@jlongster/sql.js").BindParams): boolean;
22
+ free(): boolean;
23
+ freemem(): void;
24
+ get(params?: import("@jlongster/sql.js").BindParams): import("@jlongster/sql.js").SqlValue[];
25
+ getAsObject(params?: import("@jlongster/sql.js").BindParams): import("@jlongster/sql.js").ParamsObject;
26
+ getColumnNames(): string[];
27
+ getNormalizedSQL(): string;
28
+ getSQL(): string;
29
+ reset(): void;
30
+ run(values?: import("@jlongster/sql.js").BindParams): void;
31
+ step(): boolean;
32
+ }, any, undefined>;
33
+ };
34
+ prepare(sql: string, params?: import("@jlongster/sql.js").BindParams): {
35
+ bind(values?: import("@jlongster/sql.js").BindParams): boolean;
36
+ free(): boolean;
37
+ freemem(): void;
38
+ get(params?: import("@jlongster/sql.js").BindParams): import("@jlongster/sql.js").SqlValue[];
39
+ getAsObject(params?: import("@jlongster/sql.js").BindParams): import("@jlongster/sql.js").ParamsObject;
40
+ getColumnNames(): string[];
41
+ getNormalizedSQL(): string;
42
+ getSQL(): string;
43
+ reset(): void;
44
+ run(values?: import("@jlongster/sql.js").BindParams): void;
45
+ step(): boolean;
46
+ };
47
+ run(sql: string, params?: import("@jlongster/sql.js").BindParams): any;
48
+ };
9
49
  export declare function loadClock(): Promise<void>;
10
50
  export declare function runQuery(sql: string, params?: Array<string | number>, fetchAll?: false): any;
11
51
  export declare function runQuery(sql: string, params: Array<string | number> | undefined, fetchAll: true): any;
12
- export declare function execQuery(sql: any): void;
13
- export declare function cache(sql: any): any;
52
+ export declare function execQuery(sql: string): void;
53
+ export declare function cache(sql: string): any;
14
54
  export declare function transaction(fn: () => void): void;
15
55
  export declare function asyncTransaction(fn: () => Promise<void>): Promise<void>;
16
56
  export declare function all(sql: any, params?: (string | number)[]): Promise<any>;
@@ -45,6 +85,7 @@ export declare function deleteTransferPayee(payee: any): Promise<void>;
45
85
  export declare function updatePayee(payee: any): Promise<void>;
46
86
  export declare function mergePayees(target: string, ids: string[]): Promise<void>;
47
87
  export declare function getPayees(): Promise<any>;
88
+ export declare function getCommonPayees(): Promise<any>;
48
89
  export declare function syncGetOrphanedPayees(): Promise<any>;
49
90
  export declare function getOrphanedPayees(): Promise<any>;
50
91
  export declare function getPayeeByName(name: any): Promise<any>;
@@ -4,7 +4,7 @@ export declare const app: {
4
4
  handlers: Handlers;
5
5
  services: any;
6
6
  unlistenServices: any;
7
- method<Name extends "transaction-update" | "undo" | "redo" | "transactions-batch-update" | "transaction-add" | "transaction-delete" | "transactions-parse-file" | "transactions-export" | "transactions-export-query" | "get-categories" | "get-earliest-transaction" | "get-budget-bounds" | "rollover-budget-month" | "report-budget-month" | "budget-set-type" | "category-create" | "category-update" | "category-move" | "category-delete" | "category-group-create" | "category-group-update" | "category-group-move" | "category-group-delete" | "must-category-transfer" | "payee-create" | "payees-get" | "payees-get-rule-counts" | "payees-merge" | "payees-batch-change" | "payees-check-orphaned" | "payees-get-rules" | "make-filters-from-conditions" | "getCell" | "getCells" | "getCellNamesInSheet" | "debugCell" | "create-query" | "query" | "account-update" | "accounts-get" | "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-status" | "simplefin-status" | "simplefin-accounts" | "gocardless-get-banks" | "gocardless-poll-web-token-stop" | "gocardless-create-web-token" | "accounts-bank-sync" | "transactions-import" | "account-unlink" | "save-global-prefs" | "load-global-prefs" | "save-prefs" | "load-prefs" | "sync-reset" | "sync-repair" | "key-make" | "key-test" | "get-did-bootstrap" | "subscribe-needs-bootstrap" | "subscribe-bootstrap" | "subscribe-get-user" | "subscribe-change-password" | "subscribe-sign-in" | "subscribe-sign-out" | "get-server-version" | "get-server-url" | "set-server-url" | "sync" | "get-budgets" | "get-remote-files" | "reset-budget-cache" | "upload-budget" | "download-budget" | "sync-budget" | "load-budget" | "create-demo-budget" | "close-budget" | "delete-budget" | "create-budget" | "import-budget" | "export-budget" | "upload-file-web" | "backups-get" | "backup-load" | "backup-make" | "get-last-opened-backup" | "app-focused" | "api/batch-budget-start" | "api/batch-budget-end" | "api/load-budget" | "api/download-budget" | "api/start-import" | "api/finish-import" | "api/abort-import" | "api/query" | "api/budget-months" | "api/budget-month" | "api/budget-set-amount" | "api/budget-set-carryover" | "api/transactions-export" | "api/transactions-import" | "api/transactions-add" | "api/transactions-get" | "api/transaction-update" | "api/transaction-delete" | "api/sync" | "api/bank-sync" | "api/accounts-get" | "api/account-create" | "api/account-update" | "api/account-close" | "api/account-reopen" | "api/account-delete" | "api/categories-get" | "api/category-groups-get" | "api/category-group-create" | "api/category-group-update" | "api/category-group-delete" | "api/category-create" | "api/category-update" | "api/category-delete" | "api/payees-get" | "api/payee-create" | "api/payee-update" | "api/payee-delete" | "api/rules-get" | "api/payee-rules-get" | "api/rule-create" | "api/rule-update" | "api/rule-delete" | "budget/budget-amount" | "budget/copy-previous-month" | "budget/set-zero" | "budget/set-3month-avg" | "budget/check-templates" | "budget/apply-goal-template" | "budget/overwrite-goal-template" | "budget/cleanup-goal-template" | "budget/hold-for-next-month" | "budget/reset-hold" | "budget/cover-overspending" | "budget/transfer-available" | "budget/transfer-category" | "budget/set-carryover" | "budget/apply-single-template" | "budget/set-n-month-avg" | "budget/copy-single-month" | "filter-create" | "filter-update" | "filter-delete" | "notes-save" | "report/create" | "report/update" | "report/delete" | "rule-validate" | "rule-add" | "rule-update" | "rule-delete" | "rule-delete-all" | "rule-apply-actions" | "rule-add-payee-rename" | "rules-get" | "rule-get" | "rules-run" | "schedule/create" | "schedule/update" | "schedule/delete" | "schedule/skip-next-date" | "schedule/post-transaction" | "schedule/force-run-service" | "schedule/discover" | "schedule/get-upcoming-dates" | "tools/fix-split-transactions">(name: Name, func: Handlers[Name]): void;
7
+ method<Name extends "sync" | "query" | "transaction-update" | "undo" | "redo" | "transactions-batch-update" | "transaction-add" | "transaction-delete" | "transactions-parse-file" | "transactions-export" | "transactions-export-query" | "get-categories" | "get-earliest-transaction" | "get-budget-bounds" | "rollover-budget-month" | "report-budget-month" | "budget-set-type" | "category-create" | "category-update" | "category-move" | "category-delete" | "category-group-create" | "category-group-update" | "category-group-move" | "category-group-delete" | "must-category-transfer" | "payee-create" | "common-payees-get" | "payees-get" | "payees-get-rule-counts" | "payees-merge" | "payees-batch-change" | "payees-check-orphaned" | "payees-get-rules" | "make-filters-from-conditions" | "getCell" | "getCells" | "getCellNamesInSheet" | "debugCell" | "create-query" | "account-update" | "accounts-get" | "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-status" | "simplefin-status" | "simplefin-accounts" | "gocardless-get-banks" | "gocardless-poll-web-token-stop" | "gocardless-create-web-token" | "accounts-bank-sync" | "transactions-import" | "account-unlink" | "save-global-prefs" | "load-global-prefs" | "save-prefs" | "load-prefs" | "sync-reset" | "sync-repair" | "key-make" | "key-test" | "get-did-bootstrap" | "subscribe-needs-bootstrap" | "subscribe-bootstrap" | "subscribe-get-user" | "subscribe-change-password" | "subscribe-sign-in" | "subscribe-sign-out" | "get-server-version" | "get-server-url" | "set-server-url" | "get-budgets" | "get-remote-files" | "reset-budget-cache" | "upload-budget" | "download-budget" | "sync-budget" | "load-budget" | "create-demo-budget" | "close-budget" | "delete-budget" | "create-budget" | "import-budget" | "export-budget" | "upload-file-web" | "backups-get" | "backup-load" | "backup-make" | "get-last-opened-backup" | "app-focused" | "api/batch-budget-start" | "api/batch-budget-end" | "api/load-budget" | "api/download-budget" | "api/get-budgets" | "api/start-import" | "api/finish-import" | "api/abort-import" | "api/query" | "api/budget-months" | "api/budget-month" | "api/budget-set-amount" | "api/budget-set-carryover" | "api/transactions-export" | "api/transactions-import" | "api/transactions-add" | "api/transactions-get" | "api/transaction-update" | "api/transaction-delete" | "api/sync" | "api/bank-sync" | "api/accounts-get" | "api/account-create" | "api/account-update" | "api/account-close" | "api/account-reopen" | "api/account-delete" | "api/account-balance" | "api/categories-get" | "api/category-groups-get" | "api/category-group-create" | "api/category-group-update" | "api/category-group-delete" | "api/category-create" | "api/category-update" | "api/category-delete" | "api/payees-get" | "api/common-payees-get" | "api/payee-create" | "api/payee-update" | "api/payee-delete" | "api/payees-merge" | "api/rules-get" | "api/payee-rules-get" | "api/rule-create" | "api/rule-update" | "api/rule-delete" | "budget/budget-amount" | "budget/copy-previous-month" | "budget/set-zero" | "budget/set-3month-avg" | "budget/check-templates" | "budget/apply-goal-template" | "budget/overwrite-goal-template" | "budget/cleanup-goal-template" | "budget/hold-for-next-month" | "budget/reset-hold" | "budget/cover-overspending" | "budget/transfer-available" | "budget/cover-overbudgeted" | "budget/transfer-category" | "budget/set-carryover" | "budget/apply-single-template" | "budget/set-n-month-avg" | "budget/copy-single-month" | "filter-create" | "filter-update" | "filter-delete" | "notes-save" | "report/create" | "report/update" | "report/delete" | "rule-validate" | "rule-add" | "rule-update" | "rule-delete" | "rule-delete-all" | "rule-apply-actions" | "rule-add-payee-rename" | "rules-get" | "rule-get" | "rules-run" | "schedule/create" | "schedule/update" | "schedule/delete" | "schedule/skip-next-date" | "schedule/post-transaction" | "schedule/force-run-service" | "schedule/discover" | "schedule/get-upcoming-dates" | "tools/fix-split-transactions">(name: Name, func: Handlers[Name]): void;
8
8
  service(func: any): void;
9
9
  combine(...apps: any[]): void;
10
10
  startServices(): void;
@@ -1,4 +1,4 @@
1
- import { Database } from 'better-sqlite3';
1
+ import { Database } from '@jlongster/sql.js';
2
2
  export declare function withMigrationsDir(dir: string, func: () => Promise<void>): Promise<void>;
3
3
  export declare function getMigrationsDir(): string;
4
4
  export declare function getUpMigration(id: any, names: any): any;
@@ -1,3 +1,3 @@
1
- export declare function post(url: any, data: any, headers?: {}): Promise<any>;
1
+ export declare function post(url: any, data: any, headers?: {}, timeout?: any): Promise<any>;
2
2
  export declare function postBinary(url: any, data: any, headers: any): Promise<any>;
3
3
  export declare function get(url: any, opts?: any): Promise<string>;
@@ -0,0 +1 @@
1
+ export declare function getNormalisedString(value: string): string;
@@ -31,7 +31,7 @@ export declare const ALLOCATION_METHODS: {
31
31
  remainder: string;
32
32
  };
33
33
  export declare function mapField(field: any, opts?: any): any;
34
- export declare function friendlyOp(op: any, type?: any): "" | "is" | "contains" | "one of" | "not one of" | "is not" | "is approx" | "is between" | "does not contain" | "is after" | "is greater than" | "is after or equals" | "is greater than or equals" | "is before" | "is less than" | "is before or equals" | "is less than or equals" | "is true" | "is false" | "set" | "allocate" | "link schedule" | "and" | "or";
34
+ export declare function friendlyOp(op: any, type?: any): "" | "is" | "contains" | "matches" | "one of" | "not one of" | "is not" | "is approx" | "is between" | "does not contain" | "is after" | "is greater than" | "is after or equals" | "is greater than or equals" | "is before" | "is less than" | "is before or equals" | "is less than or equals" | "is true" | "is false" | "set" | "allocate" | "link schedule" | "and" | "or";
35
35
  export declare function deserializeField(field: any): {
36
36
  field: string;
37
37
  options: {
@@ -73,8 +73,6 @@ export declare function realizeTempTransactions(transactions: TransactionEntity[
73
73
  payee?: import("../types/models").PayeeEntity;
74
74
  schedule?: import("../types/models").ScheduleEntity;
75
75
  subtransactions?: TransactionEntity[];
76
- sort_order?: number;
77
- tombstone?: boolean;
78
76
  imported_payee?: string;
79
77
  date: string;
80
78
  notes?: string;
@@ -87,5 +85,32 @@ export declare function realizeTempTransactions(transactions: TransactionEntity[
87
85
  imported_id?: string;
88
86
  starting_balance_flag?: boolean;
89
87
  transfer_id?: string;
88
+ sort_order?: number;
89
+ tombstone?: boolean;
90
90
  }[];
91
+ export declare function makeAsNonChildTransactions(childTransactionsToUpdate: TransactionEntity[], transactions: TransactionEntity[]): {
92
+ updated: TransactionEntity[];
93
+ deleted: {
94
+ amount: number;
95
+ id: string;
96
+ account: import("../types/models").AccountEntity;
97
+ category?: import("../types/models").CategoryEntity;
98
+ payee?: import("../types/models").PayeeEntity;
99
+ schedule?: import("../types/models").ScheduleEntity;
100
+ subtransactions?: TransactionEntity[];
101
+ imported_payee?: string;
102
+ date: string;
103
+ notes?: string;
104
+ cleared?: boolean;
105
+ reconciled?: boolean;
106
+ is_parent?: boolean;
107
+ is_child?: boolean;
108
+ parent_id?: string;
109
+ imported_id?: string;
110
+ starting_balance_flag?: boolean;
111
+ transfer_id?: string;
112
+ sort_order?: number;
113
+ tombstone?: boolean;
114
+ }[];
115
+ };
91
116
  export {};
@@ -31,7 +31,7 @@ export declare function getIn(map: any, keys: any): any;
31
31
  export declare function fastSetMerge<T>(set1: Set<T>, set2: Set<T>): Set<T>;
32
32
  export declare function titleFirst(str: string): string;
33
33
  export declare function appendDecimals(amountText: string, hideDecimals?: boolean): string;
34
- type NumberFormats = 'comma-dot' | 'dot-comma' | 'space-comma' | 'space-dot' | 'comma-dot-in';
34
+ type NumberFormats = 'comma-dot' | 'dot-comma' | 'space-comma' | 'apostrophe-dot' | 'comma-dot-in';
35
35
  export declare const numberFormats: Array<{
36
36
  value: NumberFormats;
37
37
  label: string;
@@ -3,6 +3,7 @@ import type {
3
3
  APIAccountEntity,
4
4
  APICategoryEntity,
5
5
  APICategoryGroupEntity,
6
+ APIFileEntity,
6
7
  APIPayeeEntity,
7
8
  } from '../server/api-models';
8
9
 
@@ -23,6 +24,8 @@ export interface ApiHandlers {
23
24
  password?: string;
24
25
  }) => Promise<void>;
25
26
 
27
+ 'api/get-budgets': () => Promise<APIFileEntity[]>;
28
+
26
29
  'api/start-import': (arg: { budgetName: string }) => Promise<void>;
27
30
 
28
31
  'api/finish-import': () => Promise<void>;
@@ -114,6 +117,11 @@ export interface ApiHandlers {
114
117
 
115
118
  'api/account-delete': (arg: { id }) => Promise<unknown>;
116
119
 
120
+ 'api/account-balance': (arg: {
121
+ id: string;
122
+ cutoff?: Date;
123
+ }) => Promise<number>;
124
+
117
125
  'api/categories-get': (arg: {
118
126
  grouped;
119
127
  }) => Promise<Array<APICategoryGroupEntity | APICategoryEntity>>;
@@ -140,12 +148,19 @@ export interface ApiHandlers {
140
148
 
141
149
  'api/payees-get': () => Promise<APIPayeeEntity[]>;
142
150
 
151
+ 'api/common-payees-get': () => Promise<APIPayeeEntity[]>;
152
+
143
153
  'api/payee-create': (arg: { payee }) => Promise<string>;
144
154
 
145
155
  'api/payee-update': (arg: { id; fields }) => Promise<unknown>;
146
156
 
147
157
  'api/payee-delete': (arg: { id }) => Promise<unknown>;
148
158
 
159
+ 'api/payees-merge': (arg: {
160
+ targetId: string;
161
+ mergeIds: string[];
162
+ }) => Promise<void>;
163
+
149
164
  'api/rules-get': () => Promise<RuleEntity[]>;
150
165
 
151
166
  'api/payee-rules-get': (arg: { id: string }) => Promise<RuleEntity[]>;
@@ -10,12 +10,14 @@ export type FileState =
10
10
 
11
11
  export type LocalFile = Omit<Budget, 'cloudFileId' | 'groupId'> & {
12
12
  state: 'local';
13
+ hasKey: boolean;
13
14
  };
14
15
 
15
16
  export type SyncableLocalFile = Budget & {
16
17
  cloudFileId: string;
17
18
  groupId: string;
18
19
  state: 'broken' | 'unknown';
20
+ hasKey: boolean;
19
21
  };
20
22
 
21
23
  export type SyncedLocalFile = Budget & {
@@ -2,6 +2,7 @@ export interface NewPayeeEntity {
2
2
  id?: string;
3
3
  name: string;
4
4
  transfer_acct?: string;
5
+ favorite?: boolean;
5
6
  tombstone?: boolean;
6
7
  }
7
8
 
@@ -15,6 +15,7 @@ export interface CustomReportEntity {
15
15
  showEmpty: boolean;
16
16
  showOffBudget: boolean;
17
17
  showHiddenCategories: boolean;
18
+ includeCurrentInterval: boolean;
18
19
  showUncategorized: boolean;
19
20
  selectedCategories?: CategoryEntity[];
20
21
  graphType: string;
@@ -24,6 +25,21 @@ export interface CustomReportEntity {
24
25
  tombstone?: boolean;
25
26
  }
26
27
 
28
+ export type balanceTypeOpType =
29
+ | 'totalAssets'
30
+ | 'totalDebts'
31
+ | 'totalTotals'
32
+ | 'netAssets'
33
+ | 'netDebts';
34
+
35
+ export type spendingReportTimeType =
36
+ | 'average'
37
+ | 'thisMonth'
38
+ | 'lastMonth'
39
+ | 'twoMonthsPrevious'
40
+ | 'lastYear'
41
+ | 'lastYearPrevious';
42
+
27
43
  export type SpendingMonthEntity = Record<
28
44
  string | number,
29
45
  {
@@ -49,6 +65,9 @@ export interface SpendingEntity {
49
65
  average: number;
50
66
  thisMonth: number;
51
67
  lastMonth: number;
68
+ twoMonthsPrevious: number;
69
+ lastYear: number;
70
+ lastYearPrevious: number;
52
71
  }[];
53
72
  startDate?: string;
54
73
  endDate?: string;
@@ -66,6 +85,8 @@ export interface DataEntity {
66
85
  endDate?: string;
67
86
  totalDebts: number;
68
87
  totalAssets: number;
88
+ netAssets: number;
89
+ netDebts: number;
69
90
  totalTotals: number;
70
91
  }
71
92
 
@@ -82,6 +103,8 @@ export type IntervalEntity = {
82
103
  intervalEndDate?: string;
83
104
  totalAssets: number;
84
105
  totalDebts: number;
106
+ netAssets: number;
107
+ netDebts: number;
85
108
  totalTotals: number;
86
109
  };
87
110
 
@@ -93,6 +116,8 @@ export interface GroupedEntity {
93
116
  totalAssets: number;
94
117
  totalDebts: number;
95
118
  totalTotals: number;
119
+ netAssets: number;
120
+ netDebts: number;
96
121
  categories?: GroupedEntity[];
97
122
  }
98
123
 
@@ -113,6 +138,7 @@ export interface CustomReportData {
113
138
  show_empty: number;
114
139
  show_offbudget: number;
115
140
  show_hidden: number;
141
+ include_current: number;
116
142
  show_uncategorized: number;
117
143
  selected_categories?: CategoryEntity[];
118
144
  graph_type: string;
@@ -24,7 +24,8 @@ export type RuleConditionOp =
24
24
  | 'lt'
25
25
  | 'lte'
26
26
  | 'contains'
27
- | 'doesNotContain';
27
+ | 'doesNotContain'
28
+ | 'matches';
28
29
 
29
30
  export interface RuleConditionEntity {
30
31
  field?: string;