@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
@@ -1,6 +1,2 @@
1
1
  export = __webpack_exports__;
2
- export = __webpack_exports__;
3
- /******/
4
- /************************************************************************/
5
- /******/
6
- /******/ /******/ /******/ /******/ declare var __webpack_exports__: any;
2
+ declare var __webpack_exports__: any;
@@ -135,7 +135,9 @@ type UploadBudgetPayload = {
135
135
  id?: string;
136
136
  };
137
137
  export declare const uploadBudget: import("@reduxjs/toolkit").AsyncThunk<{
138
- error: string;
138
+ error: {
139
+ reason: string;
140
+ };
139
141
  } | {
140
142
  error?: undefined;
141
143
  }, UploadBudgetPayload, {
@@ -330,7 +332,9 @@ export declare const actions: {
330
332
  rejectedMeta?: unknown;
331
333
  }>;
332
334
  uploadBudget: import("@reduxjs/toolkit").AsyncThunk<{
333
- error: string;
335
+ error: {
336
+ reason: string;
337
+ };
334
338
  } | {
335
339
  error?: undefined;
336
340
  }, UploadBudgetPayload, {
@@ -85,7 +85,10 @@ export type Modal = {
85
85
  onMoveExternal: (arg: {
86
86
  institutionId: string;
87
87
  }) => Promise<{
88
- error: 'unknown' | 'timeout';
88
+ error: 'timeout';
89
+ } | {
90
+ error: 'unknown';
91
+ message?: string;
89
92
  } | {
90
93
  data: GoCardlessToken;
91
94
  }>;
@@ -425,6 +428,7 @@ export type Modal = {
425
428
  name: 'confirm-unlink-account';
426
429
  options: {
427
430
  accountName: string;
431
+ isViewBankSyncSettings: boolean;
428
432
  onUnlink: () => void;
429
433
  };
430
434
  } | {
@@ -41,6 +41,7 @@ export declare const savePrefs: import("@reduxjs/toolkit").AsyncThunk<void, Save
41
41
  export declare const loadGlobalPrefs: import("@reduxjs/toolkit").AsyncThunk<Partial<{
42
42
  floatingSidebar: boolean;
43
43
  maxMonths: number;
44
+ categoryExpandedState: number;
44
45
  keyId?: string;
45
46
  language: string;
46
47
  theme: import("../../types/prefs").Theme;
@@ -50,10 +51,6 @@ export declare const loadGlobalPrefs: import("@reduxjs/toolkit").AsyncThunk<Part
50
51
  syncServerConfig?: {
51
52
  autoStart?: boolean;
52
53
  port?: number;
53
- ngrokConfig?: {
54
- domain?: string;
55
- authToken?: string;
56
- };
57
54
  };
58
55
  }>, void, {
59
56
  state: import("../store").RootState;
@@ -133,6 +130,7 @@ export declare const actions: {
133
130
  loadGlobalPrefs: import("@reduxjs/toolkit").AsyncThunk<Partial<{
134
131
  floatingSidebar: boolean;
135
132
  maxMonths: number;
133
+ categoryExpandedState: number;
136
134
  keyId?: string;
137
135
  language: string;
138
136
  theme: import("../../types/prefs").Theme;
@@ -142,10 +140,6 @@ export declare const actions: {
142
140
  syncServerConfig?: {
143
141
  autoStart?: boolean;
144
142
  port?: number;
145
- ngrokConfig?: {
146
- domain?: string;
147
- authToken?: string;
148
- };
149
143
  };
150
144
  }>, void, {
151
145
  state: import("../store").RootState;
@@ -214,7 +214,7 @@ export declare const moveCategory: import("@reduxjs/toolkit").AsyncThunk<void, M
214
214
  }>;
215
215
  type MoveCategoryGroupPayload = {
216
216
  id: CategoryGroupEntity['id'];
217
- targetId: CategoryGroupEntity['id'];
217
+ targetId: CategoryGroupEntity['id'] | null;
218
218
  };
219
219
  export declare const moveCategoryGroup: import("@reduxjs/toolkit").AsyncThunk<void, MoveCategoryGroupPayload, {
220
220
  state: import("../store").RootState;
@@ -1,12 +1,20 @@
1
1
  import { type Handlers } from '../../types/handlers';
2
2
  export declare const getUserData: import("@reduxjs/toolkit").AsyncThunk<{
3
3
  offline: boolean;
4
- userName?: string;
5
- userId?: string;
6
- displayName?: string;
7
- permission?: string;
8
- loginMethod?: string;
9
- tokenExpired?: boolean;
4
+ userName?: undefined;
5
+ permission?: undefined;
6
+ userId?: undefined;
7
+ displayName?: undefined;
8
+ loginMethod?: undefined;
9
+ tokenExpired?: undefined;
10
+ } | {
11
+ offline: boolean;
12
+ userName: any;
13
+ permission: any;
14
+ userId: any;
15
+ displayName: any;
16
+ loginMethod: any;
17
+ tokenExpired: boolean;
10
18
  }, void, {
11
19
  state: import("../store").RootState;
12
20
  dispatch: import("../store").AppDispatch;
@@ -47,12 +55,20 @@ export declare const name: "user", reducer: import("redux").Reducer<UsersState>,
47
55
  export declare const actions: {
48
56
  getUserData: import("@reduxjs/toolkit").AsyncThunk<{
49
57
  offline: boolean;
50
- userName?: string;
51
- userId?: string;
52
- displayName?: string;
53
- permission?: string;
54
- loginMethod?: string;
55
- tokenExpired?: boolean;
58
+ userName?: undefined;
59
+ permission?: undefined;
60
+ userId?: undefined;
61
+ displayName?: undefined;
62
+ loginMethod?: undefined;
63
+ tokenExpired?: undefined;
64
+ } | {
65
+ offline: boolean;
66
+ userName: any;
67
+ permission: any;
68
+ userId: any;
69
+ displayName: any;
70
+ loginMethod: any;
71
+ tokenExpired: boolean;
56
72
  }, void, {
57
73
  state: import("../store").RootState;
58
74
  dispatch: import("../store").AppDispatch;
@@ -1,7 +1,10 @@
1
- import type { AccountEntity, CategoryEntity, CategoryGroupEntity, NewCategoryGroupEntity, TransactionEntity } from '../types/models';
1
+ import type { AccountEntity, CategoryEntity, CategoryGroupEntity, TransactionEntity } from '../types/models';
2
2
  export declare function generateAccount(name: AccountEntity['name'], isConnected?: boolean, offbudget?: boolean): AccountEntity;
3
3
  export declare function generateCategory(name: string, group: string, isIncome?: boolean): CategoryEntity;
4
4
  export declare function generateCategoryGroup(name: string, isIncome?: boolean): CategoryGroupEntity;
5
- export declare function generateCategoryGroups(definition: Partial<NewCategoryGroupEntity>[]): CategoryGroupEntity[];
5
+ export type CategoryGroupDefinition = Omit<CategoryGroupEntity, 'id' | 'categories'> & {
6
+ categories: Omit<CategoryEntity, 'id' | 'group'>[];
7
+ };
8
+ export declare function generateCategoryGroups(definition: Partial<CategoryGroupDefinition>[]): CategoryGroupEntity[];
6
9
  export declare function generateTransaction(data: Partial<TransactionEntity> & Pick<TransactionEntity, 'account'>, splitAmount?: number, showError?: boolean): TransactionEntity[];
7
10
  export declare function generateTransactions(count: number, accountId: string, groupId: string, splitAtIndexes?: number[], showError?: boolean): TransactionEntity[];
@@ -5,3 +5,4 @@ export declare function expectSnapshotWithDiffer(initialValue: any, { onlyUpdate
5
5
  };
6
6
  export declare function getFixtures(filename: any): void;
7
7
  export declare function debugDOM(node: any): string;
8
+ export declare function patchFetchForSqlJS(baseURL: string): void;
@@ -13,22 +13,23 @@ export type GetItem = typeof getItem;
13
13
  export function setItem<K extends keyof GlobalPrefsJson>(
14
14
  key: K,
15
15
  value: GlobalPrefsJson[K],
16
- ): void;
16
+ ): Promise<void>;
17
17
  export type SetItem = typeof setItem;
18
18
 
19
- export function removeItem(key: keyof GlobalPrefsJson): void;
19
+ export function removeItem(key: keyof GlobalPrefsJson): Promise<void>;
20
20
  export type RemoveItem = typeof removeItem;
21
21
 
22
- export async function multiGet<K extends readonly (keyof GlobalPrefsJson)[]>(
22
+ export function multiGet<K extends readonly (keyof GlobalPrefsJson)[]>(
23
23
  keys: K,
24
- ): Promise<{ [P in keyof K]: [K[P], GlobalPrefsJson[K[P]]] }>;
24
+ ): Promise<{ [P in K[number]]: GlobalPrefsJson[P] }>;
25
+
25
26
  export type MultiGet = typeof multiGet;
26
27
 
27
28
  export function multiSet<K extends keyof GlobalPrefsJson>(
28
29
  keyValues: Array<[K, GlobalPrefsJson[K]]>,
29
- ): void;
30
+ ): Promise<void>;
30
31
 
31
32
  export type MultiSet = typeof multiSet;
32
33
 
33
- export function multiRemove(keys: (keyof GlobalPrefsJson)[]): void;
34
+ export function multiRemove(keys: (keyof GlobalPrefsJson)[]): Promise<void>;
34
35
  export type MultiRemove = typeof multiRemove;
@@ -1,24 +1,15 @@
1
- export function getDatabase();
2
- export type GetDatabase = typeof getDatabase;
3
-
4
- export function openDatabase();
5
- export type OpenDatabase = typeof openDatabase;
6
-
7
- export function closeDatabase();
8
- export type CloseDatabase = typeof closeDatabase;
9
-
10
- export function getStore(db: IDBDatabase, name: string);
11
- export type GetStore = typeof getStore;
12
-
13
- export function get(
14
- store: IDBObjectStore,
15
- key: IDBValidKey | IDBKeyRange,
16
- mapper?: (v: unknown) => unknown,
17
- );
18
- export type Get = typeof get;
19
-
20
- export function set(store: IDBObjectStore, value: unknown);
21
- export type Set = typeof set;
22
-
23
- export function del(store: IDBObjectStore, key: IDBValidKey);
24
- export type Del = typeof del;
1
+ type Data = {
2
+ filepath: string;
3
+ contents: string;
4
+ };
5
+ export declare const getStore: (db: IDBDatabase, name: string) => {
6
+ trans: IDBTransaction;
7
+ store: IDBObjectStore;
8
+ };
9
+ export declare const get: (store: IDBObjectStore, key: IDBValidKey | IDBKeyRange) => Promise<Data>;
10
+ export declare const set: (store: IDBObjectStore, item: Data) => Promise<unknown>;
11
+ export declare const del: (store: IDBObjectStore, key: string) => Promise<unknown>;
12
+ export declare const getDatabase: () => Promise<IDBDatabase>;
13
+ export declare const openDatabase: () => Promise<IDBDatabase>;
14
+ export declare const closeDatabase: () => void;
15
+ export {};
@@ -20,15 +20,7 @@ export declare function addTransactions(acctId: any, transactions: any, { runTra
20
20
  runTransfers?: boolean;
21
21
  learnCategories?: boolean;
22
22
  }): Promise<any>;
23
- export declare function syncAccount(userId: string | undefined, userKey: string | undefined, id: string, acctId: string, bankId: string): Promise<{
24
- added: any[];
25
- updated: string[];
26
- updatedPreview: Array<{
27
- transaction: TransactionEntity;
28
- existing?: TransactionEntity;
29
- ignored?: boolean;
30
- }>;
31
- } | {
23
+ export declare function syncAccount(userId: string | undefined, userKey: string | undefined, id: string, acctId: string, bankId: string): Promise<ReconcileTransactionsResult | {
32
24
  added: any[];
33
25
  updated: any[];
34
26
  }>;
@@ -13,19 +13,11 @@ export declare const accountModel: {
13
13
  }): import("./db").DbAccount;
14
14
  };
15
15
  export type APICategoryEntity = Pick<CategoryEntity, 'id' | 'name' | 'is_income' | 'hidden'> & {
16
- group_id?: string;
16
+ group_id: string;
17
17
  };
18
18
  export declare const categoryModel: {
19
19
  toExternal(category: CategoryEntity): APICategoryEntity;
20
- fromExternal(category: APICategoryEntity): {
21
- id: string;
22
- name: string;
23
- is_income?: boolean;
24
- cat_group?: CategoryGroupEntity["id"];
25
- sort_order?: number;
26
- tombstone?: boolean;
27
- hidden?: boolean;
28
- };
20
+ fromExternal(category: APICategoryEntity): CategoryEntity;
29
21
  validate(category: Partial<import("./db").DbCategory>, { update }?: {
30
22
  update?: boolean;
31
23
  }): import("./db").DbCategory;
@@ -1,6 +1,8 @@
1
1
  declare function execTransactions(state: any, query: any, sql: any, params: any, outputTypes: any): Promise<any>;
2
2
  export declare function isHappyPathQuery(queryState: any): boolean;
3
+ declare function execCategoryGroups(state: any, query: any, sql: any, params: any, outputTypes: any): Promise<unknown[]>;
3
4
  export declare const schemaExecutors: {
4
5
  transactions: typeof execTransactions;
6
+ category_groups: typeof execCategoryGroups;
5
7
  };
6
8
  export {};
@@ -0,0 +1,142 @@
1
+ import { OpenIdConfig } from '../../types/models';
2
+ export type AuthHandlers = {
3
+ 'get-did-bootstrap': typeof didBootstrap;
4
+ 'subscribe-needs-bootstrap': typeof needsBootstrap;
5
+ 'subscribe-bootstrap': typeof bootstrap;
6
+ 'subscribe-get-login-methods': typeof getLoginMethods;
7
+ 'subscribe-get-user': typeof getUser;
8
+ 'subscribe-change-password': typeof changePassword;
9
+ 'subscribe-sign-in': typeof signIn;
10
+ 'subscribe-sign-out': typeof signOut;
11
+ 'subscribe-set-token': typeof setToken;
12
+ 'enable-openid': typeof enableOpenId;
13
+ 'get-openid-config': typeof getOpenIdConfig;
14
+ 'enable-password': typeof enablePassword;
15
+ };
16
+ export declare const app: {
17
+ events: import("mitt").Emitter<{
18
+ sync: import("../../types/server-events").ServerEvents["sync-event"];
19
+ 'load-budget': {
20
+ id: string;
21
+ };
22
+ }>;
23
+ handlers: AuthHandlers;
24
+ services: (() => () => void)[];
25
+ unlistenServices: (() => void)[];
26
+ method<Name extends "get-did-bootstrap" | "subscribe-needs-bootstrap" | "subscribe-bootstrap" | "subscribe-get-login-methods" | "subscribe-get-user" | "subscribe-change-password" | "subscribe-sign-in" | "subscribe-sign-out" | "subscribe-set-token" | "enable-openid" | "get-openid-config" | "enable-password">(name: Name, func: AuthHandlers[Name]): void;
27
+ service(func: () => () => void): void;
28
+ combine(...apps: any[]): void;
29
+ startServices(): void;
30
+ stopServices(): void;
31
+ };
32
+ declare function didBootstrap(): Promise<boolean>;
33
+ declare function needsBootstrap({ url }?: {
34
+ url?: string;
35
+ }): Promise<{
36
+ error: string;
37
+ bootstrapped?: undefined;
38
+ hasServer?: undefined;
39
+ availableLoginMethods?: undefined;
40
+ multiuser?: undefined;
41
+ } | {
42
+ bootstrapped: boolean;
43
+ hasServer: boolean;
44
+ error?: undefined;
45
+ availableLoginMethods?: undefined;
46
+ multiuser?: undefined;
47
+ } | {
48
+ bootstrapped: boolean;
49
+ availableLoginMethods: {
50
+ method: string;
51
+ displayName: string;
52
+ active: boolean;
53
+ }[];
54
+ multiuser: boolean;
55
+ hasServer: boolean;
56
+ error?: undefined;
57
+ }>;
58
+ declare function bootstrap(loginConfig: {
59
+ password?: string;
60
+ openId?: OpenIdConfig;
61
+ }): Promise<{
62
+ error: string;
63
+ } | {
64
+ error?: undefined;
65
+ }>;
66
+ declare function getLoginMethods(): Promise<{
67
+ error: string;
68
+ methods?: undefined;
69
+ } | {
70
+ methods: {
71
+ method: string;
72
+ displayName: string;
73
+ active: boolean;
74
+ }[];
75
+ error?: undefined;
76
+ }>;
77
+ declare function getUser(): Promise<{
78
+ offline: boolean;
79
+ userName?: undefined;
80
+ permission?: undefined;
81
+ userId?: undefined;
82
+ displayName?: undefined;
83
+ loginMethod?: undefined;
84
+ tokenExpired?: undefined;
85
+ } | {
86
+ offline: boolean;
87
+ userName: any;
88
+ permission: any;
89
+ userId: any;
90
+ displayName: any;
91
+ loginMethod: any;
92
+ tokenExpired: boolean;
93
+ }>;
94
+ declare function changePassword({ password }: {
95
+ password: string;
96
+ }): Promise<{
97
+ error: string;
98
+ } | {
99
+ error?: undefined;
100
+ }>;
101
+ declare function signIn(loginInfo: {
102
+ password: string;
103
+ loginMethod?: string;
104
+ } | {
105
+ returnUrl: string;
106
+ loginMethod?: 'openid';
107
+ }): Promise<{
108
+ error: string;
109
+ redirectUrl?: undefined;
110
+ } | {
111
+ redirectUrl: string;
112
+ error?: undefined;
113
+ } | {
114
+ error?: undefined;
115
+ redirectUrl?: undefined;
116
+ }>;
117
+ declare function signOut(): Promise<string>;
118
+ declare function setToken({ token }: {
119
+ token: string;
120
+ }): Promise<void>;
121
+ declare function enableOpenId(openIdConfig: {
122
+ openId: OpenIdConfig;
123
+ }): Promise<{
124
+ error: string;
125
+ } | {
126
+ error?: undefined;
127
+ }>;
128
+ declare function getOpenIdConfig({ password }: {
129
+ password: string;
130
+ }): Promise<{
131
+ openId: OpenIdConfig;
132
+ } | {
133
+ error: string;
134
+ }>;
135
+ declare function enablePassword(passwordConfig: {
136
+ password: string;
137
+ }): Promise<{
138
+ error: string;
139
+ } | {
140
+ error?: undefined;
141
+ }>;
142
+ export {};
@@ -1,9 +1,10 @@
1
- export declare function getBudgetType(): any;
1
+ export declare function getBudgetType(): "report" | "rollover";
2
2
  export declare function getBudgetRange(start: string, end: string): {
3
3
  start: string;
4
4
  end: string;
5
5
  range: string[];
6
6
  };
7
+ export declare function createCategory(cat: any, sheetName: any, prevSheetName: any, start: any, end: any): void;
7
8
  export declare function triggerBudgetChanges(oldValues: any, newValues: any): void;
8
9
  export declare function doTransfer(categoryIds: any, transferId: any): Promise<void>;
9
10
  export declare function createBudget(months: any): Promise<void>;
@@ -1,4 +1,7 @@
1
1
  export declare function createBlankCategory(cat: any, months: any): void;
2
2
  export declare function createCategory(cat: any, sheetName: any, prevSheetName: any): void;
3
+ export declare function createCategoryGroup(group: any, sheetName: any): void;
3
4
  export declare function createSummary(groups: any, categories: any, prevSheetName: any, sheetName: any): void;
4
5
  export declare function createBudget(meta: any, categories: any, months: any): void;
6
+ export declare function handleCategoryChange(months: any, oldValue: any, newValue: any): void;
7
+ export declare function handleCategoryGroupChange(months: any, oldValue: any, newValue: any): void;
@@ -1,2 +1,5 @@
1
1
  export declare function createCategory(cat: any, sheetName: any, prevSheetName: any): Promise<void>;
2
- export declare function createSummary(groups: any, categories: any, sheetName: any): void;
2
+ export declare function createCategoryGroup(group: any, sheetName: any): void;
3
+ export declare function createSummary(groups: any, sheetName: any): void;
4
+ export declare function handleCategoryChange(months: any, oldValue: any, newValue: any): void;
5
+ export declare function handleCategoryGroupChange(months: any, oldValue: any, newValue: any): void;
@@ -0,0 +1,139 @@
1
+ import { Budget } from '../../types/budget';
2
+ import * as cloudStorage from '../cloud-storage';
3
+ import { ImportableBudgetType } from '../importers';
4
+ export type BudgetFileHandlers = {
5
+ 'validate-budget-name': typeof handleValidateBudgetName;
6
+ 'unique-budget-name': typeof handleUniqueBudgetName;
7
+ 'get-budgets': typeof getBudgets;
8
+ 'get-remote-files': typeof getRemoteFiles;
9
+ 'get-user-file-info': typeof getUserFileInfo;
10
+ 'reset-budget-cache': typeof resetBudgetCache;
11
+ 'upload-budget': typeof uploadBudget;
12
+ 'download-budget': typeof downloadBudget;
13
+ 'sync-budget': typeof syncBudget;
14
+ 'load-budget': typeof loadBudget;
15
+ 'create-demo-budget': typeof createDemoBudget;
16
+ 'close-budget': typeof closeBudget;
17
+ 'delete-budget': typeof deleteBudget;
18
+ 'duplicate-budget': typeof duplicateBudget;
19
+ 'create-budget': typeof createBudget;
20
+ 'import-budget': typeof importBudget;
21
+ 'export-budget': typeof exportBudget;
22
+ 'upload-file-web': typeof uploadFileWeb;
23
+ 'backups-get': typeof getBackups;
24
+ 'backup-load': typeof loadBackup;
25
+ 'backup-make': typeof makeBackup;
26
+ 'get-last-opened-backup': typeof getLastOpenedBackup;
27
+ };
28
+ export declare const app: {
29
+ events: import("mitt").Emitter<{
30
+ sync: import("../../types/server-events").ServerEvents["sync-event"];
31
+ 'load-budget': {
32
+ id: string;
33
+ };
34
+ }>;
35
+ handlers: BudgetFileHandlers;
36
+ services: (() => () => void)[];
37
+ unlistenServices: (() => void)[];
38
+ method<Name extends "load-budget" | "validate-budget-name" | "unique-budget-name" | "get-budgets" | "get-remote-files" | "get-user-file-info" | "reset-budget-cache" | "upload-budget" | "download-budget" | "sync-budget" | "create-demo-budget" | "close-budget" | "delete-budget" | "duplicate-budget" | "create-budget" | "import-budget" | "export-budget" | "upload-file-web" | "backups-get" | "backup-load" | "backup-make" | "get-last-opened-backup">(name: Name, func: BudgetFileHandlers[Name]): void;
39
+ service(func: () => () => void): void;
40
+ combine(...apps: any[]): void;
41
+ startServices(): void;
42
+ stopServices(): void;
43
+ };
44
+ declare function handleValidateBudgetName({ name }: {
45
+ name: string;
46
+ }): Promise<{
47
+ valid: boolean;
48
+ message?: string;
49
+ }>;
50
+ declare function handleUniqueBudgetName({ name }: {
51
+ name: string;
52
+ }): Promise<string>;
53
+ declare function getBudgets(): Promise<Budget[]>;
54
+ declare function getRemoteFiles(): Promise<cloudStorage.RemoteFile[]>;
55
+ declare function getUserFileInfo(fileId: string): Promise<cloudStorage.RemoteFile>;
56
+ declare function resetBudgetCache(): Promise<void>;
57
+ declare function uploadBudget({ id }?: {
58
+ id?: Budget['id'];
59
+ }): Promise<{
60
+ error?: {
61
+ reason: string;
62
+ };
63
+ }>;
64
+ declare function downloadBudget({ cloudFileId, }: {
65
+ cloudFileId: Budget['cloudFileId'];
66
+ }): Promise<{
67
+ id?: Budget['id'];
68
+ error?: {
69
+ reason: string;
70
+ meta?: unknown;
71
+ };
72
+ }>;
73
+ declare function syncBudget(): Promise<{
74
+ error?: {
75
+ message: string;
76
+ reason: string;
77
+ meta: unknown;
78
+ };
79
+ }>;
80
+ declare function loadBudget({ id }: {
81
+ id: Budget['id'];
82
+ }): Promise<{
83
+ error?: "budget-not-found" | "loading-budget" | "out-of-sync-migrations" | "out-of-sync-data" | "opening-budget";
84
+ }>;
85
+ declare function createDemoBudget(): Promise<{
86
+ error: "budget-not-found" | "loading-budget" | "out-of-sync-migrations" | "out-of-sync-data" | "opening-budget";
87
+ } | {
88
+ error?: undefined;
89
+ }>;
90
+ declare function closeBudget(): Promise<string>;
91
+ declare function deleteBudget({ id, cloudFileId, }: {
92
+ id?: Budget['id'];
93
+ cloudFileId?: Budget['cloudFileId'];
94
+ }): Promise<"ok" | "fail">;
95
+ declare function duplicateBudget({ id, newName, cloudSync, open, }: {
96
+ id: Budget['id'];
97
+ newName: Budget['name'];
98
+ cloudSync: boolean;
99
+ open: 'none' | 'original' | 'copy';
100
+ }): Promise<Budget['id']>;
101
+ declare function createBudget({ budgetName, avoidUpload, testMode, testBudgetId, }?: {
102
+ budgetName?: Budget['name'];
103
+ avoidUpload?: boolean;
104
+ testMode?: boolean;
105
+ testBudgetId?: Budget['name'];
106
+ }): Promise<{
107
+ error: "budget-not-found" | "loading-budget" | "out-of-sync-migrations" | "out-of-sync-data" | "opening-budget";
108
+ } | {
109
+ error?: undefined;
110
+ }>;
111
+ declare function importBudget({ filepath, type, }: {
112
+ filepath: string;
113
+ type: ImportableBudgetType;
114
+ }): Promise<{
115
+ error?: string;
116
+ }>;
117
+ declare function exportBudget(): Promise<{
118
+ data: Buffer<ArrayBuffer>;
119
+ error?: undefined;
120
+ } | {
121
+ error: string;
122
+ data?: undefined;
123
+ }>;
124
+ declare function uploadFileWeb({ filename, contents, }: {
125
+ filename: string;
126
+ contents: ArrayBuffer;
127
+ }): Promise<{}>;
128
+ declare function getBackups({ id }: {
129
+ id: any;
130
+ }): Promise<import("./backups").Backup[]>;
131
+ declare function loadBackup({ id, backupId }: {
132
+ id: any;
133
+ backupId: any;
134
+ }): Promise<void>;
135
+ declare function makeBackup({ id }: {
136
+ id: any;
137
+ }): Promise<void>;
138
+ declare function getLastOpenedBackup(): Promise<string>;
139
+ export {};
@@ -34,8 +34,8 @@ export declare function importBuffer(fileData: any, buffer: any): Promise<{
34
34
  export declare function upload(): Promise<void>;
35
35
  export declare function possiblyUpload(): Promise<void>;
36
36
  export declare function removeFile(fileId: any): Promise<void>;
37
- export declare function listRemoteFiles(): Promise<RemoteFile[] | null>;
37
+ export declare function listRemoteFiles(): Promise<RemoteFile[]>;
38
38
  export declare function getRemoteFile(fileId: string): Promise<RemoteFile | null>;
39
- export declare function download(fileId: any): Promise<{
39
+ export declare function download(cloudFileId: any): Promise<{
40
40
  id: any;
41
41
  }>;
@@ -1,4 +1,5 @@
1
1
  import { Database } from '@jlongster/sql.js';
2
+ import { TransactionEntity } from '../../types/models';
2
3
  import { WithRequired } from '../../types/util';
3
4
  import { DbAccount, DbBank, DbCategory, DbCategoryGroup, DbPayee, DbTransaction, DbViewTransaction } from './types';
4
5
  export * from './types';
@@ -80,7 +81,7 @@ export declare function getCategoriesGrouped(ids?: Array<DbCategoryGroup['id']>)
80
81
  export declare function insertCategoryGroup(group: WithRequired<Partial<DbCategoryGroup>, 'name'>): Promise<DbCategoryGroup['id']>;
81
82
  export declare function updateCategoryGroup(group: WithRequired<Partial<DbCategoryGroup>, 'name' | 'is_income'>): Promise<void>;
82
83
  export declare function moveCategoryGroup(id: DbCategoryGroup['id'], targetId: DbCategoryGroup['id']): Promise<void>;
83
- export declare function deleteCategoryGroup(group: Pick<DbCategoryGroup, 'id'>, transferId?: string): Promise<void>;
84
+ export declare function deleteCategoryGroup(group: Pick<DbCategoryGroup, 'id'>, transferId?: DbCategory['id']): Promise<void>;
84
85
  export declare function insertCategory(category: WithRequired<Partial<DbCategory>, 'name' | 'cat_group'>, { atEnd }?: {
85
86
  atEnd?: boolean | undefined;
86
87
  }): Promise<DbCategory['id']>;
@@ -111,6 +112,6 @@ export declare function deleteAccount(account: any): Promise<void>;
111
112
  export declare function moveAccount(id: DbAccount['id'], targetId: DbAccount['id'] | null): Promise<void>;
112
113
  export declare function getTransaction(id: DbViewTransaction['id']): Promise<any>;
113
114
  export declare function getTransactions(accountId: DbTransaction['acct']): Promise<any[]>;
114
- export declare function insertTransaction(transaction: any): Promise<any>;
115
+ export declare function insertTransaction(transaction: any): Promise<TransactionEntity['id']>;
115
116
  export declare function updateTransaction(transaction: any): Promise<void>;
116
117
  export declare function deleteTransaction(transaction: any): Promise<void>;