@actual-app/api 24.10.1 → 24.12.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 (44) hide show
  1. package/@types/loot-core/client/state-types/modals.d.ts +11 -0
  2. package/@types/loot-core/client/state-types/queries.d.ts +9 -10
  3. package/@types/loot-core/platform/server/log/index.d.ts +0 -3
  4. package/@types/loot-core/server/accounts/rules.d.ts +23 -27
  5. package/@types/loot-core/server/accounts/sync.d.ts +5 -0
  6. package/@types/loot-core/server/accounts/transaction-rules.d.ts +8 -3
  7. package/@types/loot-core/server/budget/actions.d.ts +1 -0
  8. package/@types/loot-core/server/budget/app.d.ts +1 -1
  9. package/@types/loot-core/server/budget/categoryTemplate.d.ts +46 -0
  10. package/@types/loot-core/server/budget/goaltemplates.d.ts +4 -0
  11. package/@types/loot-core/server/budget/types/handlers.d.ts +5 -0
  12. package/@types/loot-core/server/budget/types/templates.d.ts +7 -1
  13. package/@types/loot-core/server/main-app.d.ts +1 -1
  14. package/@types/loot-core/server/prefs.d.ts +2 -0
  15. package/@types/loot-core/server/server-config.d.ts +1 -0
  16. package/@types/loot-core/shared/months.d.ts +1 -1
  17. package/@types/loot-core/shared/query.d.ts +30 -16
  18. package/@types/loot-core/shared/rules.d.ts +3 -3
  19. package/@types/loot-core/shared/schedules.d.ts +5 -2
  20. package/@types/loot-core/shared/util.d.ts +1 -3
  21. package/@types/loot-core/types/models/bank-sync.d.ts +21 -0
  22. package/@types/loot-core/types/models/dashboard.d.ts +29 -1
  23. package/@types/loot-core/types/models/gocardless.d.ts +61 -0
  24. package/@types/loot-core/types/models/index.d.ts +1 -0
  25. package/@types/loot-core/types/models/payee.d.ts +1 -1
  26. package/@types/loot-core/types/models/rule.d.ts +7 -2
  27. package/@types/loot-core/types/models/schedule.d.ts +1 -1
  28. package/@types/loot-core/types/models/simplefin.d.ts +7 -0
  29. package/@types/loot-core/types/prefs.d.ts +6 -3
  30. package/@types/loot-core/types/server-events.d.ts +2 -1
  31. package/@types/loot-core/types/server-handlers.d.ts +14 -1
  32. package/dist/app/bundle.api.js +12855 -5433
  33. package/dist/migrations/1722804019000_create_dashboard_table.js +2 -1
  34. package/dist/migrations/1730744182000_fix_dashboard_table.sql +7 -0
  35. package/dist/package.json +1 -1
  36. package/package.json +1 -1
  37. package/@types/loot-core/server/budget/goals/goalsAverage.d.ts +0 -4
  38. package/@types/loot-core/server/budget/goals/goalsBy.d.ts +0 -5
  39. package/@types/loot-core/server/budget/goals/goalsPercentage.d.ts +0 -4
  40. package/@types/loot-core/server/budget/goals/goalsRemainder.d.ts +0 -8
  41. package/@types/loot-core/server/budget/goals/goalsSimple.d.ts +0 -7
  42. package/@types/loot-core/server/budget/goals/goalsSpend.d.ts +0 -4
  43. package/@types/loot-core/server/budget/goals/goalsWeek.d.ts +0 -7
  44. /package/@types/loot-core/server/budget/{goals/goalsSchedule.d.ts → goalsSchedule.d.ts} +0 -0
