@actual-app/api 25.4.0 → 25.5.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 (71) hide show
  1. package/@types/app/bundle.api.d.ts +1 -5
  2. package/@types/loot-core/client/budgets/budgetsSlice.d.ts +6 -2
  3. package/@types/loot-core/client/modals/modalsSlice.d.ts +5 -1
  4. package/@types/loot-core/client/prefs/prefsSlice.d.ts +2 -8
  5. package/@types/loot-core/client/queries/queriesSlice.d.ts +1 -1
  6. package/@types/loot-core/client/users/usersSlice.d.ts +28 -12
  7. package/@types/loot-core/mocks/index.d.ts +5 -2
  8. package/@types/loot-core/mocks/util.d.ts +1 -0
  9. package/@types/loot-core/platform/server/asyncStorage/index.d.ts +7 -6
  10. package/@types/loot-core/platform/server/indexeddb/index.d.ts +15 -24
  11. package/@types/loot-core/server/accounts/sync.d.ts +1 -9
  12. package/@types/loot-core/server/api-models.d.ts +2 -10
  13. package/@types/loot-core/server/aql/schema/executors.d.ts +2 -0
  14. package/@types/loot-core/server/auth/app.d.ts +142 -0
  15. package/@types/loot-core/server/budget/base.d.ts +2 -1
  16. package/@types/loot-core/server/budget/envelope.d.ts +3 -0
  17. package/@types/loot-core/server/budget/report.d.ts +4 -1
  18. package/@types/loot-core/server/budgetfiles/app.d.ts +139 -0
  19. package/@types/loot-core/server/cloud-storage.d.ts +2 -2
  20. package/@types/loot-core/server/db/index.d.ts +3 -2
  21. package/@types/loot-core/server/encryption/app.d.ts +40 -0
  22. package/@types/loot-core/server/{encryption-internals.d.ts → encryption/encryption-internals.d.ts} +0 -1
  23. package/@types/loot-core/server/errors.d.ts +4 -0
  24. package/@types/loot-core/server/importers/index.d.ts +1 -2
  25. package/@types/loot-core/server/main-app.d.ts +1 -1
  26. package/@types/loot-core/server/reports/app.d.ts +2 -2
  27. package/@types/loot-core/server/spreadsheet/spreadsheet.d.ts +9 -2
  28. package/@types/loot-core/server/transactions/app.d.ts +4 -1
  29. package/@types/loot-core/server/transactions/import/ofx2json.d.ts +1 -0
  30. package/@types/loot-core/server/transactions/import/parse-file.d.ts +1 -0
  31. package/@types/loot-core/server/transactions/index.d.ts +1 -0
  32. package/@types/loot-core/server/transactions/merge.d.ts +2 -0
  33. package/@types/loot-core/server/transactions/transaction-rules.d.ts +1 -0
  34. package/@types/loot-core/server/transactions/transfer.d.ts +2 -2
  35. package/@types/loot-core/shared/errors.d.ts +4 -4
  36. package/@types/loot-core/types/api-handlers.d.ts +170 -183
  37. package/@types/loot-core/types/budget.d.ts +6 -6
  38. package/@types/loot-core/types/file.d.ts +23 -36
  39. package/@types/loot-core/types/handlers.d.ts +5 -21
  40. package/@types/loot-core/types/models/bank-sync.d.ts +10 -17
  41. package/@types/loot-core/types/models/category-group.d.ts +8 -13
  42. package/@types/loot-core/types/models/category.d.ts +7 -8
  43. package/@types/loot-core/types/models/dashboard.d.ts +43 -88
  44. package/@types/loot-core/types/models/gocardless.d.ts +56 -71
  45. package/@types/loot-core/types/models/note.d.ts +2 -2
  46. package/@types/loot-core/types/models/openid.d.ts +6 -6
  47. package/@types/loot-core/types/models/payee.d.ts +6 -7
  48. package/@types/loot-core/types/models/reports.d.ts +98 -118
  49. package/@types/loot-core/types/models/rule.d.ts +62 -161
  50. package/@types/loot-core/types/models/schedule.d.ts +36 -38
  51. package/@types/loot-core/types/models/simplefin.d.ts +13 -17
  52. package/@types/loot-core/types/models/transaction-filter.d.ts +5 -6
  53. package/@types/loot-core/types/models/transaction.d.ts +29 -30
  54. package/@types/loot-core/types/prefs.d.ts +2 -4
  55. package/@types/loot-core/types/server-events.d.ts +43 -68
  56. package/@types/loot-core/types/server-handlers.d.ts +26 -198
  57. package/@types/loot-core/types/util.d.ts +7 -18
  58. package/@types/methods.d.ts +1 -1
  59. package/@types/vitest.config.d.ts +7 -0
  60. package/dist/app/bundle.api.js +17541 -110891
  61. package/dist/package.json +5 -7
  62. package/dist/vitest.config.js +11 -0
  63. package/package.json +5 -7
  64. package/@types/jest.config.d.ts +0 -9
  65. package/@types/loot-core/client/accounts/accountsSlice.d.ts +0 -175
  66. package/@types/loot-core/server/backups.test.d.ts +0 -1
  67. package/@types/loot-core/server/encryption-internals.web.d.ts +0 -23
  68. package/@types/loot-core/server/encryption.test.d.ts +0 -1
  69. package/dist/jest.config.js +0 -22
  70. /package/@types/loot-core/server/{backups.d.ts → budgetfiles/backups.d.ts} +0 -0
  71. /package/@types/loot-core/server/{encryption.d.ts → encryption/index.d.ts} +0 -0
