@actual-app/api 6.10.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 (34) hide show
  1. package/@types/loot-core/client/state-types/modals.d.ts +17 -11
  2. package/@types/loot-core/client/state-types/prefs.d.ts +4 -9
  3. package/@types/loot-core/client/state-types/queries.d.ts +4 -4
  4. package/@types/loot-core/mocks/index.d.ts +2 -7
  5. package/@types/loot-core/server/accounts/rules.d.ts +3 -4
  6. package/@types/loot-core/server/aql/schema/index.d.ts +8 -0
  7. package/@types/loot-core/server/db/index.d.ts +2 -2
  8. package/@types/loot-core/server/main-app.d.ts +1 -1
  9. package/@types/loot-core/server/preferences/app.d.ts +12 -0
  10. package/@types/loot-core/server/preferences/types/handlers.d.ts +8 -0
  11. package/@types/loot-core/server/prefs.d.ts +4 -6
  12. package/@types/loot-core/server/util/rschedule.d.ts +0 -1
  13. package/@types/loot-core/shared/errors.d.ts +1 -1
  14. package/@types/loot-core/shared/months.d.ts +2 -0
  15. package/@types/loot-core/shared/rules.d.ts +5 -32
  16. package/@types/loot-core/shared/transactions.d.ts +2 -0
  17. package/@types/loot-core/shared/util.d.ts +4 -2
  18. package/@types/loot-core/types/handlers.d.ts +2 -0
  19. package/@types/loot-core/types/models/dashboard.d.ts +37 -4
  20. package/@types/loot-core/types/models/reports.d.ts +3 -13
  21. package/@types/loot-core/types/models/rule.d.ts +4 -1
  22. package/@types/loot-core/types/models/schedule.d.ts +18 -14
  23. package/@types/loot-core/types/models/transaction-filter.d.ts +4 -2
  24. package/@types/loot-core/types/models/transaction.d.ts +2 -0
  25. package/@types/loot-core/types/prefs.d.ts +38 -50
  26. package/@types/loot-core/types/server-events.d.ts +1 -0
  27. package/@types/loot-core/types/server-handlers.d.ts +4 -6
  28. package/@types/loot-core/types/util.d.ts +2 -0
  29. package/@types/migrations/1723665565000_prefs.d.ts +4 -0
  30. package/dist/app/bundle.api.js +1164 -781
  31. package/dist/migrations/1723665565000_prefs.js +51 -0
  32. package/dist/package.json +1 -1
  33. package/package.json +1 -1
  34. /package/@types/loot-core/server/budget/{rollover.d.ts → envelope.d.ts} +0 -0
@@ -39,7 +39,7 @@ type FinanceModals = {
39
39
  };
40
40
  'select-linked-accounts': {
41
41
  accounts: unknown[];
42
- requisitionId: string;
42
+ requisitionId?: string;
43
43
  upgradingAccountId?: string;
44
44
  syncSource?: AccountSyncSource;
45
45
  };
