@actual-app/api 6.7.1 → 6.8.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 (175) hide show
  1. package/@types/app/bundle.api.d.ts +6 -0
  2. package/@types/app/query.d.ts +19 -0
  3. package/@types/index.d.ts +7 -0
  4. package/@types/injected.d.ts +2 -0
  5. package/@types/jest.config.d.ts +9 -0
  6. package/@types/loot-core/client/actions/types.d.ts +6 -0
  7. package/@types/loot-core/client/constants.d.ts +29 -0
  8. package/@types/loot-core/client/platform.d.ts +4 -0
  9. package/@types/loot-core/client/state-types/account.d.ts +27 -0
  10. package/@types/loot-core/client/state-types/app.d.ts +37 -0
  11. package/@types/loot-core/client/state-types/budgets.d.ts +36 -0
  12. package/@types/loot-core/client/state-types/index.d.ts +41 -0
  13. package/@types/loot-core/client/state-types/modals.d.ts +292 -0
  14. package/@types/loot-core/client/state-types/notifications.d.ts +38 -0
  15. package/@types/loot-core/client/state-types/prefs.d.ts +28 -0
  16. package/@types/loot-core/client/state-types/queries.d.ts +69 -0
  17. package/@types/loot-core/client/state-types/user.d.ts +13 -0
  18. package/@types/loot-core/mocks/budget.d.ts +2 -0
  19. package/@types/loot-core/mocks/index.d.ts +26 -0
  20. package/@types/loot-core/mocks/random.d.ts +1 -0
  21. package/@types/loot-core/mocks/util.d.ts +7 -0
  22. package/@types/loot-core/platform/client/fetch/index.d.ts +48 -0
  23. package/@types/loot-core/platform/client/undo/index.d.ts +29 -0
  24. package/@types/loot-core/platform/exceptions/index.d.ts +5 -0
  25. package/@types/loot-core/platform/server/asyncStorage/index.d.ts +20 -0
  26. package/@types/loot-core/platform/server/connection/index.d.ts +23 -0
  27. package/@types/loot-core/platform/server/fetch/index.d.ts +4 -0
  28. package/@types/loot-core/platform/server/fs/index.d.ts +71 -0
  29. package/@types/loot-core/platform/server/fs/path-join.d.ts +2 -0
  30. package/@types/loot-core/platform/server/indexeddb/index.d.ts +24 -0
  31. package/@types/loot-core/platform/server/log/index.d.ts +9 -0
  32. package/@types/loot-core/platform/server/sqlite/index.d.ts +35 -0
  33. package/@types/loot-core/server/accounts/export-to-csv.d.ts +2 -0
  34. package/@types/loot-core/server/accounts/link.d.ts +1 -0
  35. package/@types/loot-core/server/accounts/ofx2json.d.ts +14 -0
  36. package/@types/loot-core/server/accounts/parse-file.d.ts +15 -0
  37. package/@types/loot-core/server/accounts/payees.d.ts +5 -0
  38. package/@types/loot-core/server/accounts/qif2json.d.ts +26 -0
  39. package/@types/loot-core/server/accounts/rules.d.ts +90 -0
  40. package/@types/loot-core/server/accounts/sync.d.ts +13 -0
  41. package/@types/loot-core/server/accounts/title/index.d.ts +3 -0
  42. package/@types/loot-core/server/accounts/title/lower-case.d.ts +1 -0
  43. package/@types/loot-core/server/accounts/title/specials.d.ts +1 -0
  44. package/@types/loot-core/server/accounts/transaction-rules.d.ts +47 -0
  45. package/@types/loot-core/server/accounts/transactions.d.ts +33 -0
  46. package/@types/loot-core/server/accounts/transfer.d.ts +37 -0
  47. package/@types/loot-core/server/accounts/xmlcamt2json.d.ts +10 -0
  48. package/@types/loot-core/server/api-models.d.ts +66 -0
  49. package/@types/loot-core/server/api.d.ts +3 -0
  50. package/@types/loot-core/server/app.d.ts +14 -0
  51. package/@types/loot-core/server/aql/compiler.d.ts +56 -0
  52. package/@types/loot-core/server/aql/exec.d.ts +9 -0
  53. package/@types/loot-core/server/aql/index.d.ts +5 -0
  54. package/@types/loot-core/server/aql/schema/executors.d.ts +6 -0
  55. package/@types/loot-core/server/aql/schema/index.d.ts +340 -0
  56. package/@types/loot-core/server/aql/schema/run-query.d.ts +6 -0
  57. package/@types/loot-core/server/aql/schema-helpers.d.ts +8 -0
  58. package/@types/loot-core/server/aql/views.d.ts +1 -0
  59. package/@types/loot-core/server/backups.d.ts +16 -0
  60. package/@types/loot-core/server/backups.test.d.ts +1 -0
  61. package/@types/loot-core/server/budget/actions.d.ts +63 -0
  62. package/@types/loot-core/server/budget/app.d.ts +12 -0
  63. package/@types/loot-core/server/budget/base.d.ts +17 -0
  64. package/@types/loot-core/server/budget/cleanup-template.d.ts +4 -0
  65. package/@types/loot-core/server/budget/goals/goalsAverage.d.ts +4 -0
  66. package/@types/loot-core/server/budget/goals/goalsBy.d.ts +5 -0
  67. package/@types/loot-core/server/budget/goals/goalsPercentage.d.ts +4 -0
  68. package/@types/loot-core/server/budget/goals/goalsRemainder.d.ts +8 -0
  69. package/@types/loot-core/server/budget/goals/goalsSchedule.d.ts +6 -0
  70. package/@types/loot-core/server/budget/goals/goalsSimple.d.ts +7 -0
  71. package/@types/loot-core/server/budget/goals/goalsSpend.d.ts +4 -0
  72. package/@types/loot-core/server/budget/goals/goalsWeek.d.ts +7 -0
  73. package/@types/loot-core/server/budget/goaltemplates.d.ts +12 -0
  74. package/@types/loot-core/server/budget/report.d.ts +2 -0
  75. package/@types/loot-core/server/budget/rollover.d.ts +4 -0
  76. package/@types/loot-core/server/budget/types/handlers.d.ts +77 -0
  77. package/@types/loot-core/server/budget/util.d.ts +4 -0
  78. package/@types/loot-core/server/cloud-storage.d.ts +33 -0
  79. package/@types/loot-core/server/db/index.d.ts +60 -0
  80. package/@types/loot-core/server/db/mappings.d.ts +3 -0
  81. package/@types/loot-core/server/db/sort.d.ts +11 -0
  82. package/@types/loot-core/server/db/util.d.ts +2 -0
  83. package/@types/loot-core/server/encryption-internals.d.ts +24 -0
  84. package/@types/loot-core/server/encryption-internals.web.d.ts +24 -0
  85. package/@types/loot-core/server/encryption.d.ts +41 -0
  86. package/@types/loot-core/server/encryption.test.d.ts +1 -0
  87. package/@types/loot-core/server/errors.d.ts +73 -0
  88. package/@types/loot-core/server/filters/app.d.ts +12 -0
  89. package/@types/loot-core/server/filters/types/handlers.d.ts +7 -0
  90. package/@types/loot-core/server/importers/actual.d.ts +4 -0
  91. package/@types/loot-core/server/importers/index.d.ts +6 -0
  92. package/@types/loot-core/server/importers/ynab4-types.d.ts +167 -0
  93. package/@types/loot-core/server/importers/ynab4.d.ts +5 -0
  94. package/@types/loot-core/server/importers/ynab5-types.d.ts +79 -0
  95. package/@types/loot-core/server/importers/ynab5.d.ts +5 -0
  96. package/@types/loot-core/server/main-app.d.ts +12 -0
  97. package/@types/loot-core/server/main.d.ts +28 -0
  98. package/@types/loot-core/server/main.test.d.ts +1 -0
  99. package/@types/loot-core/server/migrate/migrations.d.ts +9 -0
  100. package/@types/loot-core/server/models.d.ts +38 -0
  101. package/@types/loot-core/server/mutators.d.ts +17 -0
  102. package/@types/loot-core/server/notes/app.d.ts +12 -0
  103. package/@types/loot-core/server/notes/types/handlers.d.ts +3 -0
  104. package/@types/loot-core/server/platform.d.ts +3 -0
  105. package/@types/loot-core/server/platform.web.d.ts +3 -0
  106. package/@types/loot-core/server/polyfills.d.ts +0 -0
  107. package/@types/loot-core/server/post.d.ts +3 -0
  108. package/@types/loot-core/server/prefs.d.ts +10 -0
  109. package/@types/loot-core/server/reports/app.d.ts +12 -0
  110. package/@types/loot-core/server/reports/types/handlers.d.ts +6 -0
  111. package/@types/loot-core/server/rules/app.d.ts +12 -0
  112. package/@types/loot-core/server/rules/types/handlers.d.ts +42 -0
  113. package/@types/loot-core/server/schedules/app.d.ts +35 -0
  114. package/@types/loot-core/server/schedules/find-schedules.d.ts +1 -0
  115. package/@types/loot-core/server/schedules/types/handlers.d.ts +31 -0
  116. package/@types/loot-core/server/server-config.d.ts +10 -0
  117. package/@types/loot-core/server/sheet.d.ts +11 -0
  118. package/@types/loot-core/server/sheet.test.d.ts +1 -0
  119. package/@types/loot-core/server/spreadsheet/globals.d.ts +1 -0
  120. package/@types/loot-core/server/spreadsheet/graph-data-structure.d.ts +15 -0
  121. package/@types/loot-core/server/spreadsheet/spreadsheet.d.ts +79 -0
  122. package/@types/loot-core/server/spreadsheet/util.d.ts +5 -0
  123. package/@types/loot-core/server/sync/encoder.d.ts +9 -0
  124. package/@types/loot-core/server/sync/index.d.ts +47 -0
  125. package/@types/loot-core/server/sync/make-test-message.d.ts +10 -0
  126. package/@types/loot-core/server/sync/migrate.d.ts +2 -0
  127. package/@types/loot-core/server/sync/repair.d.ts +6 -0
  128. package/@types/loot-core/server/sync/reset.d.ts +6 -0
  129. package/@types/loot-core/server/sync/utils.d.ts +3 -0
  130. package/@types/loot-core/server/tools/app.d.ts +12 -0
  131. package/@types/loot-core/server/tools/types/handlers.d.ts +7 -0
  132. package/@types/loot-core/server/undo.d.ts +14 -0
  133. package/@types/loot-core/server/update.d.ts +1 -0
  134. package/@types/loot-core/server/util/budget-name.d.ts +2 -0
  135. package/@types/loot-core/server/util/rschedule.d.ts +5 -0
  136. package/@types/loot-core/shared/async.d.ts +3 -0
  137. package/@types/loot-core/shared/environment.d.ts +4 -0
  138. package/@types/loot-core/shared/errors.d.ts +22 -0
  139. package/@types/loot-core/shared/months.d.ts +62 -0
  140. package/@types/loot-core/shared/query.d.ts +31 -0
  141. package/@types/loot-core/shared/rules.d.ts +62 -0
  142. package/@types/loot-core/shared/schedules.d.ts +43 -0
  143. package/@types/loot-core/shared/transactions.d.ts +91 -0
  144. package/@types/loot-core/shared/util.d.ts +67 -0
  145. package/@types/loot-core/types/api-handlers.d.ts +158 -0
  146. package/@types/loot-core/types/budget.d.ts +7 -0
  147. package/@types/loot-core/types/file.d.ts +38 -0
  148. package/@types/loot-core/types/handlers.d.ts +23 -0
  149. package/@types/loot-core/types/models/account.d.ts +21 -0
  150. package/@types/loot-core/types/models/category-group.d.ts +11 -0
  151. package/@types/loot-core/types/models/category.d.ts +9 -0
  152. package/@types/loot-core/types/models/gocardless.d.ts +14 -0
  153. package/@types/loot-core/types/models/index.d.ts +12 -0
  154. package/@types/loot-core/types/models/note.d.ts +4 -0
  155. package/@types/loot-core/types/models/payee.d.ts +10 -0
  156. package/@types/loot-core/types/models/reports.d.ts +123 -0
  157. package/@types/loot-core/types/models/rule.d.ts +71 -0
  158. package/@types/loot-core/types/models/schedule.d.ts +58 -0
  159. package/@types/loot-core/types/models/simplefin.d.ts +10 -0
  160. package/@types/loot-core/types/models/transaction-filter.d.ts +7 -0
  161. package/@types/loot-core/types/models/transaction.d.ts +40 -0
  162. package/@types/loot-core/types/prefs.d.ts +69 -0
  163. package/@types/loot-core/types/server-events.d.ts +21 -0
  164. package/@types/loot-core/types/server-handlers.d.ts +344 -0
  165. package/@types/loot-core/types/util.d.ts +5 -0
  166. package/@types/methods.d.ts +85 -0
  167. package/@types/methods.test.d.ts +1 -0
  168. package/@types/migrations/1632571489012_remove_cache.d.ts +1 -0
  169. package/@types/utils.d.ts +2 -0
  170. package/@types/validateNodeVersion.d.ts +1 -0
  171. package/dist/app/bundle.api.js +430 -5643
  172. package/dist/methods.js +25 -1
  173. package/dist/methods.test.js +205 -5
  174. package/dist/package.json +7 -5
  175. package/package.json +7 -5