@@ -2,35 +2,34 @@ import { AccountEntity } from './account';
2
2
  import { CategoryEntity } from './category';
3
3
  import { PayeeEntity } from './payee';
4
4
  import { ScheduleEntity } from './schedule';
5
-
6
5
  export interface TransactionEntity {
7
- id: string;
8
- is_parent?: boolean;
9
- is_child?: boolean;
10
- parent_id?: TransactionEntity['id'];
11
- account: AccountEntity['id'];
12
- category?: CategoryEntity['id'];
13
- amount: number;
14
- payee?: PayeeEntity['id'];
15
- notes?: string;
16
- date: string;
17
- imported_id?: string;
18
- imported_payee?: string;
19
- starting_balance_flag?: boolean;
20
- transfer_id?: TransactionEntity['id'];
21
- sort_order?: number;
22
- cleared?: boolean;
23
- reconciled?: boolean;
24
- tombstone?: boolean;
25
- forceUpcoming?: boolean;
26
- schedule?: ScheduleEntity['id'];
27
- subtransactions?: TransactionEntity[];
28
- _unmatched?: boolean;
29
- _deleted?: boolean;
30
- error?: {
31
- type: 'SplitTransactionError';
32
- version: 1;
33
- difference: number;
34
- } | null;
35
- raw_synced_data?: string | undefined;
6
+ id: string;
7
+ is_parent?: boolean;
8
+ is_child?: boolean;
9
+ parent_id?: TransactionEntity['id'];
10
+ account: AccountEntity['id'];
11
+ category?: CategoryEntity['id'];
12
+ amount: number;
13
+ payee?: PayeeEntity['id'];
14
+ notes?: string;
15
+ date: string;
16
+ imported_id?: string;
17
+ imported_payee?: string;
18
+ starting_balance_flag?: boolean;
19
+ transfer_id?: TransactionEntity['id'];
20
+ sort_order?: number;
21
+ cleared?: boolean;
22
+ reconciled?: boolean;
23
+ tombstone?: boolean;
24
+ forceUpcoming?: boolean;
25
+ schedule?: ScheduleEntity['id'];
26
+ subtransactions?: TransactionEntity[];
27
+ _unmatched?: boolean;
28
+ _deleted?: boolean;
29
+ error?: {
30
+ type: 'SplitTransactionError';
31
+ version: 1;
32
+ difference: number;
33
+ } | null;
34
+ raw_synced_data?: string | undefined;
36
35
  }
