@actual-app/api 6.9.0 → 24.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 (82) hide show
  1. package/@types/jest.config.d.ts +7 -7
  2. package/@types/loot-core/client/constants.d.ts +1 -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 +35 -17
  5. package/@types/loot-core/client/state-types/notifications.d.ts +18 -1
  6. package/@types/loot-core/client/state-types/prefs.d.ts +4 -4
  7. package/@types/loot-core/client/state-types/queries.d.ts +4 -4
  8. package/@types/loot-core/mocks/index.d.ts +2 -7
  9. package/@types/loot-core/server/accounts/parse-file.d.ts +1 -0
  10. package/@types/loot-core/server/accounts/rules.d.ts +5 -6
  11. package/@types/loot-core/server/accounts/sync.d.ts +2 -2
  12. package/@types/loot-core/server/accounts/transaction-rules.d.ts +1 -3
  13. package/@types/loot-core/server/accounts/transactions.d.ts +3 -5
  14. package/@types/loot-core/server/api-models.d.ts +6 -6
  15. package/@types/loot-core/server/aql/schema/index.d.ts +34 -3
  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 +5 -4
  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/preferences/app.d.ts +12 -0
  35. package/@types/loot-core/server/preferences/types/handlers.d.ts +8 -0
  36. package/@types/loot-core/server/prefs.d.ts +8 -5
  37. package/@types/loot-core/server/reports/app.d.ts +46 -0
  38. package/@types/loot-core/server/rules/types/handlers.d.ts +4 -6
  39. package/@types/loot-core/server/sync/make-test-message.d.ts +0 -1
  40. package/@types/loot-core/server/util/rschedule.d.ts +0 -1
  41. package/@types/loot-core/shared/dashboard.d.ts +2 -0
  42. package/@types/loot-core/shared/errors.d.ts +1 -1
  43. package/@types/loot-core/shared/months.d.ts +9 -6
  44. package/@types/loot-core/shared/rules.d.ts +6 -29
  45. package/@types/loot-core/shared/schedules.d.ts +22 -22
  46. package/@types/loot-core/shared/transactions.d.ts +26 -73
  47. package/@types/loot-core/shared/util.d.ts +13 -14
  48. package/@types/loot-core/types/api-handlers.d.ts +14 -3
  49. package/@types/loot-core/types/handlers.d.ts +4 -0
  50. package/@types/loot-core/types/models/category-group.d.ts +6 -2
  51. package/@types/loot-core/types/models/category.d.ts +4 -2
  52. package/@types/loot-core/types/models/dashboard.d.ts +89 -0
  53. package/@types/loot-core/types/models/index.d.ts +1 -0
  54. package/@types/loot-core/types/models/payee.d.ts +5 -7
  55. package/@types/loot-core/types/models/reports.d.ts +5 -18
  56. package/@types/loot-core/types/models/rule.d.ts +103 -7
  57. package/@types/loot-core/types/models/schedule.d.ts +18 -14
  58. package/@types/loot-core/types/models/transaction-filter.d.ts +4 -2
  59. package/@types/loot-core/types/models/transaction.d.ts +14 -25
  60. package/@types/loot-core/types/prefs.d.ts +65 -55
  61. package/@types/loot-core/types/server-events.d.ts +1 -0
  62. package/@types/loot-core/types/server-handlers.d.ts +9 -13
  63. package/@types/loot-core/types/util.d.ts +6 -0
  64. package/@types/methods.d.ts +4 -11
  65. package/@types/migrations/1722717601000_reports_move_selected_categories.d.ts +1 -0
  66. package/@types/migrations/1722804019000_create_dashboard_table.d.ts +1 -0
  67. package/@types/migrations/1723665565000_prefs.d.ts +4 -0
  68. package/dist/app/bundle.api.js +5534 -1851
  69. package/dist/app/query.js +1 -2
  70. package/dist/index.js +3 -3
  71. package/dist/injected.js +2 -2
  72. package/dist/methods.js +53 -45
  73. package/dist/methods.test.js +8 -14
  74. package/dist/migrations/1632571489012_remove_cache.js +1 -1
  75. package/dist/migrations/1722717601000_reports_move_selected_categories.js +39 -0
  76. package/dist/migrations/1722804019000_create_dashboard_table.js +38 -0
  77. package/dist/migrations/1723665565000_prefs.js +51 -0
  78. package/dist/package.json +2 -2
  79. package/dist/utils.js +2 -3
  80. package/dist/validateNodeVersion.js +1 -2
  81. package/package.json +2 -2
  82. /package/@types/loot-core/server/budget/{rollover.d.ts → envelope.d.ts} +0 -0
@@ -0,0 +1,9 @@
1
+ export type Schedule = {
2
+ id: string;
3
+ rule: string;
4
+ active: number;
5
+ completed: number;
6
+ posts_transaction: number;
7
+ tombstone: number;
8
+ name: string | null;
9
+ };
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  export declare function sha256String(str: any): Promise<string>;
3
2
  export declare function randomBytes(n: any): Buffer;
