@actual-app/api 24.12.0 → 25.2.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 (76) hide show
  1. package/@types/loot-core/client/constants.d.ts +0 -11
  2. package/@types/loot-core/client/state-types/index.d.ts +0 -14
  3. package/@types/loot-core/client/state-types/modals.d.ts +57 -2
  4. package/@types/loot-core/mocks/index.d.ts +9 -20
  5. package/@types/loot-core/platform/client/fetch/index.d.ts +10 -1
  6. package/@types/loot-core/platform/client/undo/index.d.ts +8 -4
  7. package/@types/loot-core/platform/server/connection/index.d.ts +1 -1
  8. package/@types/loot-core/server/accounts/sync.d.ts +1 -1
  9. package/@types/loot-core/server/accounts/transaction-rules.d.ts +4 -6
  10. package/@types/loot-core/server/accounts/transactions.d.ts +0 -3
  11. package/@types/loot-core/server/accounts/transfer.d.ts +0 -11
  12. package/@types/loot-core/server/admin/app.d.ts +17 -0
  13. package/@types/loot-core/server/admin/types/handlers.d.ts +43 -0
  14. package/@types/loot-core/server/app.d.ts +14 -4
  15. package/@types/loot-core/server/aql/compiler.d.ts +4 -6
  16. package/@types/loot-core/server/aql/schema/index.d.ts +3 -0
  17. package/@types/loot-core/server/budget/actions.d.ts +6 -0
  18. package/@types/loot-core/server/budget/app.d.ts +10 -5
  19. package/@types/loot-core/server/budget/categoryTemplate.d.ts +3 -2
  20. package/@types/loot-core/server/budget/goalsSchedule.d.ts +7 -5
  21. package/@types/loot-core/server/budget/types/handlers.d.ts +4 -0
  22. package/@types/loot-core/server/cloud-storage.d.ts +9 -0
  23. package/@types/loot-core/server/dashboard/app.d.ts +9 -4
  24. package/@types/loot-core/server/db/index.d.ts +1 -0
  25. package/@types/loot-core/server/filters/app.d.ts +9 -4
  26. package/@types/loot-core/server/importers/ynab4-types.d.ts +0 -2
  27. package/@types/loot-core/server/importers/ynab5-types.d.ts +0 -2
  28. package/@types/loot-core/server/main-app.d.ts +10 -5
  29. package/@types/loot-core/server/main.d.ts +2 -2
  30. package/@types/loot-core/server/notes/app.d.ts +9 -4
  31. package/@types/loot-core/server/post.d.ts +2 -0
  32. package/@types/loot-core/server/preferences/app.d.ts +9 -4
  33. package/@types/loot-core/server/reports/app.d.ts +11 -4
  34. package/@types/loot-core/server/rules/app.d.ts +9 -4
  35. package/@types/loot-core/server/rules/types/handlers.d.ts +4 -4
  36. package/@types/loot-core/server/schedules/app.d.ts +10 -7
  37. package/@types/loot-core/server/schedules/types/handlers.d.ts +5 -5
  38. package/@types/loot-core/server/tools/app.d.ts +9 -4
  39. package/@types/loot-core/server/tools/types/handlers.d.ts +4 -0
  40. package/@types/loot-core/server/util/budget-name.d.ts +6 -2
  41. package/@types/loot-core/shared/errors.d.ts +3 -0
  42. package/@types/loot-core/shared/query.d.ts +13 -12
  43. package/@types/loot-core/shared/schedules.d.ts +5 -31
  44. package/@types/loot-core/shared/transactions.d.ts +101 -17
  45. package/@types/loot-core/shared/util.d.ts +30 -10
  46. package/@types/loot-core/types/api-handlers.d.ts +3 -0
  47. package/@types/loot-core/types/budget.d.ts +1 -0
  48. package/@types/loot-core/types/file.d.ts +7 -0
  49. package/@types/loot-core/types/handlers.d.ts +2 -0
  50. package/@types/loot-core/types/models/dashboard.d.ts +13 -2
  51. package/@types/loot-core/types/models/index.d.ts +1 -0
  52. package/@types/loot-core/types/models/openid.d.ts +7 -0
  53. package/@types/loot-core/types/models/payee.d.ts +1 -0
  54. package/@types/loot-core/types/models/reports.d.ts +4 -0
  55. package/@types/loot-core/types/models/rule.d.ts +11 -5
  56. package/@types/loot-core/types/models/schedule.d.ts +5 -18
  57. package/@types/loot-core/types/models/simplefin.d.ts +2 -0
  58. package/@types/loot-core/types/models/transaction.d.ts +6 -0
  59. package/@types/loot-core/types/models/user.d.ts +26 -0
  60. package/@types/loot-core/types/models/userAccess.d.ts +9 -0
  61. package/@types/loot-core/types/prefs.d.ts +7 -3
  62. package/@types/loot-core/types/server-events.d.ts +80 -17
  63. package/@types/loot-core/types/server-handlers.d.ts +106 -17
  64. package/@types/loot-core/types/util.d.ts +5 -0
  65. package/@types/methods.d.ts +4 -4
  66. package/dist/app/bundle.api.js +1804 -916
  67. package/dist/methods.js +8 -2
  68. package/dist/migrations/1736640000000__custom_report_sorting.sql +7 -0
  69. package/dist/migrations/1737158400000_add_learn_categories_to_payees.sql +5 -0
  70. package/dist/migrations/1738491452000__sorting_rename.sql +13 -0
  71. package/dist/package.json +2 -2
  72. package/package.json +2 -2
  73. package/@types/loot-core/client/actions/types.d.ts +0 -6
  74. package/@types/loot-core/client/state-types/account.d.ts +0 -27
  75. package/@types/loot-core/client/state-types/app.d.ts +0 -37
  76. package/@types/loot-core/client/state-types/queries.d.ts +0 -76