@@ -84,6 +84,7 @@ export type DarkTheme = 'dark' | 'midnight';
84
84
  export type GlobalPrefs = Partial<{
85
85
  floatingSidebar: boolean;
86
86
  maxMonths: number;
87
+ categoryExpandedState: number;
87
88
  keyId?: string;
88
89
  language: string;
89
90
  theme: Theme;
@@ -94,10 +95,6 @@ export type GlobalPrefs = Partial<{
94
95
  // Electron only
95
96
  autoStart?: boolean;
96
97
  port?: number;
97
- ngrokConfig?: {
98
- domain?: string;
99
- authToken?: string;
100
- };
101
98
  };
102
99
  }>;
103
100
 
@@ -113,6 +110,7 @@ export type GlobalPrefsJson = Partial<{
113
110
  'user-token'?: string;
114
111
  'floating-sidebar'?: string; // "true" or "false"
115
112
  'max-months'?: string; // e.g. "2" or "3"
113
+ 'category-expanded-state'?: string; // "0" or "1" or "2"
116
114
  'document-dir'?: GlobalPrefs['documentDir'];
117
115
  'encrypt-key'?: string;
118
116
  language?: GlobalPrefs['language'];
@@ -1,86 +1,61 @@
1
- import { type Backup } from '../server/backups';
1
+ import { type Backup } from '../server/budgetfiles/backups';
2
2
  import { type UndoState } from '../server/undo';
3
-
4
- type SyncSubtype =
5
- | 'out-of-sync'
6
- | 'apply-failure'
7
- | 'decrypt-failure'
8
- | 'encrypt-failure'
9
- | 'invalid-schema'
10
- | 'network'
11
- | 'file-old-version'
12
- | 'file-key-mismatch'
13
- | 'file-not-found'
14
- | 'file-needs-upload'
15
- | 'file-has-reset'
16
- | 'file-has-new-key'
17
- | 'token-expired'
18
- | string;
19
-
3
+ type SyncSubtype = 'out-of-sync' | 'apply-failure' | 'decrypt-failure' | 'encrypt-failure' | 'invalid-schema' | 'network' | 'file-old-version' | 'file-key-mismatch' | 'file-not-found' | 'file-needs-upload' | 'file-has-reset' | 'file-has-new-key' | 'token-expired' | string;
20
4
  type SyncEvent = {
21
- meta?: Record<string, unknown>;
22
- } & (
23
- | {
24
- type: 'applied';
25
- tables: string[];
26
- data?: Map<string, unknown>;
27
- prevData?: Map<string, unknown>;
28
- }
29
- | {
30
- type: 'success';
31
- tables: string[];
32
- syncDisabled?: boolean;
33
- }
34
- | {
35
- type: 'error';
36
- subtype?: SyncSubtype;
37
- }
38
- | {
39
- type: 'start';
40
- }
41
- | {
42
- type: 'unauthorized';
43
- }
44
- );
45
-
5
+ meta?: Record<string, unknown>;
6
+ } & ({
7
+ type: 'applied';
8
+ tables: string[];
9
+ data?: Map<string, unknown>;
10
+ prevData?: Map<string, unknown>;
11
+ } | {
12
+ type: 'success';
13
+ tables: string[];
14
+ syncDisabled?: boolean;
15
+ } | {
16
+ type: 'error';
17
+ subtype?: SyncSubtype;
18
+ } | {
19
+ type: 'start';
20
+ } | {
21
+ type: 'unauthorized';
22
+ });
46
23
  type BackupUpdatedEvent = Backup[];
47
-
48
24
  type CellsChangedEvent = Array<{
49
- name: string;
50
- value: string | number | boolean;
25
+ name: string;
26
+ value: string | number | boolean;
51
27
  }>;
52
-
53
28
  type FallbackWriteErrorEvent = undefined;
54
29
  type FinishImportEvent = undefined;
55
30
  type FinishLoadEvent = undefined;
56
-
57
31
  type OrphanedPayeesEvent = {
58
- orphanedIds: string[];
59
- updatedPayeeIds: string[];
32
+ orphanedIds: string[];
33
+ updatedPayeeIds: string[];
60
34
  };
61
-
62
35
  type PrefsUpdatedEvent = undefined;
63
36
  type SchedulesOfflineEvent = undefined;
64
37
  type ServerErrorEvent = undefined;
65
38
  type ShowBudgetsEvent = undefined;
