@actual-app/api 6.8.2 → 6.10.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 (77) hide show
  1. package/@types/jest.config.d.ts +7 -7
  2. package/@types/loot-core/client/constants.d.ts +2 -0
  3. package/@types/loot-core/client/state-types/index.d.ts +1 -1
  4. package/@types/loot-core/client/state-types/modals.d.ts +27 -8
  5. package/@types/loot-core/client/state-types/notifications.d.ts +18 -1
  6. package/@types/loot-core/client/state-types/prefs.d.ts +9 -4
  7. package/@types/loot-core/client/state-types/queries.d.ts +8 -0
  8. package/@types/loot-core/server/accounts/parse-file.d.ts +1 -0
  9. package/@types/loot-core/server/accounts/rules.d.ts +2 -2
  10. package/@types/loot-core/server/accounts/sync.d.ts +12 -1
  11. package/@types/loot-core/server/accounts/transaction-rules.d.ts +1 -3
  12. package/@types/loot-core/server/accounts/transactions.d.ts +3 -5
  13. package/@types/loot-core/server/api-models.d.ts +21 -6
  14. package/@types/loot-core/server/aql/schema/index.d.ts +41 -3
  15. package/@types/loot-core/server/budget/actions.d.ts +2 -1
  16. package/@types/loot-core/server/budget/statements.d.ts +9 -0
  17. package/@types/loot-core/server/budget/template-notes.d.ts +5 -0
  18. package/@types/loot-core/server/budget/types/templates.d.ts +82 -0
  19. package/@types/loot-core/server/cloud-storage.d.ts +0 -1
  20. package/@types/loot-core/server/dashboard/app.d.ts +12 -0
  21. package/@types/loot-core/server/dashboard/types/handlers.d.ts +24 -0
  22. package/@types/loot-core/server/db/index.d.ts +4 -2
  23. package/@types/loot-core/server/db/types.d.ts +9 -0
  24. package/@types/loot-core/server/encryption-internals.d.ts +0 -1
  25. package/@types/loot-core/server/encryption-internals.web.d.ts +0 -1
  26. package/@types/loot-core/server/encryption.d.ts +0 -1
  27. package/@types/loot-core/server/errors.d.ts +2 -0
  28. package/@types/loot-core/server/importers/actual.d.ts +0 -1
  29. package/@types/loot-core/server/importers/index.d.ts +0 -1
  30. package/@types/loot-core/server/importers/ynab4.d.ts +0 -1
  31. package/@types/loot-core/server/importers/ynab5.d.ts +0 -1
  32. package/@types/loot-core/server/main-app.d.ts +1 -1
  33. package/@types/loot-core/server/models.d.ts +4 -4
  34. package/@types/loot-core/server/prefs.d.ts +7 -2
  35. package/@types/loot-core/server/reports/app.d.ts +46 -0
  36. package/@types/loot-core/server/rules/types/handlers.d.ts +4 -6
  37. package/@types/loot-core/server/sync/make-test-message.d.ts +0 -1
  38. package/@types/loot-core/shared/dashboard.d.ts +2 -0
  39. package/@types/loot-core/shared/months.d.ts +7 -6
  40. package/@types/loot-core/shared/normalisation.d.ts +1 -0
  41. package/@types/loot-core/shared/rules.d.ts +5 -1
  42. package/@types/loot-core/shared/schedules.d.ts +22 -22
  43. package/@types/loot-core/shared/transactions.d.ts +26 -75
  44. package/@types/loot-core/shared/util.d.ts +10 -13
  45. package/@types/loot-core/types/api-handlers.d.ts +29 -3
  46. package/@types/loot-core/types/file.d.ts +2 -0
  47. package/@types/loot-core/types/handlers.d.ts +2 -0
  48. package/@types/loot-core/types/models/category-group.d.ts +6 -2
  49. package/@types/loot-core/types/models/category.d.ts +4 -2
  50. package/@types/loot-core/types/models/dashboard.d.ts +56 -0
  51. package/@types/loot-core/types/models/index.d.ts +1 -0
  52. package/@types/loot-core/types/models/payee.d.ts +6 -7
  53. package/@types/loot-core/types/models/reports.d.ts +12 -5
  54. package/@types/loot-core/types/models/rule.d.ts +100 -7
  55. package/@types/loot-core/types/models/transaction.d.ts +12 -25
  56. package/@types/loot-core/types/prefs.d.ts +50 -26
  57. package/@types/loot-core/types/server-handlers.d.ts +13 -8
  58. package/@types/loot-core/types/util.d.ts +4 -0
  59. package/@types/methods.d.ts +8 -11
  60. package/@types/migrations/1722717601000_reports_move_selected_categories.d.ts +1 -0
  61. package/@types/migrations/1722804019000_create_dashboard_table.d.ts +1 -0
  62. package/dist/app/bundle.api.js +5544 -1857
  63. package/dist/app/query.js +1 -2
  64. package/dist/index.js +3 -3
  65. package/dist/injected.js +2 -2
  66. package/dist/methods.js +65 -41
  67. package/dist/methods.test.js +23 -15
  68. package/dist/migrations/1632571489012_remove_cache.js +1 -1
  69. package/dist/migrations/1720310586000_link_transfer_schedules.sql +19 -0
  70. package/dist/migrations/1720664867241_add_payee_favorite.sql +5 -0
  71. package/dist/migrations/1720665000000_goal_context.sql +6 -0
  72. package/dist/migrations/1722717601000_reports_move_selected_categories.js +39 -0
  73. package/dist/migrations/1722804019000_create_dashboard_table.js +38 -0
  74. package/dist/package.json +2 -2
  75. package/dist/utils.js +2 -3
  76. package/dist/validateNodeVersion.js +1 -2
  77. package/package.json +2 -2