@@ -1,12 +1,3 @@
1
- export declare const SET_NEW_TRANSACTIONS = "SET_NEW_TRANSACTIONS";
2
- export declare const UPDATE_NEW_TRANSACTIONS = "UPDATE_NEW_TRANSACTIONS";
3
- export declare const SET_LAST_TRANSACTION = "SET_LAST_TRANSACTION";
4
- export declare const MARK_ACCOUNT_READ = "MARK_ACCOUNT_READ";
5
- export declare const LOAD_ACCOUNTS = "LOAD_ACCOUNTS";
6
- export declare const UPDATE_ACCOUNT = "UPDATE_ACCOUNT";
7
- export declare const LOAD_CATEGORIES = "LOAD_CATEGORIES";
8
- export declare const LOAD_COMMON_PAYEES = "LOAD_COMMON_PAYEES";
9
- export declare const LOAD_PAYEES = "LOAD_PAYEES";
10
1
  export declare const SET_PREFS = "SET_PREFS";
11
2
  export declare const MERGE_LOCAL_PREFS = "MERGE_LOCAL_PREFS";
12
3
  export declare const MERGE_GLOBAL_PREFS = "MERGE_GLOBAL_PREFS";
@@ -25,8 +16,6 @@ export declare const ADD_NOTIFICATION = "ADD_NOTIFICATION";
25
16
  export declare const REMOVE_NOTIFICATION = "REMOVE_NOTIFICATION";
26
17
  export declare const SET_NOTIFICATION_INSET = "SET_NOTIFICATION_INSET";
27
18
  export declare const GET_USER_DATA = "GET_USER_DATA";
28
- export declare const SET_LAST_UNDO_STATE = "SET_LAST_UNDO_STATE";
29
- export declare const SET_LAST_SPLIT_STATE = "SET_LAST_SPLIT_STATE";
30
19
  export declare const SET_ACCOUNTS_SYNCING = "SET_ACCOUNTS_SYNCING";
31
20
  export declare const ACCOUNT_SYNC_STATUS = "ACCOUNT_SYNC_STATUS";
32
21
  export declare const SIGN_OUT = "SIGN_OUT";
@@ -1,12 +1,9 @@
1
1
  import type * as constants from '../constants';
2
2
 
3
- import type { AccountActions, AccountState } from './account';
4
- import type { AppActions, AppState } from './app';
5
3
  import type { BudgetsActions, BudgetsState } from './budgets';
6
4
  import type { ModalsActions, ModalsState } from './modals';
7
5
  import type { NotificationsActions, NotificationsState } from './notifications';
8
6
  import type { PrefsActions, PrefsState } from './prefs';
9
- import type { QueriesActions, QueriesState } from './queries';
10
7
  import type { UserActions, UserState } from './user';
11
8
 