66
- type StartImportEvent = { budgetName: string };
39
+ type StartImportEvent = {
40
+ budgetName: string;
41
+ };
67
42
  type StartLoadEvent = undefined;
68
43
  type ApiFetchRedirectedEvent = undefined;
69
-
70
44
  export interface ServerEvents {
71
- 'backups-updated': BackupUpdatedEvent;
72
- 'cells-changed': CellsChangedEvent;
73
- 'fallback-write-error': FallbackWriteErrorEvent;
74
- 'finish-import': FinishImportEvent;
75
- 'finish-load': FinishLoadEvent;
76
- 'orphaned-payees': OrphanedPayeesEvent;
77
- 'prefs-updated': PrefsUpdatedEvent;
78
- 'schedules-offline': SchedulesOfflineEvent;
79
- 'server-error': ServerErrorEvent;
80
- 'show-budgets': ShowBudgetsEvent;
81
- 'start-import': StartImportEvent;
82
- 'start-load': StartLoadEvent;
83
- 'sync-event': SyncEvent;
84
- 'undo-event': UndoState;
85
- 'api-fetch-redirected': ApiFetchRedirectedEvent;
45
+ 'backups-updated': BackupUpdatedEvent;
46
+ 'cells-changed': CellsChangedEvent;
47
+ 'fallback-write-error': FallbackWriteErrorEvent;
48
+ 'finish-import': FinishImportEvent;
49
+ 'finish-load': FinishLoadEvent;
50
+ 'orphaned-payees': OrphanedPayeesEvent;
51
+ 'prefs-updated': PrefsUpdatedEvent;
52
+ 'schedules-offline': SchedulesOfflineEvent;
53
+ 'server-error': ServerErrorEvent;
54
+ 'show-budgets': ShowBudgetsEvent;
55
+ 'start-import': StartImportEvent;
56
+ 'start-load': StartLoadEvent;
57
+ 'sync-event': SyncEvent;
58
+ 'undo-event': UndoState;
59
+ 'api-fetch-redirected': ApiFetchRedirectedEvent;
86
60
  }