@@ -0,0 +1,6 @@
1
+ export = __webpack_exports__;
2
+ export = __webpack_exports__;
3
+ /******/
4
+ /************************************************************************/
5
+ /******/
6
+ /******/ /******/ /******/ /******/ declare var __webpack_exports__: any;
@@ -0,0 +1,19 @@
1
+ export function q(table: any): Query;
2
+ declare class Query {
3
+ constructor(state: any);
4
+ state: any;
5
+ filter(expr: any): Query;
6
+ unfilter(exprs: any): Query;
7
+ select(exprs?: any[]): Query;
8
+ calculate(expr: any): Query;
9
+ groupBy(exprs: any): Query;
10
+ orderBy(exprs: any): Query;
11
+ limit(num: any): Query;
12
+ offset(num: any): Query;
13
+ raw(): Query;
14
+ withDead(): Query;
15
+ withoutValidatedRefs(): Query;
16
+ options(opts: any): Query;
17
+ serialize(): any;
18
+ }
19
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { InitConfig } from './loot-core/server/main';
2
+ export declare const internal: any;
3
+ export * as methods from './methods';
4
+ export * from './methods';
5
+ export * as utils from './utils';
6
+ export declare function init(config?: InitConfig): Promise<any>;
7
+ export declare function shutdown(): Promise<void>;
@@ -0,0 +1,2 @@
1
+ export function override(sendImplementation: any): void;
2
+ export let send: any;
@@ -0,0 +1,9 @@
1
+ export const moduleFileExtensions: string[];
2
+ export const testEnvironment: string;
3
+ export const testPathIgnorePatterns: string[];
4
+ export const watchPathIgnorePatterns: string[];
5
+ export const setupFilesAfterEnv: string[];
6
+ export const transformIgnorePatterns: string[];
7
+ export const transform: {
8
+ '^.+\\.(t|j)sx?$': string;
9
+ };
@@ -0,0 +1,6 @@
1
+ import type { ThunkDispatch } from 'redux-thunk';
2
+
3
+ import type { State, Action } from '../state-types';
4
+
5
+ export type Dispatch = ThunkDispatch<State, never, Action>;
6
+ export type GetState = () => State;
@@ -0,0 +1,29 @@
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_PAYEES = "LOAD_PAYEES";
9
+ export declare const SET_PREFS = "SET_PREFS";
10
+ export declare const MERGE_LOCAL_PREFS = "MERGE_LOCAL_PREFS";
11
+ export declare const MERGE_GLOBAL_PREFS = "MERGE_GLOBAL_PREFS";
12
+ export declare const SET_BUDGETS = "SET_BUDGETS";
13
+ export declare const SET_REMOTE_FILES = "SET_REMOTE_FILES";
14
+ export declare const SET_ALL_FILES = "SET_ALL_FILES";
15
+ export declare const CLOSE_BUDGET = "CLOSE_BUDGET";
16
+ export declare const SET_APP_STATE = "SET_APP_STATE";
17
+ export declare const PUSH_MODAL = "PUSH_MODAL";
18
+ export declare const REPLACE_MODAL = "REPLACE_MODAL";
19
+ export declare const CLOSE_MODAL = "CLOSE_MODAL";
20
+ export declare const COLLAPSE_MODALS = "COLLAPSE_MODALS";
21
+ export declare const POP_MODAL = "POP_MODAL";
22
+ export declare const ADD_NOTIFICATION = "ADD_NOTIFICATION";
23
+ export declare const REMOVE_NOTIFICATION = "REMOVE_NOTIFICATION";
24
+ export declare const GET_USER_DATA = "GET_USER_DATA";
25
+ export declare const SET_LAST_UNDO_STATE = "SET_LAST_UNDO_STATE";
26
+ export declare const SET_LAST_SPLIT_STATE = "SET_LAST_SPLIT_STATE";
27
+ export declare const SET_ACCOUNTS_SYNCING = "SET_ACCOUNTS_SYNCING";
28
+ export declare const ACCOUNT_SYNC_STATUS = "ACCOUNT_SYNC_STATUS";
29
+ export declare const SIGN_OUT = "SIGN_OUT";
@@ -0,0 +1,4 @@
1
+ export declare const isPlaywright = false;
2
+ export declare const OS: 'windows' | 'mac' | 'linux' | 'unknown';
3
+ export declare const env: 'web' | 'mobile' | 'unknown';
4
+ export declare const isBrowser = false;
@@ -0,0 +1,27 @@
1
+ import type * as constants from '../constants';
2
+
3
+ export type AccountState = {
4
+ failedAccounts: Map<string, { type: string; code: string }>;
5
+ accountsSyncing: string[];
6
+ };
7
+
8
+ export type SetAccountsSyncingAction = {
9
+ type: typeof constants.SET_ACCOUNTS_SYNCING;
10
+ ids: string[];
11
+ };
12
+
13
+ export type AccountSyncStatusAction = {
14
+ type: typeof constants.ACCOUNT_SYNC_STATUS;
15
+ id: string;
16
+ } & (
17
+ | {
18
+ failed: false;
19
+ }
20
+ | {
21
+ failed: true;
22
+ errorType: string;
23
+ errorCode: string;
24
+ }
25
+ );
26
+
27
+ export type AccountActions = SetAccountsSyncingAction | AccountSyncStatusAction;
@@ -0,0 +1,37 @@
1
+ import type { UndoState } from '../../server/undo';
2
+ import type * as constants from '../constants';
3
+
4
+ export type SplitState = { ids: Set<string>; mode: 'collapse' | 'expand' };
5
+
6
+ export type AppState = {
7
+ loadingText: string | null;
8
+ updateInfo: {
9
+ version: string;
10
+ releaseDate: string;
11
+ releaseNotes: string;
12
+ } | null;
13
+ showUpdateNotification: boolean;
14
+ managerHasInitialized: boolean;
15
+ lastUndoState: { current: UndoState | null };
16
+ lastSplitState: { current: SplitState | null };
17
+ };
18
+
19
+ export type SetAppStateAction = {
20
+ type: typeof constants.SET_APP_STATE;
21
+ state: Partial<AppState>;
22
+ };
23
+
24
+ export type SetLastUndoStateAction = {
25
+ type: typeof constants.SET_LAST_UNDO_STATE;
26
+ undoState: UndoState | null;
27
+ };
28
+
29
+ export type SetLastSplitStateAction = {
30
+ type: typeof constants.SET_LAST_SPLIT_STATE;
31
+ splitState: SplitState | null;
32
+ };
33
+
34
+ export type AppActions =
35
+ | SetAppStateAction
36
+ | SetLastUndoStateAction
37
+ | SetLastSplitStateAction;
@@ -0,0 +1,36 @@
1
+ import type { RemoteFile } from '../../server/cloud-storage';
2
+ import type { Budget } from '../../types/budget';
3
+ import type { File } from '../../types/file';
4
+ import type * as constants from '../constants';
5
+
6
+ export type BudgetsState = {
7
+ budgets: Budget[];
8
+ remoteFiles: RemoteFile[] | null;
9
+ allFiles: File[] | null;
10
+ };
11
+
12
+ export type SetBudgetsAction = {
13
+ type: typeof constants.SET_BUDGETS;
14
+ budgets: Budget[];
15
+ };
16
+
17
+ export type SetRemoteFilesAction = {
18
+ type: typeof constants.SET_REMOTE_FILES;
19
+ files: RemoteFile[];
20
+ };
21
+
22
+ export type SetAllFilesAction = {
23
+ type: typeof constants.SET_ALL_FILES;
24
+ budgets: Budget[];
25
+ remoteFiles: RemoteFile[];
26
+ };
27
+
28
+ export type SignOutAction = {
29
+ type: typeof constants.SIGN_OUT;
30
+ };
31
+
32
+ export type BudgetsActions =
33
+ | SetBudgetsAction
34
+ | SetRemoteFilesAction
35
+ | SetAllFilesAction
36
+ | SignOutAction;
@@ -0,0 +1,41 @@
1
+ import type * as constants from '../constants';
2
+
3
+ import type { AccountActions, AccountState } from './account';
4
+ import type { AppActions, AppState } from './app';
5
+ import type { BudgetsActions, BudgetsState } from './budgets';
6
+ import type { ModalsActions, ModalsState } from './modals';
7
+ import type { NotificationsActions, NotificationsState } from './notifications';
8
+ import type { PrefsActions, PrefsState } from './prefs';
9
+ import type { QueriesActions, QueriesState } from './queries';
10
+ import type { UserActions, UserState } from './user';
11
+
12
+ export type CloseBudgetAction = {
13
+ type: typeof constants.CLOSE_BUDGET;
14
+ };
15
+
16
+ export type Action =
17
+ | AccountActions
18
+ | AppActions
19
+ | BudgetsActions
20
+ | ModalsActions
21
+ | NotificationsActions
22
+ | PrefsActions
23
+ | QueriesActions
24
+ | UserActions
25
+ | CloseBudgetAction;
26
+
27
+ export type State = {
28
+ account: AccountState;
29
+ app: AppState;
30
+ budgets: BudgetsState;
31
+ modals: ModalsState;
32
+ notifications: NotificationsState;
33
+ prefs: PrefsState;
34
+ queries: QueriesState;
35
+ user: UserState;
36
+ };
37
+
38
+ declare module 'react-redux' {
39
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions, @typescript-eslint/no-empty-interface
40
+ export interface DefaultRootState extends State {}
41
+ }
@@ -0,0 +1,292 @@
1
+ import { type File } from '../../types/file';
2
+ import type {
3
+ AccountEntity,
4
+ CategoryEntity,
5
+ CategoryGroupEntity,
6
+ GoCardlessToken,
7
+ } from '../../types/models';
8
+ import type { NewRuleEntity, RuleEntity } from '../../types/models/rule';
9
+ import type { EmptyObject, StripNever } from '../../types/util';
10
+ import type * as constants from '../constants';
11
+ export type ModalType = keyof FinanceModals;
12
+
13
+ export type OptionlessModal = {
14
+ [K in ModalType]: EmptyObject extends FinanceModals[K] ? K : never;
15
+ }[ModalType];
16
+
17
+ export type ModalWithOptions = StripNever<{
18
+ [K in ModalType]: keyof FinanceModals[K] extends never
19
+ ? never
20
+ : FinanceModals[K];
21
+ }>;
22
+
23
+ // There is a separate (overlapping!) set of modals for the management app. Fun!
24
+ type FinanceModals = {
25
+ 'import-transactions': {
26
+ accountId: string;
27
+ filename: string;
28
+ onImported: (didChange: boolean) => void;
29
+ };
30
+
31
+ 'add-account': EmptyObject;
32
+ 'add-local-account': EmptyObject;
33
+ 'close-account': {
34
+ account: AccountEntity;
35
+ balance: number;
36
+ canDelete: boolean;
37
+ };
38
+ 'select-linked-accounts': {
39
+ accounts: unknown[];
40
+ requisitionId: string;
41
+ upgradingAccountId?: string;
42
+ syncSource?: AccountSyncSource;
43
+ };
44
+
45
+ 'confirm-category-delete': { onDelete: (categoryId: string) => void } & (
46
+ | { category: string }
47
+ | { group: string }
48
+ );
49
+
50
+ 'load-backup': EmptyObject;
51
+
52
+ 'manage-rules': { payeeId?: string };
53
+ 'edit-rule': {
54
+ rule: RuleEntity | NewRuleEntity;
55
+ onSave: (rule: RuleEntity) => void;
56
+ };
57
+ 'merge-unused-payees': {
58
+ payeeIds: string[];
59
+ targetPayeeId: string;
60
+ };
61
+
62
+ 'gocardless-init': {
63
+ onSuccess: () => void;
64
+ };
65
+ 'simplefin-init': {
66
+ onSuccess: () => void;
67
+ };
68
+
69
+ 'gocardless-external-msg': {
70
+ onMoveExternal: (arg: {
71
+ institutionId: string;
72
+ }) => Promise<{ error: string } | { data: unknown }>;
73
+ onClose?: () => void;
74
+ onSuccess: (data: GoCardlessToken) => Promise<void>;
75
+ };
76
+
77
+ 'delete-budget': { file: File };
78
+
79
+ import: null;
80
+
81
+ 'import-ynab4': null;
82
+
83
+ 'import-ynab5': null;
84
+
85
+ 'import-actual': null;
86
+
87
+ 'create-encryption-key': { recreate?: boolean };
88
+ 'fix-encryption-key': {
89
+ hasExistingKey?: boolean;
90
+ cloudFileId?: string;
91
+ onSuccess?: () => void;
92
+ };
93
+
94
+ 'edit-field': {
95
+ name: string;
96
+ month: string;
97
+ onSubmit: (name: string, value: string) => void;
98
+ onClose: () => void;
99
+ };
100
+
101
+ 'category-autocomplete': {
102
+ categoryGroups: CategoryGroupEntity[];
103
+ onSelect: (categoryId: string, categoryName: string) => void;
104
+ month?: string;
105
+ showHiddenCategories?: boolean;
106
+ onClose?: () => void;
107
+ };
108
+
109
+ 'account-autocomplete': {
110
+ onSelect: (accountId: string, accountName: string) => void;
111
+ includeClosedAccounts?: boolean;
112
+ onClose?: () => void;
113
+ };
114
+
115
+ 'payee-autocomplete': {
116
+ onSelect: (payeeId: string) => void;
117
+ onClose?: () => void;
118
+ };
119
+
120
+ 'budget-summary': {
121
+ month: string;
122
+ };
123
+
124
+ 'schedule-edit': { id: string } | null;
125
+
126
+ 'schedule-link': { transactionIds: string[] } | null;
127
+
128
+ 'schedules-discover': null;
129
+
130
+ 'schedule-posts-offline-notification': null;
131
+ 'switch-budget-type': { onSwitch: () => void };
132
+ 'account-menu': {
133
+ accountId: string;
134
+ onSave: (account: AccountEntity) => void;
135
+ onCloseAccount: (accountId: string) => void;
136
+ onReopenAccount: (accountId: string) => void;
137
+ onEditNotes: (id: string) => void;
138
+ onClose?: () => void;
139
+ };
140
+ 'category-menu': {
141
+ categoryId: string;
142
+ onSave: (category: CategoryEntity) => void;
143
+ onEditNotes: (id: string) => void;
144
+ onDelete: (categoryId: string) => void;
145
+ onBudgetAction: (month: string, action: string, args?: unknown) => void;
146
+ onClose?: () => void;
147
+ };
148
+ 'rollover-budget-menu': {
149
+ categoryId: string;
150
+ month: string;
151
+ onUpdateBudget: (amount: number) => void;
152
+ onCopyLastMonthAverage: () => void;
153
+ onSetMonthsAverage: (numberOfMonths: number) => void;
154
+ onApplyBudgetTemplate: () => void;
155
+ };
156
+ 'report-budget-menu': {
157
+ categoryId: string;
158
+ month: string;
159
+ onUpdateBudget: (amount: number) => void;
160
+ onCopyLastMonthAverage: () => void;
161
+ onSetMonthsAverage: (numberOfMonths: number) => void;
162
+ onApplyBudgetTemplate: () => void;
163
+ };
164
+ 'category-group-menu': {
165
+ groupId: string;
166
+ onSave: (group: CategoryGroupEntity) => void;
167
+ onAddCategory: (groupId: string, isIncome: boolean) => void;
168
+ onEditNotes: (id: string) => void;
169
+ onDelete: (groupId: string) => void;
170
+ onClose?: () => void;
171
+ };
172
+ notes: {
173
+ id: string;
174
+ name: string;
175
+ onSave: (id: string, notes: string) => void;
176
+ };
177
+ 'report-budget-summary': { month: string };
178
+ 'rollover-budget-summary': {
179
+ month: string;
180
+ onBudgetAction: (
181
+ month: string,
182
+ type: string,
183
+ args: unknown,
184
+ ) => Promise<void>;
185
+ };
186
+ 'new-category-group': {
187
+ onValidate?: (value: string) => string;
188
+ onSubmit: (value: string) => Promise<void>;
189
+ };
190
+ 'new-category': {
191
+ onValidate?: (value: string) => string;
192
+ onSubmit: (value: string) => Promise<void>;
193
+ };
194
+ 'rollover-balance-menu': {
195
+ categoryId: string;
196
+ month: string;
197
+ onCarryover: (carryover: boolean) => void;
198
+ onTransfer: () => void;
199
+ onCover: () => void;
200
+ };
201
+ 'rollover-summary-to-budget-menu': {
202
+ month: string;
203
+ onTransfer: () => void;
204
+ onHoldBuffer: () => void;
205
+ onResetHoldBuffer: () => void;
206
+ };
207
+ 'report-balance-menu': {
208
+ categoryId: string;
209
+ month: string;
210
+ onCarryover: (carryover: boolean) => void;
211
+ };
212
+ transfer: {
213
+ title: string;
214
+ month: string;
215
+ amount: number;
216
+ onSubmit: (amount: number, toCategoryId: string) => void;
217
+ showToBeBudgeted?: boolean;
218
+ };
219
+ cover: {
220
+ categoryId: string;
221
+ month: string;
222
+ onSubmit: (fromCategoryId: string) => void;
223
+ };
224
+ 'hold-buffer': {
225
+ month: string;
226
+ onSubmit: (amount: number) => void;
227
+ };
228
+ 'scheduled-transaction-menu': {
229
+ transactionId: string;
230
+ onPost: (transactionId: string) => void;
231
+ onSkip: (transactionId: string) => void;
232
+ };
233
+ 'budget-page-menu': {
234
+ onAddCategoryGroup: () => void;
235
+ onToggleHiddenCategories: () => void;
236
+ onSwitchBudgetFile: () => void;
237
+ onSwitchBudgetType: () => void;
238
+ };
239
+ 'rollover-budget-month-menu': {
240
+ month: string;
241
+ onBudgetAction: (month: string, action: string, arg?: unknown) => void;
242
+ onEditNotes: (month: string) => void;
243
+ };
244
+ 'report-budget-month-menu': {
245
+ month: string;
246
+ onBudgetAction: (month: string, action: string, arg?: unknown) => void;
247
+ onEditNotes: (month: string) => void;
248
+ };
249
+ 'budget-list';
250
+ 'confirm-transaction-edit': {
251
+ onConfirm: () => void;
252
+ confirmReason: string;
253
+ };
254
+ 'confirm-transaction-delete': {
255
+ onConfirm: () => void;
256
+ };
257
+ };
258
+
259
+ export type PushModalAction = {
260
+ type: typeof constants.PUSH_MODAL;
261
+ modal: Modal;
262
+ };
263
+
264
+ export type ReplaceModalAction = {
265
+ type: typeof constants.REPLACE_MODAL;
266
+ modal: Modal;
267
+ };
268
+
269
+ export type PopModalAction = {
270
+ type: typeof constants.POP_MODAL;
271
+ };
272
+
273
+ export type CloseModalAction = {
274
+ type: typeof constants.CLOSE_MODAL;
275
+ };
276
+
277
+ export type CollapseModalsAction = {
278
+ type: typeof constants.COLLAPSE_MODALS;
279
+ rootModalName: string;
280
+ };
281
+
282
+ export type ModalsActions =
283
+ | PushModalAction
284
+ | ReplaceModalAction
285
+ | PopModalAction
286
+ | CloseModalAction
287
+ | CollapseModalsAction;
288
+
289
+ export type ModalsState = {
290
+ modalStack: Modal[];
291
+ isHidden: boolean;
292
+ };
@@ -0,0 +1,38 @@
1
+ import type * as constants from '../constants';
2
+
3
+ export type Notification = {
4
+ id?: string;
5
+ // 'warning' is unhandled??
6
+ type?: 'message' | 'error' | 'warning';
7
+ pre?: string;
8
+ title?: string;
9
+ message: string;
10
+ sticky?: boolean;
11
+ timeout?: number;
12
+ button?: {
13
+ title: string;
14
+ action: () => void | Promise<void>;
15
+ };
16
+ messageActions?: Record<string, () => void>;
17
+ onClose?: () => void;
18
+ internal?: string;
19
+ };
20
+ type NotificationWithId = Notification & { id: string };
21
+
22
+ export type NotificationsState = {
23
+ notifications: NotificationWithId[];
24
+ };
25
+
26
+ type AddNotificationAction = {
27
+ type: typeof constants.ADD_NOTIFICATION;
28
+ notification: NotificationWithId;
29
+ };
30
+
31
+ type RemoveNotificationAction = {
32
+ type: typeof constants.REMOVE_NOTIFICATION;
33
+ id: string;
34
+ };
35
+
36
+ export type NotificationsActions =
37
+ | AddNotificationAction
38
+ | RemoveNotificationAction;
@@ -0,0 +1,28 @@
1
+ import type { LocalPrefs, GlobalPrefs } from '../../types/prefs';
2
+ import type * as constants from '../constants';
3
+
4
+ export type PrefsState = {
5
+ local: LocalPrefs;
6
+ global: GlobalPrefs;
7
+ };
8
+
9
+ export type SetPrefsAction = {
10
+ type: typeof constants.SET_PREFS;
11
+ prefs: LocalPrefs;
12
+ globalPrefs: GlobalPrefs;
13
+ };
14
+
15
+ export type MergeLocalPrefsAction = {
16
+ type: typeof constants.MERGE_LOCAL_PREFS;
17
+ prefs: LocalPrefs;
18
+ };
19
+
20
+ export type MergeGlobalPrefsAction = {
21
+ type: typeof constants.MERGE_GLOBAL_PREFS;
22
+ globalPrefs: GlobalPrefs;
23
+ };
24
+
25
+ export type PrefsActions =
26
+ | SetPrefsAction
27
+ | MergeLocalPrefsAction
28
+ | MergeGlobalPrefsAction;
@@ -0,0 +1,69 @@
1
+ import type { Handlers } from '../../types/handlers';
2
+ import { type AccountEntity } from '../../types/models';
3
+ import type * as constants from '../constants';
4
+
5
+ export type QueriesState = {
6
+ newTransactions: unknown[];
7
+ matchedTransactions: unknown[];
8
+ lastTransaction: unknown | null;
9
+ updatedAccounts: string[];
10
+ accounts: AccountEntity[];
11
+ accountsLoaded: boolean;
12
+ categories: Awaited<ReturnType<Handlers['get-categories']>>;
13
+ categoriesLoaded: boolean;
14
+ payees: Awaited<ReturnType<Handlers['payees-get']>>;
15
+ payeesLoaded: boolean;
16
+ earliestTransaction: unknown | null;
17
+ };
18
+
19
+ type SetNewTransactionsAction = {
20
+ type: typeof constants.SET_NEW_TRANSACTIONS;
21
+ newTransactions?: unknown[];
22
+ matchedTransactions?: unknown[];
23
+ updatedAccounts?: string[];
24
+ };
25
+
26
+ type UpdateNewTransactionsAction = {
27
+ type: typeof constants.UPDATE_NEW_TRANSACTIONS;
28
+ changedId: string;
29
+ };
30
+
31
+ type SetLastTransactionAction = {
32
+ type: typeof constants.SET_LAST_TRANSACTION;
33
+ transaction: unknown;
34
+ };
35
+
36
+ type MarkAccountReadAction = {
37
+ type: typeof constants.MARK_ACCOUNT_READ;
38
+ accountId: string;
39
+ };
40
+
41
+ type LoadAccountsAction = {
42
+ type: typeof constants.LOAD_ACCOUNTS;
43
+ accounts: AccountEntity[];
44
+ };
45
+
46
+ type UpdateAccountAction = {
47
+ type: typeof constants.UPDATE_ACCOUNT;
48
+ account: AccountEntity;
49
+ };
50
+
51
+ type LoadCategoriesAction = {
52
+ type: typeof constants.LOAD_CATEGORIES;
53
+ categories: State['categories'];
54
+ };
55
+
56
+ type LoadPayeesAction = {
57
+ type: typeof constants.LOAD_PAYEES;
58
+ payees: State['payees'];
59
+ };
60
+
61
+ export type QueriesActions =
62
+ | SetNewTransactionsAction
63
+ | UpdateNewTransactionsAction
64
+ | SetLastTransactionAction
65
+ | MarkAccountReadAction
66
+ | LoadAccountsAction
67
+ | UpdateAccountAction
68
+ | LoadCategoriesAction
69
+ | LoadPayeesAction;
@@ -0,0 +1,13 @@
1
+ import type { Handlers } from '../../types/handlers';
2
+ import type * as constants from '../constants';
3
+
4
+ export type UserState = {
5
+ data: Awaited<ReturnType<Handlers['subscribe-get-user']>>;
6
+ };
7
+
8
+ export type GetUserDataAction = {
9
+ type: typeof constants.GET_USER_DATA;
10
+ data: State['data'];
11
+ };
12
+
13
+ export type UserActions = GetUserDataAction;
@@ -0,0 +1,2 @@
1
+ import type { Handlers } from '../types/handlers';
2
+ export declare function createTestBudget(handlers: Handlers): Promise<void>;