@@ -40,6 +40,8 @@ export declare class SyncError extends Error {
40
40
  };
41
41
  });
42
42
  }
43
+ export declare class ValidationError extends Error {
44
+ }
43
45
  export declare class TransactionError extends Error {
44
46
  }
45
47
  export declare class RuleError extends Error {
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  export declare function importActual(_filepath: string, buffer: Buffer): Promise<{
3
2
  error: any;
4
3
  }>;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  type ImportableBudgetType = 'ynab4' | 'ynab5' | 'actual';
3
2
  export declare function handleBudgetImport(type: ImportableBudgetType, filepath: string, buffer: Buffer): Promise<{
4
3
  error: any;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { YNAB4 } from './ynab4-types';
3
2
  export declare function doImport(data: YNAB4.YFull): Promise<void>;
4
3
  export declare function getBudgetName(filepath: any): string;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { YNAB5 } from './ynab5-types';
3
2
  export declare function doImport(data: YNAB5.Budget): Promise<void>;
4
3
  export declare function parseFile(buffer: Buffer): YNAB5.Budget;
@@ -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/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;
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/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" | "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;
@@ -12,10 +12,10 @@ export declare const categoryModel: {
12
12
  update?: boolean;
13
13
  }): {
14
14
  hidden: number;
15
- id?: string;
15
+ id: string;
16
16
  name: string;
17
17
  is_income?: boolean;
18
- cat_group?: string;
18
+ cat_group?: CategoryGroupEntity["id"];
19
19
  tombstone?: boolean;
20
20
  };
21
21
  };
@@ -24,11 +24,11 @@ export declare const categoryGroupModel: {
24
24
  update?: boolean;
25
25
  }): {
26
26
  hidden: number;
27
- id?: string;
27
+ id: string;
28
+ categories?: CategoryEntity[];
28
29
  name: string;
29
30
  is_income?: boolean;
30
31
  tombstone?: boolean;
31
- categories?: CategoryEntity[];
32
32
  };
33
33
  };