61
+ export {};
@@ -1,200 +1,28 @@
1
- import { Backup } from '../server/backups';
2
- import { RemoteFile } from '../server/cloud-storage';
3
- import { Message } from '../server/sync';
4
-
5
- import { Budget } from './budget';
6
- import { OpenIdConfig } from './models/openid';
7
- // eslint-disable-next-line import/no-unresolved
8
- import { Query } from './query';
9
- import { EmptyObject } from './util';
10
-
1
+ import { QueryState } from '../shared/query';
11
2
  export interface ServerHandlers {
12
- undo: () => Promise<void>;
13
- redo: () => Promise<void>;
14
-
15
- 'get-earliest-transaction': () => Promise<{ date: string }>;
16
-
17
- 'make-filters-from-conditions': (arg: {
18
- conditions: unknown;
19
- applySpecialCases?: boolean;
20
- }) => Promise<{ filters: unknown[] }>;
21
-
22
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
23
- query: (query: Query) => Promise<{ data: any; dependencies: string[] }>;
24
-
25
- 'key-make': (arg: {
26
- password;
27
- }) => Promise<{ error?: { reason: string; meta?: unknown } }>;
28
-
29
- 'key-test': (arg: {
30
- fileId;
31
- password;
32
- }) => Promise<{ error?: { reason: string } }>;
33
-
34
- 'get-did-bootstrap': () => Promise<boolean>;
35
-
36
- 'subscribe-needs-bootstrap': (args: { url }) => Promise<
37
- | { error: string }
38
- | {
39
- bootstrapped: boolean;
40
- hasServer: false;
41
- }
42
- | {
43
- bootstrapped: boolean;
44
- hasServer: true;
45
- availableLoginMethods: {
46
- method: string;
47
- displayName: string;
48
- active: boolean;
49
- }[];
50
- multiuser: boolean;
51
- }
52
- >;
53
-
54
- 'subscribe-get-login-methods': () => Promise<{
55
- methods?: { method: string; displayName: string; active: boolean }[];
56
- error?: string;
57
- }>;
58
-
59
- 'subscribe-bootstrap': (arg: {
60
- password?: string;
61
- openId?: OpenIdConfig;
62
- }) => Promise<{ error?: string }>;
63
-
64
- 'subscribe-get-user': () => Promise<{
65
- offline: boolean;
66
- userName?: string;
67
- userId?: string;
68
- displayName?: string;
69
- permission?: string;
70
- loginMethod?: string;
71
- tokenExpired?: boolean;
72
- } | null>;
73
-
74
- 'subscribe-change-password': (arg: {
75
- password;
76
- }) => Promise<{ error?: string }>;
77
-
78
- 'subscribe-sign-in': (
79
- arg:
80
- | {
81
- password;
82
- loginMethod?: string;
83
- }
84
- | {
85
- return_url;
86
- loginMethod?: 'openid';
87
- },
88
- ) => Promise<{ error?: string; redirect_url?: string }>;
89
-
90
- 'subscribe-sign-out': () => Promise<'ok'>;
91
-
92
- 'subscribe-set-token': (arg: { token: string }) => Promise<void>;
93
-
94
- 'get-server-version': () => Promise<{ error?: string } | { version: string }>;
95
-
96
- 'get-server-url': () => Promise<string | null>;
97
-
98
- 'set-server-url': (arg: {
99
- url: string;
100
- validate?: boolean;
101
- }) => Promise<{ error?: string }>;
102
-
103
- sync: () => Promise<
104
- | { error: { message: string; reason: string; meta: unknown } }
105
- | { messages: Message[] }
106
- >;
107
-
108
- 'validate-budget-name': (arg: {
109
- name: string;
110
- }) => Promise<{ valid: boolean; message?: string }>;
111
-
112
- 'unique-budget-name': (arg: { name: string }) => Promise<string>;
113
-
114
- 'get-budgets': () => Promise<Budget[]>;
115
-
116
- 'get-remote-files': () => Promise<RemoteFile[]>;
117
-
118
- 'get-user-file-info': (fileId: string) => Promise<RemoteFile | null>;
119
-
120
- 'reset-budget-cache': () => Promise<unknown>;
121
-
122
- 'upload-budget': (arg: { id }) => Promise<{ error?: string }>;
123
-
124
- 'download-budget': (arg: { fileId; replace? }) => Promise<{ error; id }>;
125
-
126
- 'sync-budget': () => Promise<{
127
- error?: { message: string; reason: string; meta: unknown };
128
- }>;
129
-
130
- 'load-budget': (arg: { id: string }) => Promise<{ error }>;
131
-
132
- 'create-demo-budget': () => Promise<unknown>;
133
-
134
- 'close-budget': () => Promise<'ok'>;
135
-
136
- 'delete-budget': (arg: {
137
- id?: string | undefined;
138
- cloudFileId?: string | undefined;
139
- }) => Promise<'ok' | 'fail'>;
140
-
141
- /**
142
- * Duplicates a budget file.
143
- * @param {Object} arg - The arguments for duplicating a budget.
144
- * @param {string} [arg.id] - The ID of the local budget to duplicate.
145
- * @param {string} [arg.cloudId] - The ID of the cloud-synced budget to duplicate.
146
- * @param {string} arg.newName - The name for the duplicated budget.
147
- * @param {boolean} [arg.cloudSync] - Whether to sync the duplicated budget to the cloud.
148
- * @returns {Promise<string>} The ID of the newly created budget.
149
- */
150
- 'duplicate-budget': (arg: {
151
- id?: string | undefined;
152
- cloudId?: string | undefined;
153
- newName: string;
154
- cloudSync?: boolean;
155
- open: 'none' | 'original' | 'copy';
156
- }) => Promise<string>;
157
-
158
- 'create-budget': (arg: {
159
- budgetName?;
160
- avoidUpload?;
161
- testMode?: boolean;
162
- testBudgetId?;
163
- }) => Promise<unknown>;
164
-
165
- 'import-budget': (arg: {
166
- filepath: string;
167
- type: 'ynab4' | 'ynab5' | 'actual';
168
- }) => Promise<{ error?: string }>;
169
-
170
- 'export-budget': () => Promise<{ data: Buffer } | { error: string }>;
171
-
172
- 'upload-file-web': (arg: {
173
- filename: string;
174
- contents: ArrayBuffer;
175
- }) => Promise<EmptyObject | null>;
176
-
177
- 'backups-get': (arg: { id: string }) => Promise<Backup[]>;
178
-
179
- 'backup-load': (arg: { id: string; backupId: string }) => Promise<void>;
180
-
181
- 'backup-make': (arg: { id: string }) => Promise<void>;
182
-
183
- 'get-last-opened-backup': () => Promise<string | null>;
184
-
185
- 'app-focused': () => Promise<void>;
186
-
187
- 'enable-openid': (arg: {
188
- openId?: OpenIdConfig;
189
- }) => Promise<{ error?: string }>;
190
-
191
- 'enable-password': (arg: { password: string }) => Promise<{ error?: string }>;
192
-
193
- 'get-openid-config': () => Promise<
194
- | {
195
- openId: OpenIdConfig;
196
- }
197
- | { error: string }
198
- | null
199
- >;
3
+ undo: () => Promise<void>;
4
+ redo: () => Promise<void>;
5
+ 'make-filters-from-conditions': (arg: {
6
+ conditions: unknown;
7
+ applySpecialCases?: boolean;
8
+ }) => Promise<{
9
+ filters: unknown[];
10
+ }>;
11
+ query: (query: QueryState) => Promise<{
12
+ data: any;
13
+ dependencies: string[];
14
+ }>;
15
+ 'get-server-version': () => Promise<{
16
+ error?: string;
17
+ } | {
18
+ version: string;
19
+ }>;
20
+ 'get-server-url': () => Promise<string | null>;
21
+ 'set-server-url': (arg: {
22
+ url: string;
23
+ validate?: boolean;
24
+ }) => Promise<{
25
+ error?: string;
26
+ }>;
27
+ 'app-focused': () => Promise<void>;
200
28
  }