12
9
  export type CloseBudgetAction = {
@@ -14,28 +11,17 @@ export type CloseBudgetAction = {
14
11
  };
15
12
 
16
13
  export type Action =
17
- | AccountActions
18
- | AppActions
19
14
  | BudgetsActions
20
15
  | ModalsActions
21
16
  | NotificationsActions
22
17
  | PrefsActions
23
- | QueriesActions
24
18
  | UserActions
25
19
  | CloseBudgetAction;
26
20
 
27
21
  export type State = {
28
- account: AccountState;
29
- app: AppState;
30
22
  budgets: BudgetsState;
31
23
  modals: ModalsState;
32
24
  notifications: NotificationsState;
33
25
  prefs: PrefsState;
34
- queries: QueriesState;
35
26
  user: UserState;
36
27
  };
37
-
38
- declare module 'react-redux' {
39
- // eslint-disable-next-line @typescript-eslint/no-empty-object-type, @typescript-eslint/consistent-type-definitions
40
- export interface DefaultRootState extends State {}
41
- }
@@ -8,6 +8,8 @@ import type {
8
8
  TransactionEntity,
9
9
  } from '../../types/models';
10
10
  import type { NewRuleEntity, RuleEntity } from '../../types/models/rule';
11
+ import { type NewUserEntity, type UserEntity } from '../../types/models/user';
12
+ import { type UserAccessEntity } from '../../types/models/userAccess';
11
13
  import type { EmptyObject, StripNever } from '../../types/util';
12
14
  import type * as constants from '../constants';
13
15
  export type ModalType = keyof FinanceModals;
@@ -78,6 +80,37 @@ type FinanceModals = {
78
80
 
79
81
  'delete-budget': { file: File };
80
82
 
83
+ 'duplicate-budget': {
84
+ /** The budget file to be duplicated */
85
+ file: File;
86
+ /**
87
+ * Indicates whether the duplication is initiated from the budget
88
+ * management page. This may affect the behavior or UI of the
89
+ * duplication process.
90
+ */
91
+ managePage?: boolean;
92
+ /**
93
+ * loadBudget indicates whether to open the 'original' budget, the
94
+ * new duplicated 'copy' budget, or no budget ('none'). If 'none'
95
+ * duplicate-budget stays on the same page.
96
+ */
97
+ loadBudget?: 'none' | 'original' | 'copy';
98
+ /**
99
+ * onComplete is called when the DuplicateFileModal is closed.
100
+ * @param event the event object will pass back the status of the
101
+ * duplicate process.
102
+ * 'success' if the budget was duplicated.
103
+ * 'failed' if the budget could not be duplicated. This will also
104
+ * pass an error on the event object.
105
+ * 'canceled' if the DuplicateFileModal was canceled.
106
+ * @returns
107
+ */
108
+ onComplete?: (event: {
109
+ status: 'success' | 'failed' | 'canceled';
110
+ error?: Error;
111
+ }) => void;
112
+ };
113
+
81
114
  import: null;
82
115
 
83
116
  'import-ynab4': null;
@@ -115,7 +148,7 @@ type FinanceModals = {
115
148
  'category-autocomplete': {
116
149
  categoryGroups?: CategoryGroupEntity[];
117
150
  onSelect: (categoryId: string, categoryName: string) => void;
118
- month?: string;
151
+ month?: string | undefined;
119
152
  showHiddenCategories?: boolean;
120
153
  onClose?: () => void;
121
154
  };
@@ -131,6 +164,8 @@ type FinanceModals = {
131
164
  onClose?: () => void;
132
165
  };
133
166
 
167
+ 'payee-category-learning': null;
168
+
134
169
  'budget-summary': {
135
170
  month: string;
136
171
  };
@@ -148,6 +183,8 @@ type FinanceModals = {
148
183
 
149
184
  'schedules-discover': null;
150
185
 
186
+ 'schedules-upcoming-length': null;
187
+
151
188
  'schedule-posts-offline-notification': null;
152
189
  'account-menu': {
153
190
  accountId: string;
@@ -255,6 +292,7 @@ type FinanceModals = {
255
292
  transactionId: string;
256
293
  onPost: (transactionId: string) => void;
257
294
  onSkip: (transactionId: string) => void;
295
+ onComplete: (transactionId: string) => void;
258
296
  };
259
297
  'budget-page-menu': {
260
298
  onAddCategoryGroup: () => void;
@@ -278,9 +316,26 @@ type FinanceModals = {
278
316
  confirmReason: string;
279
317
  };
280
318
  'confirm-transaction-delete': {
281
- message?: string;
319
+ message?: string | undefined;
282
320
  onConfirm: () => void;
283
321
  };
322
+ 'edit-user': {
323
+ user: UserEntity | NewUserEntity;
324
+ onSave: (rule: UserEntity) => void;
325
+ };
326
+ 'edit-access': {
327
+ access: UserAccessEntity | NewUserAccessEntity;
328
+ onSave: (rule: UserEntity) => void;
329
+ };
330
+ 'transfer-ownership': {
331
+ onSave: () => void;
332
+ };
333
+ 'enable-openid': {
334
+ onSave: () => void;
335
+ };
336
+ 'enable-password-auth': {
337
+ onSave: () => void;
338
+ };
284
339
  'confirm-unlink-account': {
285
340
  accountName: string;
286
341
  onUnlink: () => void;
@@ -1,21 +1,10 @@
1
- import type { AccountEntity } from '../types/models';
2
- export declare function generateAccount(name: any, isConnected: any, offbudget: any): AccountEntity & {
3
- bankId: number;
4
- bankName: string;
1
+ import type { AccountEntity, CategoryEntity, CategoryGroupEntity, NewCategoryGroupEntity, TransactionEntity } from '../types/models';
2
+ export declare function generateAccount(name: AccountEntity['name'], isConnected?: boolean, offbudget?: boolean): AccountEntity & {
3
+ bankId: number | null;
4
+ bankName: string | null;
5
5
  };
6
- export declare function generateCategory(name: any, group: any, isIncome?: boolean): {
7
- id: string;
8
- name: any;
9
- cat_group: any;
10
- is_income: number;
11
- sort_order: number;
12
- };
13
- export declare function generateCategoryGroup(name: any, isIncome?: boolean): {
14
- id: string;
15
- name: any;
16
- is_income: number;
17
- sort_order: number;
18
- };
19
- export declare function generateCategoryGroups(definition: any): any;
20
- export declare function generateTransaction(data: any, splitAmount?: any, showError?: boolean): any[];
21
- export declare function generateTransactions(count: any, accountId: any, groupId: any, splitAtIndexes?: any[], showError?: boolean): any[];
6
+ export declare function generateCategory(name: string, group: string, isIncome?: boolean): CategoryEntity;
7
+ export declare function generateCategoryGroup(name: string, isIncome?: boolean): CategoryGroupEntity;
8
+ export declare function generateCategoryGroups(definition: Partial<NewCategoryGroupEntity>[]): CategoryGroupEntity[];
9
+ export declare function generateTransaction(data: Partial<TransactionEntity> & Pick<TransactionEntity, 'account'>, splitAmount?: number, showError?: boolean): TransactionEntity[];
10
+ export declare function generateTransactions(count: number, accountId: string, groupId: string, splitAtIndexes?: number[], showError?: boolean): TransactionEntity[];
@@ -1,4 +1,5 @@
1
1
  import type { Handlers } from '../../../types/handlers';
2
+ import type { CategoryGroupEntity } from '../../../types/models';
2
3
  import type { ServerEvents } from '../../../types/server-events';
3
4
 
4
5
  export function init(socketName: string): Promise<unknown>;
@@ -38,7 +39,15 @@ export function unlisten(name: string): void;
38
39
  export type Unlisten = typeof unlisten;
39
40
 
40
41
  /** Mock functions */
41
- export function initServer(handlers: unknown): void;
42
+ export function initServer(handlers: {
43
+ query: (query: { table: string; selectExpressions: unknown }) => Promise<{
44
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
+ data: any;
46
+ dependencies: string[];
47
+ }>;
48
+ getCell?: () => { value: number };
49
+ 'get-categories'?: () => { grouped: CategoryGroupEntity[] };
50
+ }): void;
42
51
  export type InitServer = typeof initServer;
43
52
 
44
53
  export function serverPush(name: string, args: unknown): void;
@@ -1,13 +1,17 @@
1
- import { type ModalType } from '../../client/state-types/modals';
1
+ import { OptionlessModal } from '../../../client/state-types/modals';
2
+ import { UndoState as ServerUndoState } from '../../../server/undo';
2
3
 
3
4
  export type UndoState = {
4
- id?: string;
5
- url: unknown;
6
- openModal: ModalType;
5
+ url: string | null;
6
+ // Right now, only the payees page uses this. It's only being set to
7
+ // `manage-rules` which is an optionless modal. Do we want to also
8
+ // support modals with options?
9
+ openModal: OptionlessModal | null;
7
10
  selectedItems: {
8
11
  name: string;
9
12
  items: Set<string>;
10
13
  } | null;
14
+ undoEvent: ServerUndoState | null;
11
15
  };
12
16
 
13
17
  export function setUndoState<K extends keyof Omit<UndoState, 'id'>>(
@@ -9,7 +9,7 @@ export type Init = typeof init;
9
9
 
10
10
  export function send<K extends keyof ServerEvents>(
11
11
  type: K,
12
- args?: ServerEvents[k],
12
+ args?: ServerEvents[K],
13
13
  ): void;
14
14
  export type Send = typeof send;
15
15
 
@@ -1,6 +1,6 @@
1
1
  import { AccountEntity } from '../../types/models';
2
2
  export declare function getGoCardlessAccounts(userId: any, userKey: any, id: any): Promise<any>;
3
- export declare function reconcileTransactions(acctId: any, transactions: any, isBankSyncAccount?: boolean, strictIdChecking?: boolean, isPreview?: boolean): Promise<{
3
+ export declare function reconcileTransactions(acctId: any, transactions: any, isBankSyncAccount?: boolean, strictIdChecking?: boolean, isPreview?: boolean, defaultCleared?: boolean): Promise<{
4
4
  added: any[];
5
5
  updated: any[];
6
6
  updatedPreview: any[];
@@ -1,4 +1,4 @@
1
- import { type TransactionEntity, type RuleActionEntity, type RuleEntity } from '../../types/models';
1
+ import { type TransactionEntity, type RuleActionEntity, type RuleEntity, AccountEntity } from '../../types/models';
2
2
  import { Action, Rule } from './rules';
3
3
  export { iterateIds } from './rules';
4
4
  export declare function resetState(): void;
@@ -19,7 +19,7 @@ export declare function insertRule(rule: Omit<RuleEntity, 'id'> & {
19
19
  }): Promise<any>;
20
20
  export declare function updateRule(rule: any): Promise<void>;
21
21
  export declare function deleteRule(id: string): Promise<boolean>;
22
- export declare function runRules(trans: any): Promise<TransactionEntity>;
22
+ export declare function runRules(trans: any, accounts?: Map<string, AccountEntity> | null): Promise<TransactionEntity>;
23
23
  export declare function conditionsToAQL(conditions: any, { recurDateBounds }?: {
24
24
  recurDateBounds?: number;
25
25
  }): {
@@ -31,9 +31,6 @@ export declare function applyActions(transactions: TransactionEntity[], actions:
31
31
  updated: TransactionEntity[] | ({
32
32
  id: any;
33
33
  transfer_id: any;
34
- } | {
35
- id: any;
36
- payee: any;
37
34
  } | {
38
35
  id: any;
39
36
  category: any;
@@ -45,6 +42,7 @@ export declare function getProbableCategory(transactions: any): any;
45
42
  export declare function updateCategoryRules(transactions: any): Promise<void>;
46
43
  export type TransactionForRules = TransactionEntity & {
47
44
  payee_name?: string;
45
+ _account?: AccountEntity;
48
46
  };
49
- export declare function prepareTransactionForRules(trans: TransactionEntity): Promise<TransactionForRules>;
47
+ export declare function prepareTransactionForRules(trans: TransactionEntity, accounts?: Map<string, AccountEntity> | null): Promise<TransactionForRules>;
50
48
  export declare function finalizeTransactionForRules(trans: TransactionEntity | TransactionForRules): Promise<TransactionEntity>;
@@ -9,9 +9,6 @@ export declare function batchUpdateTransactions({ added, deleted, updated, learn
9
9
  updated: TransactionEntity[] | ({
10
10
  id: any;
11
11
  transfer_id: any;
12
- } | {
13
- id: any;
14
- payee: any;
15
12
  } | {
16
13
  id: any;
17
14
  category: any;
@@ -1,11 +1,7 @@
1
1
  export declare function addTransfer(transaction: any, transferredAccount: any): Promise<{
2
- id: any;
3
- payee: any;
4
- } | {
5
2
  category?: any;
6
3
  id: any;
7
4
  transfer_id: any;
8
- payee?: undefined;
9
5
  }>;
10
6
  export declare function removeTransfer(transaction: any): Promise<{
11
7
  id: any;
@@ -16,21 +12,14 @@ export declare function updateTransfer(transaction: any, transferredAccount: any
16
12
  category: any;
17
13
  }>;
18
14
  export declare function onInsert(transaction: any): Promise<{
19
- id: any;
20
- payee: any;
21
- } | {
22
15
  category?: any;
23
16
  id: any;
24
17
  transfer_id: any;
25
- payee?: undefined;
26
18
  }>;
27
19
  export declare function onDelete(transaction: any): Promise<void>;
28
20
  export declare function onUpdate(transaction: any): Promise<{
29
21
  id: any;
30
22
  transfer_id: any;
31
- } | {
32
- id: any;
33
- payee: any;
34
23
  } | {
35
24
  id: any;
36
25
  category: any;
@@ -0,0 +1,17 @@
1
+ import { AdminHandlers } from './types/handlers';
2
+ export declare const app: {
3
+ events: import("mitt").Emitter<{
4
+ sync: import("../../types/server-events").ServerEvents["sync-event"];
5
+ 'load-budget': {
6
+ id: string;
7
+ };
8
+ }>;
9
+ handlers: AdminHandlers;
10
+ services: (() => () => void)[];
11
+ unlistenServices: (() => void)[];
12
+ method<Name extends "users-get" | "user-delete-all" | "user-add" | "user-update" | "access-add" | "access-delete-all" | "access-get-available-users" | "transfer-ownership" | "owner-created">(name: Name, func: AdminHandlers[Name]): void;
13
+ service(func: () => () => void): void;
14
+ combine(...apps: any[]): void;
15
+ startServices(): void;
16
+ stopServices(): void;
17
+ };
@@ -0,0 +1,43 @@
1
+ import { UserAvailable, UserEntity } from '../../../types/models/user';
2
+ import { NewUserAccessEntity } from '../../../types/models/userAccess';
3
+ export interface AdminHandlers {
4
+ 'users-get': () => Promise<UserEntity[] | null | {
5
+ error: string;
6
+ }>;
7
+ 'user-delete-all': (ids: string[]) => Promise<{
8
+ someDeletionsFailed: boolean;
9
+ ids?: number[];
10
+ } | {
11
+ error: string;
12
+ }>;
13
+ 'user-add': (user: Omit<UserEntity, 'id'>) => Promise<{
14
+ error: string;
15
+ } | {
16
+ id: string;
17
+ }>;
18
+ 'user-update': (user: Omit<UserEntity, 'id'>) => Promise<{
19
+ error: string;
20
+ } | {
21
+ id: string;
22
+ }>;
23
+ 'access-add': (user: NewUserAccessEntity) => Promise<{
24
+ error?: string;
25
+ } | Record<string, never>>;
26
+ 'access-delete-all': ({ fileId, ids, }: {
27
+ fileId: string;
28
+ ids: string[];
29
+ }) => Promise<{
30
+ someDeletionsFailed: boolean;
31
+ ids?: number[];
32
+ }>;
33
+ 'access-get-available-users': (fileId: string) => Promise<UserAvailable[] | {
34
+ error: string;
35
+ }>;
36
+ 'transfer-ownership': ({ fileId, newUserId, }: {
37
+ fileId: string;
38
+ newUserId: string;
39
+ }) => Promise<{
40
+ error?: string;
41
+ } | Record<string, never>>;
42
+ 'owner-created': () => Promise<boolean>;
43
+ }
@@ -1,11 +1,21 @@
1
+ import { type Emitter } from 'mitt';
2
+ import { ServerEvents } from '../types/server-events';
3
+ type Events = {
4
+ sync: ServerEvents['sync-event'];
5
+ 'load-budget': {
6
+ id: string;
7
+ };
8
+ };
9
+ type UnlistenService = () => void;
10
+ type Service = () => UnlistenService;
1
11
  declare class App<Handlers> {
2
- events: any;
12
+ events: Emitter<Events>;
3
13
  handlers: Handlers;
4
- services: any;
5
- unlistenServices: any;
14
+ services: Service[];
15
+ unlistenServices: UnlistenService[];
6
16
  constructor();
7
17
  method<Name extends string & keyof Handlers>(name: Name, func: Handlers[Name]): void;
8
- service(func: any): void;
18
+ service(func: Service): void;
9
19
  combine(...apps: any[]): void;
10
20
  startServices(): void;
11
21
  stopServices(): void;
@@ -1,3 +1,4 @@
1
+ import { QueryState } from '../../shared/query';
1
2
  export declare function quoteAlias(alias: any): any;
2
3
  export declare function isAggregateQuery(queryState: any): boolean;
3
4
  export type SchemaConfig = {
@@ -7,10 +8,7 @@ export type SchemaConfig = {
7
8
  tableOptions: any;
8
9
  }) => unknown);
9
10
  tableFilters?: (name: string) => unknown[];
10
- customizeQuery?: <T extends {
11
- table: string;
12
- orderExpressions: unknown[];
13
- }>(queryString: T) => T;
11
+ customizeQuery?: (queryString: QueryState) => QueryState;
14
12
  views?: Record<string, {
15
13
  fields?: Record<string, string>;
16
14
  [key: `v_${string}`]: string | ((internalFields: any, publicFields: any) => string);
@@ -24,8 +22,8 @@ export declare function compileQuery(queryState: any, schema: any, schemaConfig?
24
22
  where: string;
25
23
  groupBy: string;
26
24
  orderBy: string;
27
- limit: any;
28
- offset: any;
25
+ limit: number;
26
+ offset: number;
29
27
  };
30
28
  state: {
31
29
  schema: any;
@@ -273,6 +273,9 @@ export declare const schema: {
273
273
  group_by: {
274
274
  type: string;
275
275
  };
276
+ sort_by: {
277
+ type: string;
278
+ };
276
279
  balance_type: {
277
280
  type: string;
278
281
  };
@@ -30,6 +30,12 @@ export declare function setZero({ month }: {
30
30
  export declare function set3MonthAvg({ month, }: {
31
31
  month: string;
32
32
  }): Promise<void>;
33
+ export declare function set12MonthAvg({ month, }: {
34
+ month: string;
35
+ }): Promise<void>;
36
+ export declare function set6MonthAvg({ month, }: {
37
+ month: string;
38
+ }): Promise<void>;
33
39
  export declare function setNMonthAvg({ month, N, category, }: {
34
40
  month: string;
35
41
  N: number;
@@ -1,11 +1,16 @@
1
1
  import { BudgetHandlers } from './types/handlers';
2
2
  export declare const app: {
3
- events: any;
3
+ events: import("mitt").Emitter<{
4
+ sync: import("../../types/server-events").ServerEvents["sync-event"];
5
+ 'load-budget': {
6
+ id: string;
7
+ };
8
+ }>;
4
9
  handlers: BudgetHandlers;
5
- services: any;
6
- unlistenServices: any;
7
- method<Name extends "budget/budget-amount" | "budget/copy-previous-month" | "budget/set-zero" | "budget/set-3month-avg" | "budget/check-templates" | "budget/apply-goal-template" | "budget/overwrite-goal-template" | "budget/cleanup-goal-template" | "budget/hold-for-next-month" | "budget/reset-hold" | "budget/cover-overspending" | "budget/transfer-available" | "budget/cover-overbudgeted" | "budget/transfer-category" | "budget/set-carryover" | "budget/apply-single-template" | "budget/set-n-month-avg" | "budget/copy-single-month" | "budget/apply-multiple-templates">(name: Name, func: BudgetHandlers[Name]): void;
8
- service(func: any): void;
10
+ services: (() => () => void)[];
11
+ unlistenServices: (() => void)[];
12
+ method<Name extends "budget/budget-amount" | "budget/copy-previous-month" | "budget/set-zero" | "budget/set-3month-avg" | "budget/set-6month-avg" | "budget/set-12month-avg" | "budget/check-templates" | "budget/apply-goal-template" | "budget/overwrite-goal-template" | "budget/cleanup-goal-template" | "budget/hold-for-next-month" | "budget/reset-hold" | "budget/cover-overspending" | "budget/transfer-available" | "budget/cover-overbudgeted" | "budget/transfer-category" | "budget/set-carryover" | "budget/apply-single-template" | "budget/set-n-month-avg" | "budget/copy-single-month" | "budget/apply-multiple-templates">(name: Name, func: BudgetHandlers[Name]): void;
13
+ service(func: () => () => void): void;
9
14
  combine(...apps: any[]): void;
10
15
  startServices(): void;
11
16
  stopServices(): void;
@@ -1,6 +1,7 @@
1
+ import { CategoryEntity } from '../../types/models';
1
2
  import { Template } from './types/templates';
2
3
  export declare class CategoryTemplate {
3
- static init(templates: Template[], categoryID: string, month: any): Promise<CategoryTemplate>;
4
+ static init(templates: Template[], category: CategoryEntity, month: any): Promise<CategoryTemplate>;
4
5
  getPriorities(): number[];
5
6
  getRemainderWeight(): number;
6
7
  getLimitExcess(): number;
@@ -12,7 +13,7 @@ export declare class CategoryTemplate {
12
13
  goal: any;
13
14
  longGoal: any;
14
15
  };
15
- readonly categoryID: string;
16
+ readonly category: CategoryEntity;
16
17
  private month;
17
18
  private templates;
18
19
  private remainder;
@@ -1,6 +1,8 @@
1
- export declare function goalsSchedule(scheduleFlag: any, template_lines: any, current_month: any, balance: any, remainder: any, last_month_balance: any, to_budget: any, errors: any, category: any): Promise<{
2
- to_budget: any;
3
- errors: any;
4
- remainder: any;
5
- scheduleFlag: any;
1
+ import { CategoryEntity } from '../../types/models';
2
+ import { Template } from './types/templates';
3
+ export declare function goalsSchedule(scheduleFlag: boolean, template_lines: Template[], current_month: string, balance: number, remainder: number, last_month_balance: number, to_budget: number, errors: string[], category: CategoryEntity): Promise<{
4
+ to_budget: number;
5
+ errors: string[];
6
+ remainder: number;
7
+ scheduleFlag: true;
6
8
  }>;
@@ -13,6 +13,10 @@ export interface BudgetHandlers {
13
13
 
14
14
  'budget/set-3month-avg': (arg: { month: string }) => Promise<void>;
15
15
 
16
+ 'budget/set-6month-avg': (arg: { month: string }) => Promise<void>;
17
+
18
+ 'budget/set-12month-avg': (arg: { month: string }) => Promise<void>;
19
+
16
20
  'budget/check-templates': () => Promise<Notification>;
17
21
 
18
22
  'budget/apply-goal-template': (arg: {
@@ -1,3 +1,9 @@
1
+ export interface UsersWithAccess {
2
+ userId: string;
3
+ userName: string;
4
+ displayName: string;
5
+ owner: boolean;
6
+ }
1
7
  export interface RemoteFile {
2
8
  deleted: boolean;
3
9
  fileId: string;
@@ -5,6 +11,8 @@ export interface RemoteFile {
5
11
  name: string;
6
12
  encryptKeyId: string;
7
13
  hasKey: boolean;
14
+ owner: string;
15
+ usersWithAccess: UsersWithAccess[];
8
16
  }
9
17
  export declare function checkKey(): Promise<{
10
18
  valid: boolean;
@@ -27,6 +35,7 @@ export declare function upload(): Promise<void>;
27
35
  export declare function possiblyUpload(): Promise<void>;
28
36
  export declare function removeFile(fileId: any): Promise<void>;
29
37
  export declare function listRemoteFiles(): Promise<RemoteFile[] | null>;
38
+ export declare function getRemoteFile(fileId: string): Promise<RemoteFile | null>;
30
39
  export declare function download(fileId: any): Promise<{
31
40
  id: any;
32
41
  }>;
@@ -1,11 +1,16 @@
1
1
  import { DashboardHandlers } from './types/handlers';
2
2
  export declare const app: {
3
- events: any;
3
+ events: import("mitt").Emitter<{
4
+ sync: import("../../types/server-events").ServerEvents["sync-event"];
5
+ 'load-budget': {
6
+ id: string;
7
+ };
8
+ }>;
4
9
  handlers: DashboardHandlers;
5
- services: any;
6
- unlistenServices: any;
10
+ services: (() => () => void)[];
11
+ unlistenServices: (() => void)[];
7
12
  method<Name extends "dashboard-update" | "dashboard-update-widget" | "dashboard-reset" | "dashboard-add-widget" | "dashboard-remove-widget" | "dashboard-import">(name: Name, func: DashboardHandlers[Name]): void;
8
- service(func: any): void;
13
+ service(func: () => () => void): void;
9
14
  combine(...apps: any[]): void;
10
15
  startServices(): void;
11
16
  stopServices(): void;
@@ -80,6 +80,7 @@ export declare function updateCategory(category: any): Promise<void>;
80
80
  export declare function moveCategory(id: any, groupId: any, targetId?: string): Promise<void>;
81
81
  export declare function deleteCategory(category: any, transferId?: string): Promise<void>;
82
82
  export declare function getPayee(id: any): Promise<any>;
83
+ export declare function getAccount(id: any): Promise<any>;
83
84
  export declare function insertPayee(payee: any): Promise<any>;
84
85
  export declare function deletePayee(payee: any): Promise<void>;
85
86
  export declare function deleteTransferPayee(payee: any): Promise<void>;
@@ -1,11 +1,16 @@
1
1
  import { FiltersHandlers } from './types/handlers';
2
2
  export declare const app: {
3
- events: any;
3
+ events: import("mitt").Emitter<{
4
+ sync: import("../../types/server-events").ServerEvents["sync-event"];
5
+ 'load-budget': {
6
+ id: string;
7
+ };
8
+ }>;
4
9
  handlers: FiltersHandlers;
5
- services: any;
6
- unlistenServices: any;
10
+ services: (() => () => void)[];
11
+ unlistenServices: (() => void)[];
7
12
  method<Name extends "filter-create" | "filter-update" | "filter-delete">(name: Name, func: FiltersHandlers[Name]): void;
8
- service(func: any): void;
13
+ service(func: () => () => void): void;
9
14
  combine(...apps: any[]): void;
10
15
  startServices(): void;
11
16
  stopServices(): void;
@@ -1,5 +1,3 @@
1
- /* eslint-disable import/no-unused-modules */
2
-
3
1
  export namespace YNAB4 {
4
2
  export interface YFull {
5
3
  masterCategories: MasterCategory[];
@@ -1,5 +1,3 @@
1
- /* eslint-disable import/no-unused-modules */
2
-
3
1
  export namespace YNAB5 {
4
2
  export interface Budget {
5
3
  name?: string;