34
34
  export declare const payeeModel: {
@@ -1,4 +1,5 @@
1
- import type { LocalPrefs } from '../types/prefs';
1
+ import type { MetadataPrefs, SyncedPrefs } from '../types/prefs';
2
+ type LocalPrefs = MetadataPrefs & Pick<SyncedPrefs, 'budgetType'>;
2
3
  export declare const BUDGET_TYPES: readonly ["report", "rollover"];
3
4
  export type BudgetType = (typeof BUDGET_TYPES)[number];
4
5
  export declare function loadPrefs(id?: string): Promise<LocalPrefs>;
@@ -7,4 +8,8 @@ export declare function savePrefs(prefsToSet: LocalPrefs, { avoidSync }?: {
7
8
  }): Promise<void>;
8
9
  export declare function unloadPrefs(): void;
9
10
  export declare function getPrefs(): LocalPrefs;
10
- export declare function getDefaultPrefs(id: string, budgetName: string): LocalPrefs;
11
+ export declare function getDefaultPrefs(id: string, budgetName: string): {
12
+ id: string;
13
+ budgetName: string;
14
+ };
15
+ export {};
@@ -1,4 +1,50 @@
1
+ import { type CustomReportData, type CustomReportEntity } from '../../types/models';
1
2
  import { ReportsHandlers } from './types/handlers';
3
+ export declare const reportModel: {
4
+ validate(report: Omit<CustomReportEntity, "tombstone">, { update }?: {
5
+ update?: boolean;
6
+ }): Omit<CustomReportEntity, "tombstone">;
7
+ toJS(row: CustomReportData): {
8
+ id: string;
9
+ name: string;
10
+ startDate: string;
11
+ endDate: string;
12
+ isDateStatic: boolean;
13
+ dateRange: string;
14
+ mode: string;
15
+ groupBy: string;
16
+ interval: string;
17
+ balanceType: string;
18
+ showEmpty: boolean;
19
+ showOffBudget: boolean;
20
+ showHiddenCategories: boolean;
21
+ showUncategorized: boolean;
22
+ includeCurrentInterval: boolean;
23
+ graphType: string;
24
+ conditions: import("../../types/models").RuleConditionEntity[];
25
+ conditionsOp: "and" | "or";
26
+ };
27
+ fromJS(report: CustomReportEntity): {
28
+ id: string;
29
+ name: string;
30
+ start_date: string;
31
+ end_date: string;
32
+ date_static: number;
33
+ date_range: string;
34
+ mode: string;
35
+ group_by: string;
36
+ interval: string;
37
+ balance_type: string;
38
+ show_empty: number;
39
+ show_offbudget: number;
40
+ show_hidden: number;
41
+ show_uncategorized: number;
42
+ include_current: number;
43
+ graph_type: string;
44
+ conditions: import("../../types/models").RuleConditionEntity[];
45
+ conditions_op: "and" | "or";
46
+ };
47
+ };
2
48
  export declare const app: {
3
49
  events: any;
4
50
  handlers: ReportsHandlers;
@@ -10,13 +10,11 @@ export interface RulesHandlers {
10
10
  }>;
11
11
  'rule-add': (rule: Omit<RuleEntity, 'id'>) => Promise<{
12
12
  error: ValidationError;
13
- } | {
14
- id: string;
15
- }>;
16
- 'rule-update': (rule: Partial<RuleEntity>) => Promise<{
13
+ } | RuleEntity>;
14
+ 'rule-update': <PartialRule extends Partial<Omit<RuleEntity, 'id'>> & Pick<RuleEntity, 'id'>>(rule: PartialRule) => Promise<{
17
15
  error: ValidationError;
18
- } | object>;
19
- 'rule-delete': (rule: Required<RuleEntity>) => Promise<false | void>;
16
+ } | PartialRule>;
17
+ 'rule-delete': (id: string) => Promise<boolean>;
20
18
  'rule-delete-all': (ids: string[]) => Promise<{
21
19
  someDeletionsFailed: boolean;
22
20
  }>;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  export declare function makeTestMessage(keyId: any): Promise<{
3
2
  value: Buffer;
4
3
  meta: {
@@ -0,0 +1,2 @@
1
+ import { type NewWidget } from '../types/models';
2
+ export declare const DEFAULT_DASHBOARD_STATE: NewWidget[];
@@ -1,13 +1,13 @@
1
- import { type LocalPrefs } from '../types/prefs';
1
+ import { type SyncedPrefs } from '../types/prefs';
2
2
  type DateLike = string | Date;
3
3
  export declare function _parse(value: DateLike): Date;
4
4
  export declare const parseDate: typeof _parse;
5
5
  export declare function yearFromDate(date: DateLike): string;
6
6
  export declare function monthFromDate(date: DateLike): string;
7
- export declare function weekFromDate(date: DateLike, firstDayOfWeekIdx: LocalPrefs['firstDayOfWeekIdx']): string;
7
+ export declare function weekFromDate(date: DateLike, firstDayOfWeekIdx: SyncedPrefs['firstDayOfWeekIdx']): string;
8
8
  export declare function dayFromDate(date: DateLike): string;
9
9
  export declare function currentMonth(): string;
10
- export declare function currentWeek(firstDayOfWeekIdx?: LocalPrefs['firstDayOfWeekIdx']): string;
10
+ export declare function currentWeek(firstDayOfWeekIdx?: SyncedPrefs['firstDayOfWeekIdx']): string;
11
11
  export declare function currentYear(): string;
12
12
  export declare function currentDate(): Date;
13
13
  export declare function currentDay(): string;
@@ -26,14 +26,15 @@ export declare function addDays(day: DateLike, n: number): string;
26
26
  export declare function subDays(day: DateLike, n: number): string;
27
27
  export declare function isBefore(month1: DateLike, month2: DateLike): boolean;
28
28
  export declare function isAfter(month1: DateLike, month2: DateLike): boolean;
29
+ export declare function isCurrentMonth(month: DateLike): boolean;
29
30
  export declare function bounds(month: DateLike): {
30
31
  start: number;
31
32
  end: number;
32
33
  };
33
34
  export declare function _yearRange(start: DateLike, end: DateLike, inclusive?: boolean): string[];
34
35
  export declare function yearRangeInclusive(start: DateLike, end: DateLike): string[];
35
- export declare function _weekRange(start: DateLike, end: DateLike, inclusive?: boolean, firstDayOfWeekIdx?: LocalPrefs['firstDayOfWeekIdx']): string[];
36
- export declare function weekRangeInclusive(start: DateLike, end: DateLike, firstDayOfWeekIdx?: LocalPrefs['firstDayOfWeekIdx']): string[];
36
+ export declare function _weekRange(start: DateLike, end: DateLike, inclusive?: boolean, firstDayOfWeekIdx?: SyncedPrefs['firstDayOfWeekIdx']): string[];
37
+ export declare function weekRangeInclusive(start: DateLike, end: DateLike, firstDayOfWeekIdx?: SyncedPrefs['firstDayOfWeekIdx']): string[];
37
38
  export declare function _range(start: DateLike, end: DateLike, inclusive?: boolean): string[];
38
39
  export declare function range(start: DateLike, end: DateLike): string[];
39
40
  export declare function rangeInclusive(start: DateLike, end: DateLike): string[];
@@ -46,7 +47,7 @@ export declare function getYear(month: string): string;
46
47
  export declare function getMonth(day: string): string;
47
48
  export declare function getDay(day: string): number;
48
49
  export declare function getMonthEnd(day: string): string;
49
- export declare function getWeekEnd(date: DateLike, firstDayOfWeekIdx?: LocalPrefs['firstDayOfWeekIdx']): string;
50
+ export declare function getWeekEnd(date: DateLike, firstDayOfWeekIdx?: SyncedPrefs['firstDayOfWeekIdx']): string;
50
51
  export declare function getYearStart(month: string): string;
51
52
  export declare function getYearEnd(month: string): string;
52
53
  export declare function sheetForMonth(month: string): string;
@@ -0,0 +1 @@
1
+ export declare function getNormalisedString(value: string): string;
@@ -15,6 +15,10 @@ export declare const TYPE_INFO: {
15
15
  ops: string[];
16
16
  nullable: boolean;
17
17
  };
18
+ imported_payee: {
19
+ ops: string[];
20
+ nullable: boolean;
21
+ };
18
22
  number: {
19
23
  ops: string[];
20
24
  nullable: boolean;
@@ -31,7 +35,7 @@ export declare const ALLOCATION_METHODS: {
31
35
  remainder: string;
32
36
  };
33
37
  export declare function mapField(field: any, opts?: any): any;
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";
38
+ 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";
35
39
  export declare function deserializeField(field: any): {
36
40
  field: string;
37
41
  options: {
@@ -4,34 +4,34 @@ export declare function getHasTransactionsQuery(schedules: any): import("./query
4
4
  export declare function getRecurringDescription(config: any, dateFormat: any): string;
5
5
  export declare function recurConfigToRSchedule(config: any): IRuleOptions[] | ({
6
6
  byDayOfMonth: any;
7
- start: import("@rschedule/core").DateInput;
8
- end?: import("@rschedule/core").DateInput;
9
- duration?: number;
10
- count?: number;
7
+ start: import("@rschedule/core").RuleOption.Start;
8
+ end?: import("@rschedule/core").RuleOption.End;
9
+ duration?: import("@rschedule/core").RuleOption.Duration;
10
+ count?: import("@rschedule/core").RuleOption.Count;
11
11
  frequency: import("@rschedule/core").RuleOption.Frequency;
12
- interval?: number;
13
- weekStart?: import("@rschedule/core").DateAdapter.Weekday;
12
+ interval?: import("@rschedule/core").RuleOption.Interval;
13
+ weekStart?: import("@rschedule/core").RuleOption.WeekStart;
14
14
  byDayOfWeek?: import("@rschedule/core").RuleOption.ByDayOfWeek[];
15
- byHourOfDay?: import("@rschedule/core").DateAdapter.Hour[];
16
- byMillisecondOfSecond?: number[];
17
- byMinuteOfHour?: import("@rschedule/core").DateAdapter.Minute[];
18
- byMonthOfYear?: import("@rschedule/core").DateAdapter.Month[];
19
- bySecondOfMinute?: import("@rschedule/core").DateAdapter.Minute[];
15
+ byHourOfDay?: import("@rschedule/core").RuleOption.ByHourOfDay[];
16
+ byMillisecondOfSecond?: import("@rschedule/core").RuleOption.ByMillisecondOfSecond[];
17
+ byMinuteOfHour?: import("@rschedule/core").RuleOption.ByMinuteOfHour[];
18
+ byMonthOfYear?: import("@rschedule/core").RuleOption.ByMonthOfYear[];
19
+ bySecondOfMinute?: import("@rschedule/core").RuleOption.BySecondOfMinute[];
20
20
  } | {
21
21
  byDayOfWeek: any;
22
- start: import("@rschedule/core").DateInput;
23
- end?: import("@rschedule/core").DateInput;
24
- duration?: number;
25
- count?: number;
22
+ start: import("@rschedule/core").RuleOption.Start;
23
+ end?: import("@rschedule/core").RuleOption.End;
24
+ duration?: import("@rschedule/core").RuleOption.Duration;
25
+ count?: import("@rschedule/core").RuleOption.Count;
26
26
  frequency: import("@rschedule/core").RuleOption.Frequency;
27
- interval?: number;
28
- weekStart?: import("@rschedule/core").DateAdapter.Weekday;
27
+ interval?: import("@rschedule/core").RuleOption.Interval;
28
+ weekStart?: import("@rschedule/core").RuleOption.WeekStart;
29
29
  byDayOfMonth?: import("@rschedule/core").RuleOption.ByDayOfMonth[];
30
- byHourOfDay?: import("@rschedule/core").DateAdapter.Hour[];
31
- byMillisecondOfSecond?: number[];
32
- byMinuteOfHour?: import("@rschedule/core").DateAdapter.Minute[];
33
- byMonthOfYear?: import("@rschedule/core").DateAdapter.Month[];
34
- bySecondOfMinute?: import("@rschedule/core").DateAdapter.Minute[];
30
+ byHourOfDay?: import("@rschedule/core").RuleOption.ByHourOfDay[];
31
+ byMillisecondOfSecond?: import("@rschedule/core").RuleOption.ByMillisecondOfSecond[];
32
+ byMinuteOfHour?: import("@rschedule/core").RuleOption.ByMinuteOfHour[];
33
+ byMonthOfYear?: import("@rschedule/core").RuleOption.ByMonthOfYear[];
34
+ bySecondOfMinute?: import("@rschedule/core").RuleOption.BySecondOfMinute[];
35
35
  })[];
36
36
  export declare function extractScheduleConds(conditions: any): {
37
37
  payee: any;
@@ -1,5 +1,5 @@
1
- import { type TransactionEntity, type NewTransactionEntity } from '../types/models';
2
- import { applyChanges } from './util';
1
+ import { type TransactionEntity } from '../types/models';
2
+ import { diffItems, applyChanges } from './util';
3
3
  interface TransactionEntityWithError extends TransactionEntity {
4
4
  error: ReturnType<typeof SplitTransactionError> | null;
5
5
  _deleted?: boolean;
@@ -11,7 +11,7 @@ declare function SplitTransactionError(total: number, parent: TransactionEntity)
11
11
  version: number;
12
12
  difference: number;
13
13
  };
14
- type GenericTransactionEntity = NewTransactionEntity | TransactionEntity | TransactionEntityWithError;
14
+ type GenericTransactionEntity = TransactionEntity | TransactionEntityWithError;
15
15
  export declare function makeChild<T extends GenericTransactionEntity>(parent: T, data?: object): T;
16
16
  export declare function recalculateSplit(trans: TransactionEntity): TransactionEntityWithError;
17
17
  export declare function ungroupTransactions(transactions: TransactionEntity[]): TransactionEntity[];
@@ -19,98 +19,49 @@ export declare function groupTransaction(split: TransactionEntity[]): Transactio
19
19
  export declare function ungroupTransaction(split: TransactionEntity | null): TransactionEntity[];
20
20
  export declare function applyTransactionDiff(groupedTrans: Parameters<typeof ungroupTransaction>[0], diff: Parameters<typeof applyChanges>[0]): TransactionEntity;
21
21
  export declare function addSplitTransaction(transactions: TransactionEntity[], id: string): {
22
- data: any[];
23
- diff: {
24
- deleted: any[];
25
- updated: any[];
26
- };
27
- newTransaction?: undefined;
28
- } | {
29
22
  data: TransactionEntity[];
30
- newTransaction: TransactionEntityWithError | TransactionEntity;
31
- diff: any;
23
+ newTransaction: TransactionEntity | TransactionEntityWithError | null;
24
+ diff: ReturnType<typeof diffItems<TransactionEntity>>;
32
25
  };
33
26
  export declare function updateTransaction(transactions: TransactionEntity[], transaction: TransactionEntity): {
34
- data: any[];
35
- diff: {
36
- deleted: any[];
37
- updated: any[];
38
- };
39
- newTransaction?: undefined;
40
- } | {
41
27
  data: TransactionEntity[];
42
- newTransaction: TransactionEntityWithError | TransactionEntity;
43
- diff: any;
28
+ newTransaction: TransactionEntity | TransactionEntityWithError | null;
29
+ diff: ReturnType<typeof diffItems<TransactionEntity>>;
44
30
  };
45
31
  export declare function deleteTransaction(transactions: TransactionEntity[], id: string): {
46
- data: any[];
47
- diff: {
48
- deleted: any[];
49
- updated: any[];
50
- };
51
- newTransaction?: undefined;
52
- } | {
53
32
  data: TransactionEntity[];
54
- newTransaction: TransactionEntityWithError | TransactionEntity;
55
- diff: any;
33
+ newTransaction: TransactionEntity | TransactionEntityWithError | null;
34
+ diff: ReturnType<typeof diffItems<TransactionEntity>>;
56
35
  };
57
36
  export declare function splitTransaction(transactions: TransactionEntity[], id: string, createSubtransactions?: (parentTransaction: TransactionEntity) => TransactionEntity[]): {
58
- data: any[];
59
- diff: {
60
- deleted: any[];
61
- updated: any[];
62
- };
63
- newTransaction?: undefined;
64
- } | {
65
37
  data: TransactionEntity[];
66
- newTransaction: TransactionEntityWithError | TransactionEntity;
67
- diff: any;
38
+ newTransaction: TransactionEntity | TransactionEntityWithError | null;
39
+ diff: ReturnType<typeof diffItems<TransactionEntity>>;
68
40
  };
69
- export declare function realizeTempTransactions(transactions: TransactionEntity[]): {
70
- id: string;
71
- account: import("../types/models").AccountEntity;
72
- category?: import("../types/models").CategoryEntity;
73
- payee?: import("../types/models").PayeeEntity;
74
- schedule?: import("../types/models").ScheduleEntity;
75
- subtransactions?: TransactionEntity[];
76
- sort_order?: number;
77
- tombstone?: boolean;
78
- imported_payee?: string;
79
- date: string;
80
- notes?: string;
81
- amount: number;
82
- cleared?: boolean;
83
- reconciled?: boolean;
84
- is_parent?: boolean;
85
- is_child?: boolean;
86
- parent_id?: string;
87
- imported_id?: string;
88
- starting_balance_flag?: boolean;
89
- transfer_id?: string;
90
- }[];
41
+ export declare function realizeTempTransactions(transactions: TransactionEntity[]): TransactionEntity[];
91
42
  export declare function makeAsNonChildTransactions(childTransactionsToUpdate: TransactionEntity[], transactions: TransactionEntity[]): {
92
43
  updated: TransactionEntity[];
93
44
  deleted: {
94
45
  amount: number;
95
46
  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
- sort_order?: number;
102
- tombstone?: boolean;
103
- imported_payee?: string;
104
- date: string;
105
- notes?: string;
106
- cleared?: boolean;
107
- reconciled?: boolean;
108
47
  is_parent?: boolean;
109
48
  is_child?: boolean;
110
- parent_id?: string;
49
+ parent_id?: TransactionEntity["id"];
50
+ account: import("../types/models").AccountEntity["id"];
51
+ category?: import("../types/models").CategoryEntity["id"];
52
+ payee?: import("../types/models").PayeeEntity["id"];
53
+ notes?: string;
54
+ date: string;
111
55
  imported_id?: string;
56
+ imported_payee?: string;
112
57
  starting_balance_flag?: boolean;
113
- transfer_id?: string;
58
+ transfer_id?: TransactionEntity["id"];
59
+ sort_order?: number;
60
+ cleared?: boolean;
61
+ reconciled?: boolean;
62
+ tombstone?: boolean;
63
+ schedule?: import("../types/models").ScheduleEntity["id"];
64
+ subtransactions?: TransactionEntity[];
114
65
  }[];
115
66
  };
116
67
  export {};
@@ -3,24 +3,21 @@ export declare function getChangedValues<T extends {
3
3
  id?: string;
4
4
  }>(obj1: T, obj2: T): Partial<T>;
5
5
  export declare function hasFieldsChanged<T extends object>(obj1: T, obj2: T, fields: Array<keyof T>): boolean;
6
+ export type Diff<T extends {
7
+ id: string;
8
+ }> = {
9
+ added: T[];
10
+ updated: Partial<T>[];
11
+ deleted: Partial<T>[];
12
+ };
6
13
  export declare function applyChanges<T extends {
7
14
  id: string;
8
- }>(changes: {
9
- added?: T[];
10
- updated?: T[];
11
- deleted?: T[];
12
- }, items: T[]): T[];
15
+ }>(changes: Diff<T>, items: T[]): T[];
13
16
  export declare function partitionByField<T, K extends keyof T>(data: T[], field: K): Map<any, any>;
14
17
  export declare function groupBy<T, K extends keyof T>(data: T[], field: K): Map<T[K], T[]>;
15
18
  export declare function diffItems<T extends {
16
19
  id: string;
17
- }>(items: T[], newItems: T[]): {
18
- added: T[];
19
- updated: Partial<T>[];
20
- deleted: {
21
- id: string;
22
- }[];
23
- };
20
+ }>(items: T[], newItems: T[]): Diff<T>;
24
21
  export declare function groupById<T extends {
25
22
  id: string;
26
23
  }>(data: T[]): {
@@ -31,7 +28,7 @@ export declare function getIn(map: any, keys: any): any;
31
28
  export declare function fastSetMerge<T>(set1: Set<T>, set2: Set<T>): Set<T>;
32
29
  export declare function titleFirst(str: string): string;
33
30
  export declare function appendDecimals(amountText: string, hideDecimals?: boolean): string;
34
- type NumberFormats = 'comma-dot' | 'dot-comma' | 'space-comma' | 'space-dot' | 'comma-dot-in';
31
+ type NumberFormats = 'comma-dot' | 'dot-comma' | 'space-comma' | 'apostrophe-dot' | 'comma-dot-in';
35
32
  export declare const numberFormats: Array<{
36
33
  value: NumberFormats;
37
34
  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>;
@@ -60,13 +63,24 @@ export interface ApiHandlers {
60
63
  flag: boolean;
61
64
  }) => Promise<void>;
62
65
 
66
+ 'api/budget-hold-for-next-month': (arg: {
67
+ month: string;
68
+ amount: number;
69
+ }) => Promise<boolean>;
70
+
71
+ 'api/budget-reset-hold': (arg: { month: string }) => Promise<void>;
72
+
63
73
  'api/transactions-export': (arg: {
64
74
  transactions;
65
75
  categoryGroups;
66
76
  payees;
67
77
  }) => Promise<unknown>;
68
78
 
69
- 'api/transactions-import': (arg: { accountId; transactions }) => Promise<{
79
+ 'api/transactions-import': (arg: {
80
+ accountId;
81
+ transactions;
82
+ isPreview?;
83
+ }) => Promise<{
70
84
  errors?: { message: string }[];
71
85
  added;
72
86
  updated;
@@ -92,7 +106,7 @@ export interface ApiHandlers {
92
106
 
93
107
  'api/transaction-delete': (arg: {
94
108
  id;
95
- }) => Promise<Awaited<ReturnType<typeof batchUpdateTransactions>>['updated']>;
109
+ }) => Promise<Awaited<ReturnType<typeof batchUpdateTransactions>>['deleted']>;
96
110
 
97
111
  'api/sync': () => Promise<void>;
98
112
 
@@ -114,6 +128,11 @@ export interface ApiHandlers {
114
128
 
115
129
  'api/account-delete': (arg: { id }) => Promise<unknown>;
116
130
 
131
+ 'api/account-balance': (arg: {
132
+ id: string;
133
+ cutoff?: Date;
134
+ }) => Promise<number>;
135
+
117
136
  'api/categories-get': (arg: {
118
137
  grouped;
119
138
  }) => Promise<Array<APICategoryGroupEntity | APICategoryEntity>>;
@@ -140,12 +159,19 @@ export interface ApiHandlers {
140
159
 
141
160
  'api/payees-get': () => Promise<APIPayeeEntity[]>;
142
161
 
162
+ 'api/common-payees-get': () => Promise<APIPayeeEntity[]>;
163
+
143
164
  'api/payee-create': (arg: { payee }) => Promise<string>;
144
165
 
145
166
  'api/payee-update': (arg: { id; fields }) => Promise<unknown>;
146
167
 
147
168
  'api/payee-delete': (arg: { id }) => Promise<unknown>;
148
169
 
170
+ 'api/payees-merge': (arg: {
171
+ targetId: string;
172
+ mergeIds: string[];
173
+ }) => Promise<void>;
174
+
149
175
  'api/rules-get': () => Promise<RuleEntity[]>;
150
176
 
151
177
  'api/payee-rules-get': (arg: { id: string }) => Promise<RuleEntity[]>;
@@ -154,5 +180,5 @@ export interface ApiHandlers {
154
180
 
155
181
  'api/rule-update': (arg: { rule: RuleEntity }) => Promise<RuleEntity>;
156
182
 
157
- 'api/rule-delete': (arg: { id: string }) => Promise<boolean>;
183
+ 'api/rule-delete': (id: string) => Promise<boolean>;
158
184
  }
@@ -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 & {
@@ -1,4 +1,5 @@
1
1
  import type { BudgetHandlers } from '../server/budget/types/handlers';
2
+ import type { DashboardHandlers } from '../server/dashboard/types/handlers';
2
3
  import type { FiltersHandlers } from '../server/filters/types/handlers';
3
4
  import type { NotesHandlers } from '../server/notes/types/handlers';
4
5
  import type { ReportsHandlers } from '../server/reports/types/handlers';
@@ -13,6 +14,7 @@ export interface Handlers
13
14
  extends ServerHandlers,
14
15
  ApiHandlers,
15
16
  BudgetHandlers,
17
+ DashboardHandlers,
16
18
  FiltersHandlers,
17
19
  NotesHandlers,
18
20
  ReportsHandlers,
@@ -1,11 +1,15 @@
1
1
  import { CategoryEntity } from './category';
2
2
 
3
- export interface CategoryGroupEntity {
4
- id?: string;
3
+ export interface NewCategoryGroupEntity {
5
4
  name: string;
6
5
  is_income?: boolean;
7
6
  sort_order?: number;
8
7
  tombstone?: boolean;
9
8
  hidden?: boolean;
9
+ categories?: Omit<CategoryEntity, 'id'>[];
10
+ }
11
+
12
+ export interface CategoryGroupEntity extends NewCategoryGroupEntity {
13
+ id: string;
10
14
  categories?: CategoryEntity[];
11
15
  }