@@ -1,23 +1,12 @@
1
1
  export type EmptyObject = Record<never, never>;
2
-
3
2
  export type StripNever<T> = {
4
- [K in keyof T as T[K] extends never ? never : K]: T[K];
3
+ [K in keyof T as T[K] extends never ? never : K]: T[K];
5
4
  };
6
-
7
- export type EverythingButIdOptional<T> = { id: T['id'] } & Partial<
8
- Omit<T, 'id'>
9
- >;
10
-
5
+ export type EverythingButIdOptional<T extends {
6
+ id: unknown;
7
+ }> = {
8
+ id: T['id'];
9
+ } & Partial<Omit<T, 'id'>>;
11
10
  export type WithRequired<T, K extends keyof T> = T & Required<Pick<T, K>>;
12
-
13
- // Allows use of object literals inside child elements of `Trans` tags
14
- // see https://github.com/i18next/react-i18next/issues/1483
15
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
11
  export type TransObjectLiteral = any;
17
-
18
- export type AtLeastOne<T extends Record<string, unknown>> =
19
- keyof T extends infer K
20
- ? K extends string
21
- ? Pick<T, K & keyof T> & Partial<T>
22
- : never
23
- : never;
12
+ export type AtLeastOne<T extends Record<string, unknown>> = keyof T extends infer K ? K extends string ? Pick<T, K & keyof T> & Partial<T> : never : never;
@@ -49,7 +49,7 @@ export declare function updateTransaction(id: any, fields: any): Promise<import(
49
49
  id: any;
50
50
  category: any;
51
51
  })[]>;
52
- export declare function deleteTransaction(id: any): Promise<any>;
52
+ export declare function deleteTransaction(id: any): Promise<import("./@types/loot-core/types/models").TransactionEntity[]>;
53
53
  export declare function getAccounts(): Promise<import("./@types/loot-core/server/api-models").APIAccountEntity[]>;
54
54
  export declare function createAccount(account: any, initialBalance?: any): Promise<string>;
55
55
  export declare function updateAccount(id: any, fields: any): Promise<void>;
@@ -0,0 +1,7 @@
1
+ declare const _default: {
2
+ test: {
3
+ globals: boolean;
4
+ onConsoleLog(log: string, type: "stdout" | "stderr"): boolean | void;
5
+ };
6
+ };
7
+ export default _default;