@@ -54,7 +54,7 @@ type FinanceModals = {
54
54
  'manage-rules': { payeeId?: string };
55
55
  'edit-rule': {
56
56
  rule: RuleEntity | NewRuleEntity;
57
- onSave: (rule: RuleEntity) => void;
57
+ onSave?: (rule: RuleEntity) => void;
58
58
  };
59
59
  'merge-unused-payees': {
60
60
  payeeIds: string[];
@@ -157,7 +157,7 @@ type FinanceModals = {
157
157
  onBudgetAction: (month: string, action: string, args?: unknown) => void;
158
158
  onClose?: () => void;
159
159
  };
160
- 'rollover-budget-menu': {
160
+ 'envelope-budget-menu': {
161
161
  categoryId: string;
162
162
  month: string;
163
163
  onUpdateBudget: (amount: number) => void;
@@ -165,7 +165,7 @@ type FinanceModals = {
165
165
  onSetMonthsAverage: (numberOfMonths: number) => void;
166
166
  onApplyBudgetTemplate: () => void;
167
167
  };
168
- 'report-budget-menu': {
168
+ 'tracking-budget-menu': {
169
169
  categoryId: string;
170
170
  month: string;
171
171
  onUpdateBudget: (amount: number) => void;
@@ -187,8 +187,8 @@ type FinanceModals = {
187
187
  name: string;
188
188
  onSave: (id: string, notes: string) => void;
189
189
  };
190
- 'report-budget-summary': { month: string };
191
- 'rollover-budget-summary': {
190
+ 'tracking-budget-summary': { month: string };
191
+ 'envelope-budget-summary': {
192
192
  month: string;
193
193
  onBudgetAction: (
194
194
  month: string,
@@ -204,27 +204,28 @@ type FinanceModals = {
204
204
  onValidate?: (value: string) => string;
205
205
  onSubmit: (value: string) => Promise<void>;
206
206
  };
207
- 'rollover-balance-menu': {
207
+ 'envelope-balance-menu': {
208
208
  categoryId: string;
209
209
  month: string;
210
210
  onCarryover: (carryover: boolean) => void;
211
211
  onTransfer: () => void;
212
212
  onCover: () => void;
213
213
  };
214
- 'rollover-summary-to-budget-menu': {
214
+ 'envelope-summary-to-budget-menu': {
215
215
  month: string;
216
216
  onTransfer: () => void;
217
217
  onCover: () => void;
218
218
  onHoldBuffer: () => void;
219
219
  onResetHoldBuffer: () => void;
220
220
  };
221
- 'report-balance-menu': {
221
+ 'tracking-balance-menu': {
222
222
  categoryId: string;
223
223
  month: string;
224
224
  onCarryover: (carryover: boolean) => void;
225
225
  };
226
226
  transfer: {
227
227
  title: string;
228
+ categoryId?: CategoryEntity['id'];
228
229
  month: string;
229
230
  amount: number;
230
231
  onSubmit: (amount: number, toCategoryId: string) => void;
@@ -232,6 +233,7 @@ type FinanceModals = {
232
233
  };
233
234
  cover: {
234
235
  title: string;
236
+ categoryId?: CategoryEntity['id'];
235
237
  month: string;
236
238
  showToBeBudgeted?: boolean;
237
239
  onSubmit: (fromCategoryId: string) => void;
@@ -250,12 +252,12 @@ type FinanceModals = {
250
252
  onToggleHiddenCategories: () => void;
251
253
  onSwitchBudgetFile: () => void;
252
254
  };
253
- 'rollover-budget-month-menu': {
255
+ 'envelope-budget-month-menu': {
254
256
  month: string;
255
257
  onBudgetAction: (month: string, action: string, arg?: unknown) => void;
256
258
  onEditNotes: (month: string) => void;
257
259
  };
258
- 'report-budget-month-menu': {
260
+ 'tracking-budget-month-menu': {
259
261
  month: string;
260
262
  onBudgetAction: (month: string, action: string, arg?: unknown) => void;
261
263
  onEditNotes: (month: string) => void;
@@ -270,6 +272,10 @@ type FinanceModals = {
270
272
  message?: string;
271
273
  onConfirm: () => void;
272
274
  };
275
+ 'confirm-unlink-account': {
276
+ accountName: string;
277
+ onUnlink: () => void;
278
+ };
273
279
  };
274
280
 
275
281
  export type PushModalAction = {
@@ -1,25 +1,20 @@
1
- import type {
2
- GlobalPrefs,
3
- LocalPrefs,
4
- MetadataPrefs,
5
- SyncedPrefs,
6
- } from '../../types/prefs';
1
+ import type { GlobalPrefs, MetadataPrefs } from '../../types/prefs';
7
2
  import type * as constants from '../constants';
8
3
 
9
4
  export type PrefsState = {
10
- local: LocalPrefs & MetadataPrefs & SyncedPrefs;
5
+ local: MetadataPrefs;
11
6
  global: GlobalPrefs;
12
7
  };
13
8
 
14
9
  export type SetPrefsAction = {
15
10
  type: typeof constants.SET_PREFS;
16
- prefs: LocalPrefs & MetadataPrefs & SyncedPrefs;
11
+ prefs: MetadataPrefs;
17
12
  globalPrefs: GlobalPrefs;
18
13
  };
19
14
 
20
15
  export type MergeLocalPrefsAction = {
21
16
  type: typeof constants.MERGE_LOCAL_PREFS;
22
- prefs: LocalPrefs & MetadataPrefs & SyncedPrefs;
17
+ prefs: MetadataPrefs;
23
18
  };
24
19
 
25
20
  export type MergeGlobalPrefsAction = {
@@ -3,8 +3,8 @@ import { type AccountEntity } from '../../types/models';
3
3
  import type * as constants from '../constants';
4
4
 
5
5
  export type QueriesState = {
6
- newTransactions: unknown[];
7
- matchedTransactions: unknown[];
6
+ newTransactions: string[];
7
+ matchedTransactions: string[];
8
8
  lastTransaction: unknown | null;
9
9
  updatedAccounts: string[];
10
10
  accounts: AccountEntity[];
@@ -20,8 +20,8 @@ export type QueriesState = {
20
20
 
21
21
  type SetNewTransactionsAction = {
22
22
  type: typeof constants.SET_NEW_TRANSACTIONS;
23
- newTransactions?: unknown[];
24
- matchedTransactions?: unknown[];
23
+ newTransactions?: string[];
24
+ matchedTransactions?: string[];
25
25
  updatedAccounts?: string[];
26
26
  };
27
27
 
@@ -1,12 +1,7 @@
1
- export declare function generateAccount(name: any, isConnected: any, offbudget: any): {
2
- id: string;
3
- name: any;
4
- balance_current: number;
5
- bank: number;
1
+ import type { AccountEntity } from '../types/models';
2
+ export declare function generateAccount(name: any, isConnected: any, offbudget: any): AccountEntity & {
6
3
  bankId: number;
7
4
  bankName: string;
8
- offbudget: number;
9
- closed: number;
10
5
  };
11
6
  export declare function generateCategory(name: any, group: any, isIncome?: boolean): {
12
7
  id: string;
@@ -10,7 +10,7 @@ export declare class Condition {
10
10
  type: any;
11
11
  unparsedValue: any;
12
12
  value: any;
13
- constructor(op: any, field: any, value: any, options: any, fieldTypes: any);
13
+ constructor(op: any, field: any, value: any, options: any);
14
14
  eval(object: any): any;
15
15
  getValue(): any;
16
16
  serialize(): {
@@ -30,7 +30,7 @@ export declare class Action {
30
30
  rawValue: any;
31
31
  type: any;
32
32
  value: any;
33
- constructor(op: ActionOperator, field: any, value: any, options: any, fieldTypes: any);
33
+ constructor(op: ActionOperator, field: any, value: any, options: any);
34
34
  exec(object: any): void;
35
35
  serialize(): {
36
36
  options: any;
@@ -47,13 +47,12 @@ export declare class Rule {
47
47
  conditionsOp: any;
48
48
  id: any;
49
49
  stage: any;
50
- constructor({ id, stage, conditionsOp, conditions, actions, fieldTypes, }: {
50
+ constructor({ id, stage, conditionsOp, conditions, actions, }: {
51
51
  id?: string;
52
52
  stage?: any;
53
53
  conditionsOp: any;
54
54
  conditions: any;
55
55
  actions: any;
56
- fieldTypes: any;
57
56
  });
58
57
  evalConditions(object: any): any;
59
58
  execActions<T>(object: T): Partial<T>;
@@ -223,6 +223,14 @@ export declare const schema: {
223
223
  type: string;
224
224
  };
225
225
  };
226
+ preferences: {
227
+ id: {
228
+ type: string;
229
+ };
230
+ value: {
231
+ type: string;
232
+ };
233
+ };
226
234
  transaction_filters: {
227
235
  id: {
228
236
  type: string;
@@ -67,8 +67,8 @@ export declare function selectWithSchema(table: any, sql: any, params: any): Pro
67
67
  export declare function selectFirstWithSchema(table: any, sql: any, params: any): Promise<any>;
68
68
  export declare function insertWithSchema(table: any, row: any): Promise<any>;
69
69
  export declare function updateWithSchema(table: any, fields: any): Promise<void>;
70
- export declare function getCategories(): Promise<CategoryEntity[]>;
71
- export declare function getCategoriesGrouped(): Promise<Array<CategoryGroupEntity>>;
70
+ export declare function getCategories(ids?: Array<CategoryEntity['id']>): Promise<CategoryEntity[]>;
71
+ export declare function getCategoriesGrouped(ids?: Array<CategoryGroupEntity['id']>): Promise<Array<CategoryGroupEntity>>;
72
72
  export declare function insertCategoryGroup(group: any): Promise<any>;
73
73
  export declare function updateCategoryGroup(group: any): Promise<void>;
74
74
  export declare function moveCategoryGroup(id: any, targetId: any): Promise<void>;
@@ -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/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;
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;
@@ -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,15 +1,13 @@
1
- import type { MetadataPrefs, SyncedPrefs } from '../types/prefs';
2
- type LocalPrefs = MetadataPrefs & Pick<SyncedPrefs, 'budgetType'>;
1
+ import type { MetadataPrefs } from '../types/prefs';
3
2
  export declare const BUDGET_TYPES: readonly ["report", "rollover"];
4
3
  export type BudgetType = (typeof BUDGET_TYPES)[number];
5
- export declare function loadPrefs(id?: string): Promise<LocalPrefs>;
6
- export declare function savePrefs(prefsToSet: LocalPrefs, { avoidSync }?: {
4
+ export declare function loadPrefs(id?: string): Promise<MetadataPrefs>;
5
+ export declare function savePrefs(prefsToSet: MetadataPrefs, { avoidSync }?: {
7
6
  avoidSync?: boolean;
8
7
  }): Promise<void>;
9
8
  export declare function unloadPrefs(): void;
10
- export declare function getPrefs(): LocalPrefs;
9
+ export declare function getPrefs(): MetadataPrefs;
11
10
  export declare function getDefaultPrefs(id: string, budgetName: string): {
12
11
  id: string;
13
12
  budgetName: string;
14
13
  };
15
- export {};
@@ -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';
@@ -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
  }
@@ -5,6 +5,8 @@ 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
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
12
  export declare function currentWeek(firstDayOfWeekIdx?: SyncedPrefs['firstDayOfWeekIdx']): string;
@@ -1,34 +1,7 @@
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
- imported_payee: {
19
- ops: string[];
20
- nullable: boolean;
21
- };
22
- number: {
23
- ops: string[];
24
- nullable: boolean;
25
- };
26
- boolean: {
27
- ops: string[];
28
- nullable: boolean;
29
- };
30
- };
31
- 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;
32
5
  export declare const ALLOCATION_METHODS: {
33
6
  'fixed-amount': string;
34
7
  'fixed-percent': string;
@@ -52,7 +25,7 @@ export declare function deserializeField(field: any): {
52
25
  field: any;
53
26
  options?: undefined;
54
27
  };
55
- 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";
56
29
  export declare function sortNumbers(num1: any, num2: any): any[];
57
30
  export declare function parse(item: any): any;
58
31
  export declare function unparse({ error, inputKey, ...item }: {
@@ -62,6 +62,8 @@ export declare function makeAsNonChildTransactions(childTransactionsToUpdate: Tr
62
62
  tombstone?: boolean;
63
63
  schedule?: import("../types/models").ScheduleEntity["id"];
64
64
  subtransactions?: TransactionEntity[];
65
+ _unmatched?: boolean;
66
+ _deleted?: boolean;
65
67
  }[];
66
68
  };
67
69
  export {};
@@ -28,7 +28,9 @@ export declare function getIn(map: any, keys: any): any;
28
28
  export declare function fastSetMerge<T>(set1: Set<T>, set2: Set<T>): Set<T>;
29
29
  export declare function titleFirst(str: string): string;
30
30
  export declare function appendDecimals(amountText: string, hideDecimals?: boolean): string;
31
- 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;
32
34
  export declare const numberFormats: Array<{
33
35
  value: NumberFormats;
34
36
  label: string;
@@ -43,7 +45,7 @@ export declare function getNumberFormat({ format, hideFraction, }?: {
43
45
  format?: NumberFormats;
44
46
  hideFraction: boolean;
45
47
  }): {
46
- value: NumberFormats;
48
+ value: "comma-dot" | "dot-comma" | "space-comma" | "apostrophe-dot" | "comma-dot-in";
47
49
  separator: any;
48
50
  formatter: Intl.NumberFormat;
49
51
  regex: any;
@@ -2,6 +2,7 @@ import type { BudgetHandlers } from '../server/budget/types/handlers';
2
2
  import type { DashboardHandlers } from '../server/dashboard/types/handlers';
3
3
  import type { FiltersHandlers } from '../server/filters/types/handlers';
4
4
  import type { NotesHandlers } from '../server/notes/types/handlers';
5
+ import type { PreferencesHandlers } from '../server/preferences/types/handlers';
5
6
  import type { ReportsHandlers } from '../server/reports/types/handlers';
6
7
  import type { RulesHandlers } from '../server/rules/types/handlers';
7
8
  import type { SchedulesHandlers } from '../server/schedules/types/handlers';
@@ -17,6 +18,7 @@ export interface Handlers
17
18
  DashboardHandlers,
18
19
  FiltersHandlers,
19
20
  NotesHandlers,
21
+ PreferencesHandlers,
20
22
  ReportsHandlers,
21
23
  RulesHandlers,
22
24
  SchedulesHandlers,
@@ -1,4 +1,11 @@
1
1
  import { type CustomReportEntity } from './reports';
2
+ import { type RuleConditionEntity } from './rule';
3
+
4
+ export type TimeFrame = {
5
+ start: string;
6
+ end: string;
7
+ mode: 'sliding-window' | 'static' | 'full';
8
+ };
2
9
 
3
10
  type AbstractWidget<
4
11
  T extends string,
@@ -16,22 +23,48 @@ type AbstractWidget<
16
23
 
17
24
  export type NetWorthWidget = AbstractWidget<
18
25
  'net-worth-card',
19
- { name?: string } | null
26
+ {
27
+ name?: string;
28
+ conditions?: RuleConditionEntity[];
29
+ conditionsOp?: 'and' | 'or';
30
+ timeFrame?: TimeFrame;
31
+ } | null
20
32
  >;
21
33
  export type CashFlowWidget = AbstractWidget<
22
34
  'cash-flow-card',
23
- { name?: string } | null
35
+ {
36
+ name?: string;
37
+ conditions?: RuleConditionEntity[];
38
+ conditionsOp?: 'and' | 'or';
39
+ timeFrame?: TimeFrame;
40
+ } | null
24
41
  >;
25
42
  export type SpendingWidget = AbstractWidget<
26
43
  'spending-card',
27
- { name?: string } | null
44
+ {
45
+ name?: string;
46
+ conditions?: RuleConditionEntity[];
47
+ conditionsOp?: 'and' | 'or';
48
+ compare?: string;
49
+ compareTo?: string;
50
+ isLive?: boolean;
51
+ mode?: 'single-month' | 'budget' | 'average';
52
+ } | null
28
53
  >;
29
54
  export type CustomReportWidget = AbstractWidget<
30
55
  'custom-report',
31
56
  { id: string }
32
57
  >;
58
+ export type MarkdownWidget = AbstractWidget<
59
+ 'markdown-card',
60
+ { content: string; text_align?: 'left' | 'right' | 'center' }
61
+ >;
33
62
 
34
- type SpecializedWidget = NetWorthWidget | CashFlowWidget | SpendingWidget;
63
+ type SpecializedWidget =
64
+ | NetWorthWidget
65
+ | CashFlowWidget
66
+ | SpendingWidget
67
+ | MarkdownWidget;
35
68
  export type Widget = SpecializedWidget | CustomReportWidget;
36
69
  export type NewWidget = Omit<Widget, 'id' | 'tombstone'>;
37
70
 
@@ -30,14 +30,6 @@ export type balanceTypeOpType =
30
30
  | 'netAssets'
31
31
  | 'netDebts';
32
32
 
33
- export type spendingReportTimeType =
34
- | 'average'
35
- | 'thisMonth'
36
- | 'lastMonth'
37
- | 'twoMonthsPrevious'
38
- | 'lastYear'
39
- | 'lastYearPrevious';
40
-
41
33
  export type SpendingMonthEntity = Record<
42
34
  string | number,
43
35
  {
@@ -61,11 +53,9 @@ export interface SpendingEntity {
61
53
  months: SpendingMonthEntity;
62
54
  day: string;
63
55
  average: number;
64
- thisMonth: number;
65
- lastMonth: number;
66
- twoMonthsPrevious: number;
67
- lastYear: number;
68
- lastYearPrevious: number;
56
+ compare: number;
57
+ compareTo: number;
58
+ budget: number;
69
59
  }[];
70
60
  startDate?: string;
71
61
  endDate?: string;
@@ -37,6 +37,8 @@ type FieldValueTypes = {
37
37
  payee: string;
38
38
  imported_payee: string;
39
39
  saved: string;
40
+ cleared: boolean;
41
+ reconciled: boolean;
40
42
  };
41
43
 
42
44
  type BaseConditionEntity<
@@ -55,8 +57,9 @@ type BaseConditionEntity<
55
57
  year?: boolean;
56
58
  };
57
59
  conditionsOp?: string;
58
- type?: 'id' | 'boolean' | 'date' | 'number';
60
+ type?: 'id' | 'boolean' | 'date' | 'number' | 'string';
59
61
  customName?: string;
62
+ queryFilter?: Record<string, { $oneof: string[] }>;
60
63
  };
61
64
 
62
65
  export type RuleConditionEntity =
@@ -2,6 +2,23 @@ import type { AccountEntity } from './account';
2
2
  import type { PayeeEntity } from './payee';
3
3
  import type { RuleEntity } from './rule';
4
4
 
5
+ export interface RecurPattern {
6
+ value: number;
7
+ type: 'SU' | 'MO' | 'TU' | 'WE' | 'TH' | 'FR' | 'SA' | 'day';
8
+ }
9
+
10
+ export interface RecurConfig {
11
+ frequency: 'daily' | 'weekly' | 'monthly' | 'yearly';
12
+ interval: number;
13
+ patterns?: RecurPattern[];
14
+ skipWeekend?: boolean;
15
+ start: string;
16
+ endMode: 'never' | 'after_n_occurrences' | 'on_date';
17
+ endOccurrences?: number;
18
+ endDate?: string;
19
+ weekendSolveMode?: 'before' | 'after';
20
+ }
21
+
5
22
  export interface ScheduleEntity {
6
23
  id: string;
7
24
  name?: string;
@@ -17,20 +34,7 @@ export interface ScheduleEntity {
17
34
  _account: AccountEntity['id'];
18
35
  _amount: unknown;
19
36
  _amountOp: string;
20
- _date: {
21
- interval: number;
22
- patterns: {
23
- value: number;
24
- type: 'SU' | 'MO' | 'TU' | 'WE' | 'TH' | 'FR' | 'SA' | 'day';
25
- }[];
26
- skipWeekend: boolean;
27
- start: string;
28
- endMode: 'never' | 'after_n_occurrences' | 'on_date';
29
- endOccurrences: number;
30
- endDate: string;
31
- weekendSolveMode: 'before' | 'after';
32
- frequency: 'daily' | 'weekly' | 'monthly' | 'yearly';
33
- };
37
+ _date: RecurConfig;
34
38
  _conditions: unknown;
35
39
  _actions: unknown;
36
40
  }
@@ -1,7 +1,9 @@
1
+ import { type RuleConditionEntity } from './rule';
2
+
1
3
  export interface TransactionFilterEntity {
2
4
  id: string;
3
5
  name: string;
4
- conditions_op: string;
5
- conditions: unknown;
6
+ conditionsOp: 'and' | 'or';
7
+ conditions: RuleConditionEntity[];
6
8
  tombstone: boolean;
7
9
  }
@@ -24,4 +24,6 @@ export interface TransactionEntity {
24
24
  tombstone?: boolean;
25
25
  schedule?: ScheduleEntity['id'];
26
26
  subtransactions?: TransactionEntity[];
27
+ _unmatched?: boolean;
28
+ _deleted?: boolean;
27
29
  }