@@ -86,6 +86,15 @@ type FinanceModals = {
86
86
 
87
87
  'import-actual': null;
88
88
 
89
+ 'out-of-sync-migrations': null;
90
+
91
+ 'files-settings': null;
92
+
93
+ 'confirm-change-document-dir': {
94
+ currentBudgetDirectory: string;
95
+ newDirectory: string;
96
+ };
97
+
89
98
  'create-encryption-key': { recreate?: boolean };
90
99
  'fix-encryption-key': {
91
100
  hasExistingKey?: boolean;
@@ -276,6 +285,8 @@ type FinanceModals = {
276
285
  accountName: string;
277
286
  onUnlink: () => void;
278
287
  };
288
+ 'keyboard-shortcuts': EmptyObject;
289
+ 'goal-templates': EmptyObject;
279
290
  };
280
291
 
281
292
  export type PushModalAction = {
@@ -1,12 +1,12 @@
1
1
  import type { Handlers } from '../../types/handlers';
2
- import { type AccountEntity } from '../../types/models';
2
+ import { type TransactionEntity, type AccountEntity } from '../../types/models';
3
3
  import type * as constants from '../constants';
4
4
 
5
5
  export type QueriesState = {
6
- newTransactions: string[];
7
- matchedTransactions: string[];
8
- lastTransaction: unknown | null;
9
- updatedAccounts: string[];
6
+ newTransactions: Array<TransactionEntity['id']>;
7
+ matchedTransactions: Array<TransactionEntity['id']>;
8
+ lastTransaction: TransactionEntity | null;
9
+ updatedAccounts: Array<AccountEntity['id']>;
10
10
  accounts: AccountEntity[];
11
11
  accountsLoaded: boolean;
12
12
  categories: Awaited<ReturnType<Handlers['get-categories']>>;
@@ -15,14 +15,13 @@ export type QueriesState = {
15
15
  commonPayees: Awaited<ReturnType<Handlers['common-payees-get']>>;
16
16
  payees: Awaited<ReturnType<Handlers['payees-get']>>;
17
17
  payeesLoaded: boolean;
18
- earliestTransaction: unknown | null;
19
18
  };
20
19
 
21
20
  type SetNewTransactionsAction = {
22
21
  type: typeof constants.SET_NEW_TRANSACTIONS;
23
- newTransactions?: string[];
24
- matchedTransactions?: string[];
25
- updatedAccounts?: string[];
22
+ newTransactions?: Array<TransactionEntity['id']>;
23
+ matchedTransactions?: Array<TransactionEntity['id']>;
24
+ updatedAccounts?: Array<AccountEntity['id']>;
26
25
  };
27
26
 
28
27
  type UpdateNewTransactionsAction = {
@@ -32,7 +31,7 @@ type UpdateNewTransactionsAction = {
32
31
 
33
32
  type SetLastTransactionAction = {
34
33
  type: typeof constants.SET_LAST_TRANSACTION;
35
- transaction: unknown;
34
+ transaction: TransactionEntity;
36
35
  };
37
36
 
38
37
  type MarkAccountReadAction = {
@@ -1,9 +1,6 @@
1
- import { type Transports } from 'electron-log';
2
-
3
1
  export interface Logger {
4
2
  info(...args: unknown[]): void;
5
3
  warn(...args: unknown[]): void;
6
- transports?: Transports;
7
4
  }
8
5
 
9
6
  export const logger: Logger;
@@ -1,3 +1,4 @@
1
+ import { RuleEntity } from '../../types/models';
1
2
  export declare function parseDateString(str: any): {
2
3
  type: string;
3
4
  date: string;
@@ -30,6 +31,7 @@ export declare class Action {
30
31
  rawValue: any;
31
32
  type: any;
32
33
  value: any;
34
+ private handlebarsTemplate?;
33
35
  constructor(op: ActionOperator, field: any, value: any, options: any);
34
36
  exec(object: any): void;
35
37
  serialize(): {
@@ -42,48 +44,42 @@ export declare class Action {
42
44
  }
43
45
  export declare function execActions(actions: Action[], transaction: any): any;
44
46
  export declare class Rule {
45
- actions: any;
46
- conditions: any;
47
+ actions: Action[];
48
+ conditions: Condition[];
47
49
  conditionsOp: any;
48
- id: any;
49
- stage: any;
50
+ id?: string;
51
+ stage: 'pre' | null | 'post';
50
52
  constructor({ id, stage, conditionsOp, conditions, actions, }: {
51
53
  id?: string;
52
- stage?: any;
54
+ stage?: 'pre' | null | 'post';
53
55
  conditionsOp: any;
54
56
  conditions: any;
55
57
  actions: any;
56
58
  });
57
- evalConditions(object: any): any;
59
+ evalConditions(object: any): boolean;
58
60
  execActions<T>(object: T): Partial<T>;
59
61
  exec(object: any): Partial<any>;
60
62
  apply(object: any): any;
61
- getId(): any;
62
- serialize(): {
63
- id: any;
64
- stage: any;
65
- conditionsOp: any;
66
- conditions: any;
67
- actions: any;
68
- };
63
+ getId(): string | undefined;
64
+ serialize(): RuleEntity;
69
65
  }
70
66
  export declare class RuleIndexer {
71
- field: any;
72
- method: any;
73
- rules: any;
67
+ field: string;
68
+ method?: string;
69
+ rules: Map<string, Set<Rule>>;
74
70
  constructor({ field, method }: {
75
71
  field: string;
76
72
  method?: string;
77
73
  });
78
- getIndex(key: any): any;
79
- getIndexForValue(value: any): any;
80
- getKey(value: any): string;
81
- getIndexes(rule: any): any[];
82
- index(rule: any): void;
83
- remove(rule: any): void;
84
- getApplicableRules(object: any): Set<unknown>;
74
+ getIndex(key: string | null): Set<Rule>;
75
+ getIndexForValue(value: unknown): Set<Rule>;
76
+ getKey(value: unknown): string | null;
77
+ getIndexes(rule: Rule): Set<Rule>[];
78
+ index(rule: Rule): void;
79
+ remove(rule: Rule): void;
80
+ getApplicableRules(object: any): Set<Rule>;
85
81
  }
86
- export declare function rankRules(rules: any): any[];
87
- export declare function migrateIds(rule: any, mappings: any): void;
88
- export declare function iterateIds(rules: any, fieldName: any, func: any): void;
82
+ export declare function rankRules(rules: Iterable<Rule>): Rule[];
83
+ export declare function migrateIds(rule: Rule, mappings: Map<string, string>): void;
84
+ export declare function iterateIds(rules: Rule[], fieldName: string, func: (rule: Rule, id: string) => void | boolean): void;
89
85
  export {};
@@ -1,3 +1,4 @@
1
+ import { AccountEntity } from '../../types/models';
1
2
  export declare function getGoCardlessAccounts(userId: any, userKey: any, id: any): Promise<any>;
2
3
  export declare function reconcileTransactions(acctId: any, transactions: any, isBankSyncAccount?: boolean, strictIdChecking?: boolean, isPreview?: boolean): Promise<{
3
4
  added: any[];
@@ -22,3 +23,7 @@ export declare function syncAccount(userId: string, userKey: string, id: string,
22
23
  added: any[];
23
24
  updated: any[];
24
25
  }>;
26
+ export declare function SimpleFinBatchSync(accounts: {
27
+ id: AccountEntity['id'];
28
+ accountId: AccountEntity['account_id'];
29
+ }[]): Promise<any[]>;
@@ -1,5 +1,5 @@
1
1
  import { type TransactionEntity, type RuleActionEntity, type RuleEntity } from '../../types/models';
2
- import { Action } from './rules';
2
+ import { Action, Rule } from './rules';
3
3
  export { iterateIds } from './rules';
4
4
  export declare function resetState(): void;
5
5
  export declare function parseConditionsOrActions(str: any): any[];
@@ -19,7 +19,7 @@ export declare function insertRule(rule: Omit<RuleEntity, 'id'> & {
19
19
  }): Promise<any>;
20
20
  export declare function updateRule(rule: any): Promise<void>;
21
21
  export declare function deleteRule(id: string): Promise<boolean>;
22
- export declare function runRules(trans: any): any;
22
+ export declare function runRules(trans: any): Promise<TransactionEntity>;
23
23
  export declare function conditionsToAQL(conditions: any, { recurDateBounds }?: {
24
24
  recurDateBounds?: number;
25
25
  }): {
@@ -39,7 +39,12 @@ export declare function applyActions(transactions: TransactionEntity[], actions:
39
39
  category: any;
40
40
  })[];
41
41
  }>;
42
- export declare function getRulesForPayee(payeeId: any): any[];
42
+ export declare function getRulesForPayee(payeeId: any): Rule[];
43
43
  export declare function updatePayeeRenameRule(fromNames: string[], to: string): Promise<any>;
44
44
  export declare function getProbableCategory(transactions: any): any;
45
45
  export declare function updateCategoryRules(transactions: any): Promise<void>;
46
+ export type TransactionForRules = TransactionEntity & {
47
+ payee_name?: string;
48
+ };
49
+ export declare function prepareTransactionForRules(trans: TransactionEntity): Promise<TransactionForRules>;
50
+ export declare function finalizeTransactionForRules(trans: TransactionEntity | TransactionForRules): Promise<TransactionEntity>;
@@ -1,4 +1,5 @@
1
1
  export declare function getSheetValue(sheetName: string, cell: string): Promise<number>;
2
+ export declare function getSheetBoolean(sheetName: string, cell: string): Promise<boolean>;
2
3
  export declare function isReflectBudget(): boolean;
3
4
  export declare function getBudget({ category, month, }: {
4
5
  category: string;
@@ -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/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;
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" | "budget/apply-multiple-templates">(name: Name, func: BudgetHandlers[Name]): void;
8
8
  service(func: any): void;
9
9
  combine(...apps: any[]): void;
10
10
  startServices(): void;
@@ -0,0 +1,46 @@
1
+ import { Template } from './types/templates';
2
+ export declare class CategoryTemplate {
3
+ static init(templates: Template[], categoryID: string, month: any): Promise<CategoryTemplate>;
4
+ getPriorities(): number[];
5
+ getRemainderWeight(): number;
6
+ getLimitExcess(): number;
7
+ runAll(available: number): Promise<number>;
8
+ runTemplatesForPriority(priority: number, budgetAvail: number, availStart: number): Promise<number>;
9
+ runRemainder(budgetAvail: number, perWeight: number): number;
10
+ getValues(): {
11
+ budgeted: any;
12
+ goal: any;
13
+ longGoal: any;
14
+ };
15
+ readonly categoryID: string;
16
+ private month;
17
+ private templates;
18
+ private remainder;
19
+ private goals;
20
+ private priorities;
21
+ private remainderWeight;
22
+ private toBudgetAmount;
23
+ private fullAmount;
24
+ private isLongGoal;
25
+ private goalAmount;
26
+ private fromLastMonth;
27
+ private limitMet;
28
+ private limitExcess;
29
+ private limitAmount;
30
+ private limitCheck;
31
+ private limitHold;
32
+ private constructor();
33
+ private runGoal;
34
+ static checkByAndScheduleAndSpend(templates: any, month: any): Promise<void>;
35
+ static checkPercentage(templates: any): Promise<void>;
36
+ private checkLimit;
37
+ private checkSpend;
38
+ private checkGoal;
39
+ private runSimple;
40
+ private runCopy;
41
+ private runWeek;
42
+ private runSpend;
43
+ private runPercentage;
44
+ private runAverage;
45
+ private runBy;
46
+ }
@@ -5,6 +5,10 @@ export declare function applyTemplate({ month }: {
5
5
  export declare function overwriteTemplate({ month }: {
6
6
  month: any;
7
7
  }): Promise<Notification>;
8
+ export declare function applyMultipleCategoryTemplates({ month, categoryIds }: {
9
+ month: any;
10
+ categoryIds: any;
11
+ }): Promise<Notification>;
8
12
  export declare function applySingleCategoryTemplate({ month, category }: {
9
13
  month: any;
10
14
  category: any;
@@ -79,4 +79,9 @@ export interface BudgetHandlers {
79
79
  month: string;
80
80
  category: string; //category id
81
81
  }) => Promise<void>;
82
+
83
+ 'budget/apply-multiple-templates': (arg: {
84
+ month: string;
85
+ categoryIds: string[];
86
+ }) => Promise<Notification>;
82
87
  }
@@ -55,7 +55,7 @@ interface RemainderTemplate extends BaseTemplate {
55
55
 
56
56
  interface AverageTemplate extends BaseTemplate {
57
57
  type: 'average';
58
- amount: number;
58
+ numMonths: number;
59
59
  }
60
60
 
61
61
  interface GoalTemplate extends BaseTemplate {
@@ -63,6 +63,11 @@ interface GoalTemplate extends BaseTemplate {
63
63
  amount: number;
64
64
  }
65
65
 
66
+ interface CopyTemplate extends BaseTemplate {
67
+ type: 'copy';
68
+ lookBack: number;
69
+ }
70
+
66
71
  interface ErrorTemplate extends BaseTemplate {
67
72
  type: 'error';
68
73
  line: string;
@@ -79,4 +84,5 @@ export type Template =
79
84
  | RemainderTemplate
80
85
  | AverageTemplate
81
86
  | GoalTemplate
87
+ | CopyTemplate
82
88
  | ErrorTemplate;
@@ -4,7 +4,7 @@ export declare const app: {
4
4
  handlers: Handlers;
5
5
  services: any;
6
6
  unlistenServices: any;
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" | "envelope-budget-month" | "tracking-budget-month" | "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/budget-hold-for-next-month" | "api/budget-reset-hold" | "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" | "dashboard-update" | "dashboard-update-widget" | "dashboard-reset" | "dashboard-add-widget" | "dashboard-remove-widget" | "dashboard-import" | "filter-create" | "filter-update" | "filter-delete" | "notes-save" | "preferences/save" | "preferences/get" | "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" | "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" | "envelope-budget-month" | "tracking-budget-month" | "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-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" | "simplefin-batch-sync" | "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/budget-hold-for-next-month" | "api/budget-reset-hold" | "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" | "budget/apply-multiple-templates" | "dashboard-update" | "dashboard-update-widget" | "dashboard-reset" | "dashboard-add-widget" | "dashboard-remove-widget" | "dashboard-import" | "filter-create" | "filter-update" | "filter-delete" | "notes-save" | "preferences/save" | "preferences/get" | "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,6 +1,8 @@
1
1
  import type { MetadataPrefs } from '../types/prefs';
2
2
  export declare const BUDGET_TYPES: readonly ["report", "rollover"];
3
3
  export type BudgetType = (typeof BUDGET_TYPES)[number];
4
+ export declare const UPCOMING_SCHEDULED_TRANSACTION_LENGTHS: readonly ["1", "7", "14", "30"];
5
+ export type UpcomingScheduledTransactionLength = (typeof UPCOMING_SCHEDULED_TRANSACTION_LENGTHS)[number];
4
6
  export declare function loadPrefs(id?: string): Promise<MetadataPrefs>;
5
7
  export declare function savePrefs(prefsToSet: MetadataPrefs, { avoidSync }?: {
6
8
  avoidSync?: boolean;
@@ -5,6 +5,7 @@ type ServerConfig = {
5
5
  GOCARDLESS_SERVER: string;
6
6
  SIMPLEFIN_SERVER: string;
7
7
  };
8
+ export declare function isValidBaseURL(base: string): boolean;
8
9
  export declare function setServer(url: string): void;
9
10
  export declare function getServer(url?: string): ServerConfig | null;
10
11
  export {};
@@ -54,7 +54,7 @@ export declare function getYearStart(month: string): string;
54
54
  export declare function getYearEnd(month: string): string;
55
55
  export declare function sheetForMonth(month: string): string;
56
56
  export declare function nameForMonth(month: DateLike): string;
57
- export declare function format(month: DateLike, str: string): string;
57
+ export declare function format(month: DateLike, format: string): string;
58
58
  export declare const getDateFormatRegex: import("memoize-one").MemoizedFn<(format: string) => RegExp>;
59
59
  export declare const getDayMonthFormat: import("memoize-one").MemoizedFn<(format: string) => string>;
60
60
  export declare const getDayMonthRegex: import("memoize-one").MemoizedFn<(format: string) => RegExp>;
@@ -1,8 +1,14 @@
1
+ import { WithRequired } from '../types/util';
2
+ type ObjectExpression = {
3
+ [key: string]: ObjectExpression | unknown;
4
+ };
1
5
  export type QueryState = {
2
- filterExpressions: Array<string>;
3
- selectExpressions: Array<unknown>;
4
- groupExpressions: Array<unknown>;
5
- orderExpressions: Array<unknown>;
6
+ table: string;
7
+ tableOptions: Record<string, unknown>;
8
+ filterExpressions: Array<ObjectExpression>;
9
+ selectExpressions: Array<ObjectExpression | string | '*'>;
10
+ groupExpressions: Array<ObjectExpression | string>;
11
+ orderExpressions: Array<ObjectExpression | string>;
6
12
  calculation: boolean;
7
13
  rawMode: boolean;
8
14
  withDead: boolean;
@@ -12,20 +18,28 @@ export type QueryState = {
12
18
  };
13
19
  export declare class Query {
14
20
  state: QueryState;
15
- constructor(state: any);
16
- filter(expr: any): Query;
17
- unfilter(exprs: any): Query;
18
- select(exprs?: Array<unknown> | unknown): Query;
19
- calculate(expr: any): Query;
20
- groupBy(exprs: any): Query;
21
- orderBy(exprs: any): Query;
22
- limit(num: any): Query;
23
- offset(num: any): Query;
21
+ constructor(state: WithRequired<Partial<QueryState>, 'table'>);
22
+ filter(expr: ObjectExpression): Query;
23
+ unfilter(exprs?: Array<keyof ObjectExpression>): Query;
24
+ select(exprs?: Array<ObjectExpression | string> | ObjectExpression | string | '*' | ['*']): Query;
25
+ calculate(expr: ObjectExpression | string): Query;
26
+ groupBy(exprs: ObjectExpression | string | Array<ObjectExpression | string>): Query;
27
+ orderBy(exprs: ObjectExpression | string | Array<ObjectExpression | string>): Query;
28
+ limit(num: number): Query;
29
+ offset(num: number): Query;
24
30
  raw(): Query;
25
31
  withDead(): Query;
26
32
  withoutValidatedRefs(): Query;
27
- options(opts: any): Query;
33
+ options(opts: Record<string, unknown>): Query;
34
+ reset(): Query;
28
35
  serialize(): QueryState;
29
36
  }
30
- export declare function getPrimaryOrderBy(query: any, defaultOrderBy: any): any;
31
- export declare function q(table: any): Query;
37
+ export declare function getPrimaryOrderBy(query: Query, defaultOrderBy: ObjectExpression | null): {
38
+ order: string;
39
+ field?: undefined;
40
+ } | {
41
+ field: string;
42
+ order: unknown;
43
+ };
44
+ export declare function q(table: QueryState['table']): Query;
45
+ export {};
@@ -1,6 +1,6 @@
1
1
  import { FieldValueTypes, RuleConditionOp } from '../types/models';
2
2
  export declare const FIELD_TYPES: Map<keyof FieldValueTypes, string>;
3
- export declare function isValidOp(field: keyof FieldValueTypes, op: RuleConditionOp): boolean;
3
+ export declare function isValidOp(field: keyof FieldValueTypes, op: RuleConditionOp): any;
4
4
  export declare function getValidOps(field: keyof FieldValueTypes): any;
5
5
  export declare const ALLOCATION_METHODS: {
6
6
  'fixed-amount': string;
@@ -8,7 +8,7 @@ export declare const ALLOCATION_METHODS: {
8
8
  remainder: string;
9
9
  };
10
10
  export declare function mapField(field: any, opts?: any): any;
11
- export declare function friendlyOp(op: any, type?: any): "" | "is" | "contains" | "matches" | "one of" | "not one of" | "is not" | "is approx" | "is between" | "has tag(s)" | "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" | "prepend to notes" | "append to notes" | "and" | "or";
11
+ export declare function friendlyOp(op: any, type?: any): string;
12
12
  export declare function deserializeField(field: any): {
13
13
  field: string;
14
14
  options: {
@@ -25,7 +25,7 @@ export declare function deserializeField(field: any): {
25
25
  field: any;
26
26
  options?: undefined;
27
27
  };
28
- export declare function getFieldError(type: any): "Invalid date format" | "Value cannot be empty" | "Value must be a string" | "Value must be a boolean" | "Value must be a number" | "Please choose a valid field for this type of rule" | "Internal error, sorry! Please get in touch https://actualbudget.org/contact/ for support";
28
+ export declare function getFieldError(type: any): "Invalid date format" | "Value cannot be empty" | "Value must be a string" | "Value must be a boolean" | "Value must be a number" | "Please choose a valid field for this type of rule" | "Invalid handlebars template" | "Internal error, sorry! Please get in touch https://actualbudget.org/contact/ for support";
29
29
  export declare function sortNumbers(num1: any, num2: any): any[];
30
30
  export declare function parse(item: any): any;
31
31
  export declare function unparse({ error, inputKey, ...item }: {
@@ -1,5 +1,5 @@
1
1
  import type { IRuleOptions } from '@rschedule/core';
2
- export declare function getStatus(nextDate: string, completed: boolean, hasTrans: boolean): "completed" | "paid" | "due" | "upcoming" | "missed" | "scheduled";
2
+ export declare function getStatus(nextDate: string, completed: boolean, hasTrans: boolean, upcomingLength: string): "completed" | "paid" | "due" | "upcoming" | "missed" | "scheduled";
3
3
  export declare function getHasTransactionsQuery(schedules: any): import("./query").Query;
4
4
  export declare function getRecurringDescription(config: any, dateFormat: any): string;
5
5
  export declare function recurConfigToRSchedule(config: any): IRuleOptions[] | ({
@@ -39,5 +39,8 @@ export declare function extractScheduleConds(conditions: any): {
39
39
  amount: any;
40
40
  date: any;
41
41
  };
42
- export declare function getScheduledAmount(amount: any): any;
42
+ export declare function getScheduledAmount(amount: number | {
43
+ num1: number;
44
+ num2: number;
45
+ }, inverse?: boolean): number;
43
46
  export declare function describeSchedule(schedule: any, payee: any): string;
@@ -20,9 +20,7 @@ export declare function diffItems<T extends {
20
20
  }>(items: T[], newItems: T[]): Diff<T>;
21
21
  export declare function groupById<T extends {
22
22
  id: string;
23
- }>(data: T[]): {
24
- [key: string]: T;
25
- };
23
+ }>(data: T[]): Record<string, T>;
26
24
  export declare function setIn(map: Map<string, unknown>, keys: string[], item: unknown): void;
27
25
  export declare function getIn(map: any, keys: any): any;
28
26
  export declare function fastSetMerge<T>(set1: Set<T>, set2: Set<T>): Set<T>;
@@ -0,0 +1,21 @@
1
+ import {
2
+ GoCardlessAmount,
3
+ GoCardlessBalance,
4
+ GoCardlessTransaction,
5
+ } from './gocardless';
6
+
7
+ export type BankSyncBalance = GoCardlessBalance;
8
+ export type BankSyncAmount = GoCardlessAmount;
9
+ export type BankSyncTransaction = GoCardlessTransaction;
10
+
11
+ export type BankSyncResponse = {
12
+ transactions: {
13
+ all: BankSyncTransaction[];
14
+ booked: BankSyncTransaction[];
15
+ pending: BankSyncTransaction[];
16
+ };
17
+ balances: BankSyncBalance[];
18
+ startingBalance: number;
19
+ error_type: string;
20
+ error_code: string;
21
+ };
@@ -37,6 +37,7 @@ export type CashFlowWidget = AbstractWidget<
37
37
  conditions?: RuleConditionEntity[];
38
38
  conditionsOp?: 'and' | 'or';
39
39
  timeFrame?: TimeFrame;
40
+ showBalance?: boolean;
40
41
  } | null
41
42
  >;
42
43
  export type SpendingWidget = AbstractWidget<
@@ -64,7 +65,8 @@ type SpecializedWidget =
64
65
  | NetWorthWidget
65
66
  | CashFlowWidget
66
67
  | SpendingWidget
67
- | MarkdownWidget;
68
+ | MarkdownWidget
69
+ | SummaryWidget;
68
70
  export type Widget = SpecializedWidget | CustomReportWidget;
69
71
  export type NewWidget = Omit<Widget, 'id' | 'tombstone'>;
70
72
 
@@ -87,3 +89,29 @@ export type ExportImportDashboard = {
87
89
  version: 1;
88
90
  widgets: ExportImportDashboardWidget[];
89
91
  };
92
+
93
+ export type SummaryWidget = AbstractWidget<
94
+ 'summary-card',
95
+ {
96
+ name?: string;
97
+ conditions?: RuleConditionEntity[];
98
+ conditionsOp?: 'and' | 'or';
99
+ timeFrame?: TimeFrame;
100
+ content?: string;
101
+ } | null
102
+ >;
103
+
104
+ export type BaseSummaryContent = {
105
+ type: 'sum' | 'avgPerMonth' | 'avgPerTransact';
106
+ fontSize?: number;
107
+ };
108
+
109
+ export type PercentageSummaryContent = {
110
+ type: 'percentage';
111
+ divisorConditions: RuleConditionEntity[];
112
+ divisorConditionsOp: 'and' | 'or';
113
+ divisorAllTimeDateRange?: boolean;
114
+ fontSize?: number;
115
+ };
116
+
117
+ export type SummaryContent = BaseSummaryContent | PercentageSummaryContent;
@@ -12,3 +12,64 @@ export type GoCardlessInstitution = {
12
12
  logo: string;
13
13
  identification_codes: string[];
14
14
  };
15
+
16
+ export type GoCardlessBalance = {
17
+ balanceAmount: GoCardlessAmount;
18
+ balanceType:
19
+ | 'closingBooked'
20
+ | 'expected'
21
+ | 'forwardAvailable'
22
+ | 'interimAvailable'
23
+ | 'interimBooked'
24
+ | 'nonInvoiced'
25
+ | 'openingBooked';
26
+ creditLimitIncluded?: boolean;
27
+ lastChangeDateTime?: string;
28
+ lastCommittedTransaction?: string;
29
+ referenceDate?: string;
30
+ };
31
+
32
+ export type GoCardlessAmount = {
33
+ amount: string;
34
+ currency: string;
35
+ };
36
+
37
+ export type GoCardlessTransaction = {
38
+ additionalInformation?: string;
39
+ bookingStatus?: string;
40
+ balanceAfterTransaction?: Pick<
41
+ GoCardlessBalance,
42
+ 'balanceType' | 'balanceAmount'
43
+ >;
44
+ bankTransactionCode?: string;
45
+ bookingDate?: string;
46
+ bookingDateTime?: string;
47
+ checkId?: string;
48
+ creditorAccount?: string;
49
+ creditorAgent?: string;
50
+ creditorId?: string;
51
+ creditorName?: string;
52
+ currencyExchange?: string[];
53
+ debtorAccount?: {
54
+ iban: string;
55
+ };
56
+ debtorAgent?: string;
57
+ debtorName?: string;
58
+ endToEndId?: string;
59
+ entryReference?: string;
60
+ internalTransactionId?: string;
61
+ mandateId?: string;
62
+ merchantCategoryCode?: string;
63
+ proprietaryBankTransactionCode?: string;
64
+ purposeCode?: string;
65
+ remittanceInformationStructured?: string;
66
+ remittanceInformationStructuredArray?: string[];
67
+ remittanceInformationUnstructured?: string;
68
+ remittanceInformationUnstructuredArray?: string[];
69
+ transactionAmount: GoCardlessAmount;
70
+ transactionId?: string;
71
+ ultimateCreditor?: string;
72
+ ultimateDebtor?: string;
73
+ valueDate?: string;
74
+ valueDateTime?: string;
75
+ };
@@ -1,4 +1,5 @@
1
1
  export type * from './account';
2
+ export type * from './bank-sync';
2
3
  export type * from './category';
3
4
  export type * from './category-group';
4
5
  export type * from './dashboard';