4
3
  export declare function encrypt(masterKey: any, value: any): {
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  export declare function sha256String(str: any): Promise<string>;
3
2
  export declare function randomBytes(n: any): Buffer;
4
3
  export declare function encrypt(masterKey: any, value: any): Promise<{
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  declare class Key {
3
2
  id: any;
4
3
  value: any;
@@ -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 "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;
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" | "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: {
@@ -0,0 +1,12 @@
1
+ import { PreferencesHandlers } from './types/handlers';
2
+ export declare const app: {
3
+ events: any;
4
+ handlers: PreferencesHandlers;
5
+ services: any;
6
+ unlistenServices: any;
7
+ method<Name extends "preferences/save">(name: Name, func: PreferencesHandlers[Name]): void;
8
+ service(func: any): void;
9
+ combine(...apps: any[]): void;
10
+ startServices(): void;
11
+ stopServices(): void;
12
+ };
@@ -0,0 +1,8 @@
1
+ import { type SyncedPrefs } from '../../../types/prefs';
2
+
3
+ export interface PreferencesHandlers {
4
+ 'preferences/save': (arg: {
5
+ id: keyof SyncedPrefs;
6
+ value: string | undefined;
7
+ }) => Promise<void>;
8
+ }
@@ -1,10 +1,13 @@
1
- import type { LocalPrefs } from '../types/prefs';
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 function loadPrefs(id?: string): Promise<LocalPrefs>;
5
- export declare function savePrefs(prefsToSet: LocalPrefs, { avoidSync }?: {
4
+ export declare function loadPrefs(id?: string): Promise<MetadataPrefs>;
5
+ export declare function savePrefs(prefsToSet: MetadataPrefs, { avoidSync }?: {
6
6
  avoidSync?: boolean;
7
7
  }): Promise<void>;
8
8
  export declare function unloadPrefs(): void;
9
- export declare function getPrefs(): LocalPrefs;
10
- export declare function getDefaultPrefs(id: string, budgetName: string): LocalPrefs;
9
+ export declare function getPrefs(): MetadataPrefs;
10
+ export declare function getDefaultPrefs(id: string, budgetName: string): {
11
+ id: string;
12
+ budgetName: string;
13
+ };
@@ -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: {
@@ -1,5 +1,4 @@
1
1
  import '@rschedule/standard-date-adapter/setup';
2
- import '@rschedule/json-tools/Schedule';
3
2
  export * from '@rschedule/standard-date-adapter';
4
3
  export * from '@rschedule/core';
5
4
  export * from '@rschedule/core/generators';
@@ -0,0 +1,2 @@
1
+ import { type NewWidget } from '../types/models';
2
+ export declare const DEFAULT_DASHBOARD_STATE: NewWidget[];
@@ -18,5 +18,5 @@ export declare function getBankSyncError(error: {
18
18
  export declare class LazyLoadFailedError extends Error {
19
19
  type: string;
20
20
  meta: {};
21
- constructor(name: string);
21
+ constructor(name: string, cause: unknown);
22
22
  }
@@ -1,13 +1,15 @@
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
+ export declare function firstDayOfMonth(date: DateLike): string;
9
+ export declare function lastDayOfMonth(date: DateLike): string;
8
10
  export declare function dayFromDate(date: DateLike): string;
9
11
  export declare function currentMonth(): string;
10
- export declare function currentWeek(firstDayOfWeekIdx?: LocalPrefs['firstDayOfWeekIdx']): string;
12
+ export declare function currentWeek(firstDayOfWeekIdx?: SyncedPrefs['firstDayOfWeekIdx']): string;
11
13
  export declare function currentYear(): string;
12
14
  export declare function currentDate(): Date;
13
15
  export declare function currentDay(): string;
@@ -26,14 +28,15 @@ export declare function addDays(day: DateLike, n: number): string;
26
28
  export declare function subDays(day: DateLike, n: number): string;
27
29
  export declare function isBefore(month1: DateLike, month2: DateLike): boolean;
28
30
  export declare function isAfter(month1: DateLike, month2: DateLike): boolean;
31
+ export declare function isCurrentMonth(month: DateLike): boolean;
29
32
  export declare function bounds(month: DateLike): {
30
33
  start: number;
31
34
  end: number;
32
35
  };
33
36
  export declare function _yearRange(start: DateLike, end: DateLike, inclusive?: boolean): string[];
34
37
  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[];
38
+ export declare function _weekRange(start: DateLike, end: DateLike, inclusive?: boolean, firstDayOfWeekIdx?: SyncedPrefs['firstDayOfWeekIdx']): string[];
39
+ export declare function weekRangeInclusive(start: DateLike, end: DateLike, firstDayOfWeekIdx?: SyncedPrefs['firstDayOfWeekIdx']): string[];
37
40
  export declare function _range(start: DateLike, end: DateLike, inclusive?: boolean): string[];
38
41
  export declare function range(start: DateLike, end: DateLike): string[];
39
42
  export declare function rangeInclusive(start: DateLike, end: DateLike): string[];
@@ -46,7 +49,7 @@ export declare function getYear(month: string): string;
46
49
  export declare function getMonth(day: string): string;
47
50
  export declare function getDay(day: string): number;
48
51
  export declare function getMonthEnd(day: string): string;
49
- export declare function getWeekEnd(date: DateLike, firstDayOfWeekIdx?: LocalPrefs['firstDayOfWeekIdx']): string;
52
+ export declare function getWeekEnd(date: DateLike, firstDayOfWeekIdx?: SyncedPrefs['firstDayOfWeekIdx']): string;
50
53
  export declare function getYearStart(month: string): string;
51
54
  export declare function getYearEnd(month: string): string;
52
55
  export declare function sheetForMonth(month: string): string;
@@ -1,37 +1,14 @@
1
- export declare const TYPE_INFO: {
2
- date: {
3
- ops: string[];
4
- nullable: boolean;
5
- };
6
- id: {
7
- ops: string[];
8
- nullable: boolean;
9
- };
10
- saved: {
11
- ops: any[];
12
- nullable: boolean;
13
- };
14
- string: {
15
- ops: string[];
16
- nullable: boolean;
17
- };
18
- number: {
19
- ops: string[];
20
- nullable: boolean;
21
- };
22
- boolean: {
23
- ops: string[];
24
- nullable: boolean;
25
- };
26
- };
27
- export declare const FIELD_TYPES: Map<string, string>;
1
+ import { FieldValueTypes, RuleConditionOp } from '../types/models';
2
+ export declare const FIELD_TYPES: Map<keyof FieldValueTypes, string>;
3
+ export declare function isValidOp(field: keyof FieldValueTypes, op: RuleConditionOp): boolean;
4
+ export declare function getValidOps(field: keyof FieldValueTypes): any;
28
5
  export declare const ALLOCATION_METHODS: {
29
6
  'fixed-amount': string;
30
7
  'fixed-percent': string;
31
8
  remainder: string;
32
9
  };
33
10
  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";
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";
35
12
  export declare function deserializeField(field: any): {
36
13
  field: string;
37
14
  options: {
@@ -48,7 +25,7 @@ export declare function deserializeField(field: any): {
48
25
  field: any;
49
26
  options?: undefined;
50
27
  };
51
- export declare function getFieldError(type: any): "Invalid date format" | "Value cannot be empty" | "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" | "Internal error, sorry! Please get in touch https://actualbudget.org/contact/ for support";
52
29
  export declare function sortNumbers(num1: any, num2: any): any[];
53
30
  export declare function parse(item: any): any;
54
31
  export declare function unparse({ error, inputKey, ...item }: {
@@ -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,51 @@ 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
- imported_payee?: string;
77
- date: string;
78
- notes?: string;
79
- amount: number;
80
- cleared?: boolean;
81
- reconciled?: boolean;
82
- is_parent?: boolean;
83
- is_child?: boolean;
84
- parent_id?: string;
85
- imported_id?: string;
86
- starting_balance_flag?: boolean;
87
- transfer_id?: string;
88
- sort_order?: number;
89
- tombstone?: boolean;
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
- imported_payee?: string;
102
- date: string;
103
- notes?: string;
104
- cleared?: boolean;
105
- reconciled?: boolean;
106
47
  is_parent?: boolean;
107
48
  is_child?: boolean;
108
- 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;
109
55
  imported_id?: string;
56
+ imported_payee?: string;
110
57
  starting_balance_flag?: boolean;
111
- transfer_id?: string;
58
+ transfer_id?: TransactionEntity["id"];
112
59
  sort_order?: number;
60
+ cleared?: boolean;
61
+ reconciled?: boolean;
113
62
  tombstone?: boolean;
63
+ schedule?: import("../types/models").ScheduleEntity["id"];
64
+ subtransactions?: TransactionEntity[];
65
+ _unmatched?: boolean;
66
+ _deleted?: boolean;
114
67
  }[];
115
68
  };
116
69
  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,9 @@ 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' | 'apostrophe-dot' | 'comma-dot-in';
31
+ declare const NUMBER_FORMATS: readonly ["comma-dot", "dot-comma", "space-comma", "apostrophe-dot", "comma-dot", "comma-dot-in"];
32
+ type NumberFormats = (typeof NUMBER_FORMATS)[number];
33
+ export declare function isNumberFormat(input?: string): input is NumberFormats;
35
34
  export declare const numberFormats: Array<{
36
35
  value: NumberFormats;
37
36
  label: string;
@@ -46,7 +45,7 @@ export declare function getNumberFormat({ format, hideFraction, }?: {
46
45
  format?: NumberFormats;
47
46
  hideFraction: boolean;
48
47
  }): {
49
- value: NumberFormats;
48
+ value: "comma-dot" | "dot-comma" | "space-comma" | "apostrophe-dot" | "comma-dot-in";
50
49
  separator: any;
51
50
  formatter: Intl.NumberFormat;
52
51
  regex: any;