@actual-app/api 6.8.2 → 6.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/@types/jest.config.d.ts +7 -7
  2. package/@types/loot-core/client/constants.d.ts +2 -0
  3. package/@types/loot-core/client/state-types/index.d.ts +1 -1
  4. package/@types/loot-core/client/state-types/modals.d.ts +27 -8
  5. package/@types/loot-core/client/state-types/notifications.d.ts +18 -1
  6. package/@types/loot-core/client/state-types/prefs.d.ts +9 -4
  7. package/@types/loot-core/client/state-types/queries.d.ts +8 -0
  8. package/@types/loot-core/server/accounts/parse-file.d.ts +1 -0
  9. package/@types/loot-core/server/accounts/rules.d.ts +2 -2
  10. package/@types/loot-core/server/accounts/sync.d.ts +12 -1
  11. package/@types/loot-core/server/accounts/transaction-rules.d.ts +1 -3
  12. package/@types/loot-core/server/accounts/transactions.d.ts +3 -5
  13. package/@types/loot-core/server/api-models.d.ts +21 -6
  14. package/@types/loot-core/server/aql/schema/index.d.ts +41 -3
  15. package/@types/loot-core/server/budget/actions.d.ts +2 -1
  16. package/@types/loot-core/server/budget/statements.d.ts +9 -0
  17. package/@types/loot-core/server/budget/template-notes.d.ts +5 -0
  18. package/@types/loot-core/server/budget/types/templates.d.ts +82 -0
  19. package/@types/loot-core/server/cloud-storage.d.ts +0 -1
  20. package/@types/loot-core/server/dashboard/app.d.ts +12 -0
  21. package/@types/loot-core/server/dashboard/types/handlers.d.ts +24 -0
  22. package/@types/loot-core/server/db/index.d.ts +4 -2
  23. package/@types/loot-core/server/db/types.d.ts +9 -0
  24. package/@types/loot-core/server/encryption-internals.d.ts +0 -1
  25. package/@types/loot-core/server/encryption-internals.web.d.ts +0 -1
  26. package/@types/loot-core/server/encryption.d.ts +0 -1
  27. package/@types/loot-core/server/errors.d.ts +2 -0
  28. package/@types/loot-core/server/importers/actual.d.ts +0 -1
  29. package/@types/loot-core/server/importers/index.d.ts +0 -1
  30. package/@types/loot-core/server/importers/ynab4.d.ts +0 -1
  31. package/@types/loot-core/server/importers/ynab5.d.ts +0 -1
  32. package/@types/loot-core/server/main-app.d.ts +1 -1
  33. package/@types/loot-core/server/models.d.ts +4 -4
  34. package/@types/loot-core/server/prefs.d.ts +7 -2
  35. package/@types/loot-core/server/reports/app.d.ts +46 -0
  36. package/@types/loot-core/server/rules/types/handlers.d.ts +4 -6
  37. package/@types/loot-core/server/sync/make-test-message.d.ts +0 -1
  38. package/@types/loot-core/shared/dashboard.d.ts +2 -0
  39. package/@types/loot-core/shared/months.d.ts +7 -6
  40. package/@types/loot-core/shared/normalisation.d.ts +1 -0
  41. package/@types/loot-core/shared/rules.d.ts +5 -1
  42. package/@types/loot-core/shared/schedules.d.ts +22 -22
  43. package/@types/loot-core/shared/transactions.d.ts +26 -75
  44. package/@types/loot-core/shared/util.d.ts +10 -13
  45. package/@types/loot-core/types/api-handlers.d.ts +29 -3
  46. package/@types/loot-core/types/file.d.ts +2 -0
  47. package/@types/loot-core/types/handlers.d.ts +2 -0
  48. package/@types/loot-core/types/models/category-group.d.ts +6 -2
  49. package/@types/loot-core/types/models/category.d.ts +4 -2
  50. package/@types/loot-core/types/models/dashboard.d.ts +56 -0
  51. package/@types/loot-core/types/models/index.d.ts +1 -0
  52. package/@types/loot-core/types/models/payee.d.ts +6 -7
  53. package/@types/loot-core/types/models/reports.d.ts +12 -5
  54. package/@types/loot-core/types/models/rule.d.ts +100 -7
  55. package/@types/loot-core/types/models/transaction.d.ts +12 -25
  56. package/@types/loot-core/types/prefs.d.ts +50 -26
  57. package/@types/loot-core/types/server-handlers.d.ts +13 -8
  58. package/@types/loot-core/types/util.d.ts +4 -0
  59. package/@types/methods.d.ts +8 -11
  60. package/@types/migrations/1722717601000_reports_move_selected_categories.d.ts +1 -0
  61. package/@types/migrations/1722804019000_create_dashboard_table.d.ts +1 -0
  62. package/dist/app/bundle.api.js +5544 -1857
  63. package/dist/app/query.js +1 -2
  64. package/dist/index.js +3 -3
  65. package/dist/injected.js +2 -2
  66. package/dist/methods.js +65 -41
  67. package/dist/methods.test.js +23 -15
  68. package/dist/migrations/1632571489012_remove_cache.js +1 -1
  69. package/dist/migrations/1720310586000_link_transfer_schedules.sql +19 -0
  70. package/dist/migrations/1720664867241_add_payee_favorite.sql +5 -0
  71. package/dist/migrations/1720665000000_goal_context.sql +6 -0
  72. package/dist/migrations/1722717601000_reports_move_selected_categories.js +39 -0
  73. package/dist/migrations/1722804019000_create_dashboard_table.js +38 -0
  74. package/dist/package.json +2 -2
  75. package/dist/utils.js +2 -3
  76. package/dist/validateNodeVersion.js +1 -2
  77. package/package.json +2 -2
@@ -1,9 +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: {
1
+ export let moduleFileExtensions: string[];
2
+ export let testEnvironment: string;
3
+ export let testPathIgnorePatterns: string[];
4
+ export let watchPathIgnorePatterns: string[];
5
+ export let setupFilesAfterEnv: string[];
6
+ export let transformIgnorePatterns: string[];
7
+ export let transform: {
8
8
  '^.+\\.(t|j)sx?$': string;
9
9
  };
@@ -5,6 +5,7 @@ export declare const MARK_ACCOUNT_READ = "MARK_ACCOUNT_READ";
5
5
  export declare const LOAD_ACCOUNTS = "LOAD_ACCOUNTS";
6
6
  export declare const UPDATE_ACCOUNT = "UPDATE_ACCOUNT";
7
7
  export declare const LOAD_CATEGORIES = "LOAD_CATEGORIES";
8
+ export declare const LOAD_COMMON_PAYEES = "LOAD_COMMON_PAYEES";
8
9
  export declare const LOAD_PAYEES = "LOAD_PAYEES";
9
10
  export declare const SET_PREFS = "SET_PREFS";
10
11
  export declare const MERGE_LOCAL_PREFS = "MERGE_LOCAL_PREFS";
@@ -21,6 +22,7 @@ export declare const COLLAPSE_MODALS = "COLLAPSE_MODALS";
21
22
  export declare const POP_MODAL = "POP_MODAL";
22
23
  export declare const ADD_NOTIFICATION = "ADD_NOTIFICATION";
23
24
  export declare const REMOVE_NOTIFICATION = "REMOVE_NOTIFICATION";
25
+ export declare const SET_NOTIFICATION_INSET = "SET_NOTIFICATION_INSET";
24
26
  export declare const GET_USER_DATA = "GET_USER_DATA";
25
27
  export declare const SET_LAST_UNDO_STATE = "SET_LAST_UNDO_STATE";
26
28
  export declare const SET_LAST_SPLIT_STATE = "SET_LAST_SPLIT_STATE";
@@ -36,6 +36,6 @@ export type State = {
36
36
  };
37
37
 
38
38
  declare module 'react-redux' {
39
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions, @typescript-eslint/no-empty-interface
39
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type, @typescript-eslint/consistent-type-definitions
40
40
  export interface DefaultRootState extends State {}
41
41
  }
@@ -4,6 +4,7 @@ import type {
4
4
  CategoryEntity,
5
5
  CategoryGroupEntity,
6
6
  GoCardlessToken,
7
+ ScheduleEntity,
7
8
  TransactionEntity,
8
9
  } from '../../types/models';
9
10
  import type { NewRuleEntity, RuleEntity } from '../../types/models/rule';
@@ -93,14 +94,17 @@ type FinanceModals = {
93
94
  };
94
95
 
95
96
  'edit-field': {
96
- name: string;
97
- month: string;
98
- onSubmit: (name: string, value: string) => void;
99
- onClose: () => void;
97
+ name: keyof Pick<TransactionEntity, 'date' | 'amount' | 'notes'>;
98
+ onSubmit: (
99
+ name: keyof Pick<TransactionEntity, 'date' | 'amount' | 'notes'>,
100
+ value: string | number,
101
+ mode?: 'prepend' | 'append' | 'replace' | null,
102
+ ) => void;
103
+ onClose?: () => void;
100
104
  };
101
105
 
102
106
  'category-autocomplete': {
103
- categoryGroups: CategoryGroupEntity[];
107
+ categoryGroups?: CategoryGroupEntity[];
104
108
  onSelect: (categoryId: string, categoryName: string) => void;
105
109
  month?: string;
106
110
  showHiddenCategories?: boolean;
@@ -124,12 +128,18 @@ type FinanceModals = {
124
128
 
125
129
  'schedule-edit': { id: string; transaction?: TransactionEntity } | null;
126
130
 
127
- 'schedule-link': { transactionIds: string[] } | null;
131
+ 'schedule-link': {
132
+ transactionIds: string[];
133
+ getTransaction: (
134
+ transactionId: TransactionEntity['id'],
135
+ ) => TransactionEntity;
136
+ accountName?: string;
137
+ onScheduleLinked?: (schedule: ScheduleEntity) => void;
138
+ };
128
139
 
129
140
  'schedules-discover': null;
130
141
 
131
142
  'schedule-posts-offline-notification': null;
132
- 'switch-budget-type': { onSwitch: () => void };
133
143
  'account-menu': {
134
144
  accountId: string;
135
145
  onSave: (account: AccountEntity) => void;
@@ -143,6 +153,7 @@ type FinanceModals = {
143
153
  onSave: (category: CategoryEntity) => void;
144
154
  onEditNotes: (id: string) => void;
145
155
  onDelete: (categoryId: string) => void;
156
+ onToggleVisibility: (categoryId: string) => void;
146
157
  onBudgetAction: (month: string, action: string, args?: unknown) => void;
147
158
  onClose?: () => void;
148
159
  };
@@ -168,6 +179,7 @@ type FinanceModals = {
168
179
  onAddCategory: (groupId: string, isIncome: boolean) => void;
169
180
  onEditNotes: (id: string) => void;
170
181
  onDelete: (groupId: string) => void;
182
+ onToggleVisibility: (groupId: string) => void;
171
183
  onClose?: () => void;
172
184
  };
173
185
  notes: {
@@ -237,7 +249,6 @@ type FinanceModals = {
237
249
  onAddCategoryGroup: () => void;
238
250
  onToggleHiddenCategories: () => void;
239
251
  onSwitchBudgetFile: () => void;
240
- onSwitchBudgetType: () => void;
241
252
  };
242
253
  'rollover-budget-month-menu': {
243
254
  month: string;
@@ -252,9 +263,11 @@ type FinanceModals = {
252
263
  'budget-list';
253
264
  'confirm-transaction-edit': {
254
265
  onConfirm: () => void;
266
+ onCancel?: () => void;
255
267
  confirmReason: string;
256
268
  };
257
269
  'confirm-transaction-delete': {
270
+ message?: string;
258
271
  onConfirm: () => void;
259
272
  };
260
273
  };
@@ -293,3 +306,9 @@ export type ModalsState = {
293
306
  modalStack: Modal[];
294
307
  isHidden: boolean;
295
308
  };
309
+
310
+ type Modal = {
311
+ name: string;
312
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
313
+ options?: any;
314
+ };
@@ -21,6 +21,12 @@ type NotificationWithId = Notification & { id: string };
21
21
 
22
22
  export type NotificationsState = {
23
23
  notifications: NotificationWithId[];
24
+ inset?: {
25
+ bottom?: number;
26
+ top?: number;
27
+ right?: number;
28
+ left?: number;
29
+ };
24
30
  };
25
31
 
26
32
  type AddNotificationAction = {
@@ -33,6 +39,17 @@ type RemoveNotificationAction = {
33
39
  id: string;
34
40
  };
35
41
 
42
+ type SetNotificationInsetAction = {
43
+ type: typeof constants.SET_NOTIFICATION_INSET;
44
+ inset: {
45
+ bottom?: number;
46
+ top?: number;
47
+ right?: number;
48
+ left?: number;
49
+ };
50
+ };
51
+
36
52
  export type NotificationsActions =
37
53
  | AddNotificationAction
38
- | RemoveNotificationAction;
54
+ | RemoveNotificationAction
55
+ | SetNotificationInsetAction;
@@ -1,20 +1,25 @@
1
- import type { LocalPrefs, GlobalPrefs } from '../../types/prefs';
1
+ import type {
2
+ GlobalPrefs,
3
+ LocalPrefs,
4
+ MetadataPrefs,
5
+ SyncedPrefs,
6
+ } from '../../types/prefs';
2
7
  import type * as constants from '../constants';
3
8
 
4
9
  export type PrefsState = {
5
- local: LocalPrefs;
10
+ local: LocalPrefs & MetadataPrefs & SyncedPrefs;
6
11
  global: GlobalPrefs;
7
12
  };
8
13
 
9
14
  export type SetPrefsAction = {
10
15
  type: typeof constants.SET_PREFS;
11
- prefs: LocalPrefs;
16
+ prefs: LocalPrefs & MetadataPrefs & SyncedPrefs;
12
17
  globalPrefs: GlobalPrefs;
13
18
  };
14
19
 
15
20
  export type MergeLocalPrefsAction = {
16
21
  type: typeof constants.MERGE_LOCAL_PREFS;
17
- prefs: LocalPrefs;
22
+ prefs: LocalPrefs & MetadataPrefs & SyncedPrefs;
18
23
  };
19
24
 
20
25
  export type MergeGlobalPrefsAction = {
@@ -11,6 +11,8 @@ export type QueriesState = {
11
11
  accountsLoaded: boolean;
12
12
  categories: Awaited<ReturnType<Handlers['get-categories']>>;
13
13
  categoriesLoaded: boolean;
14
+ commonPayeesLoaded: boolean;
15
+ commonPayees: Awaited<ReturnType<Handlers['common-payees-get']>>;
14
16
  payees: Awaited<ReturnType<Handlers['payees-get']>>;
15
17
  payeesLoaded: boolean;
16
18
  earliestTransaction: unknown | null;
@@ -58,6 +60,11 @@ type LoadPayeesAction = {
58
60
  payees: State['payees'];
59
61
  };
60
62
 
63
+ type LoadCommonPayeesAction = {
64
+ type: typeof constants.LOAD_COMMON_PAYEES;
65
+ payees: State['common_payees'];
66
+ };
67
+
61
68
  export type QueriesActions =
62
69
  | SetNewTransactionsAction
63
70
  | UpdateNewTransactionsAction
@@ -66,4 +73,5 @@ export type QueriesActions =
66
73
  | LoadAccountsAction
67
74
  | UpdateAccountAction
68
75
  | LoadCategoriesAction
76
+ | LoadCommonPayeesAction
69
77
  | LoadPayeesAction;
@@ -10,6 +10,7 @@ type ParseFileOptions = {
10
10
  hasHeaderRow?: boolean;
11
11
  delimiter?: string;
12
12
  fallbackMissingPayeeToMemo?: boolean;
13
+ skipLines?: number;
13
14
  };
14
15
  export declare function parseFile(filepath: string, options?: ParseFileOptions): Promise<ParseFileResult>;
15
16
  export {};
@@ -21,7 +21,7 @@ export declare class Condition {
21
21
  type: any;
22
22
  };
23
23
  }
24
- declare const ACTION_OPS: readonly ["set", "set-split-amount", "link-schedule"];
24
+ declare const ACTION_OPS: readonly ["set", "set-split-amount", "link-schedule", "prepend-notes", "append-notes"];
25
25
  type ActionOperator = (typeof ACTION_OPS)[number];
26
26
  export declare class Action {
27
27
  field: any;
@@ -34,7 +34,7 @@ export declare class Action {
34
34
  exec(object: any): void;
35
35
  serialize(): {
36
36
  options: any;
37
- op: "set" | "set-split-amount" | "link-schedule";
37
+ op: "set" | "set-split-amount" | "link-schedule" | "prepend-notes" | "append-notes";
38
38
  field: any;
39
39
  value: any;
40
40
  type: any;
@@ -1,7 +1,14 @@
1
1
  export declare function getGoCardlessAccounts(userId: any, userKey: any, id: any): Promise<any>;
2
- export declare function reconcileTransactions(acctId: any, transactions: any, isBankSyncAccount?: boolean): Promise<{
2
+ export declare function reconcileTransactions(acctId: any, transactions: any, isBankSyncAccount?: boolean, strictIdChecking?: boolean, isPreview?: boolean): Promise<{
3
3
  added: any[];
4
4
  updated: any[];
5
+ updatedPreview: any[];
6
+ }>;
7
+ export declare function matchTransactions(acctId: any, transactions: any, isBankSyncAccount?: boolean, strictIdChecking?: boolean): Promise<{
8
+ payeesToCreate: Map<any, any>;
9
+ transactionsStep1: any[];
10
+ transactionsStep2: any[];
11
+ transactionsStep3: any[];
5
12
  }>;
6
13
  export declare function addTransactions(acctId: any, transactions: any, { runTransfers, learnCategories }?: {
7
14
  runTransfers?: boolean;
@@ -10,4 +17,8 @@ export declare function addTransactions(acctId: any, transactions: any, { runTra
10
17
  export declare function syncAccount(userId: string, userKey: string, id: string, acctId: string, bankId: string): Promise<{
11
18
  added: any[];
12
19
  updated: any[];
20
+ updatedPreview: any[];
21
+ } | {
22
+ added: any[];
23
+ updated: any[];
13
24
  }>;
@@ -18,9 +18,7 @@ export declare function insertRule(rule: Omit<RuleEntity, 'id'> & {
18
18
  id?: string;
19
19
  }): Promise<any>;
20
20
  export declare function updateRule(rule: any): Promise<void>;
21
- export declare function deleteRule<T extends {
22
- id: string;
23
- }>(rule: T): Promise<false | void>;
21
+ export declare function deleteRule(id: string): Promise<boolean>;
24
22
  export declare function runRules(trans: any): any;
25
23
  export declare function conditionsToAQL(conditions: any, { recurDateBounds }?: {
26
24
  recurDateBounds?: number;
@@ -1,8 +1,6 @@
1
- import { NewTransactionEntity, TransactionEntity } from '../../types/models';
2
- export declare function batchUpdateTransactions({ added, deleted, updated, learnCategories, detectOrphanPayees, runTransfers, }: {
3
- added?: Array<Partial<NewTransactionEntity | TransactionEntity>>;
4
- deleted?: Array<Partial<NewTransactionEntity | TransactionEntity>>;
5
- updated?: Array<Partial<NewTransactionEntity | TransactionEntity>>;
1
+ import { Diff } from '../../shared/util';
2
+ import { TransactionEntity } from '../../types/models';
3
+ export declare function batchUpdateTransactions({ added, deleted, updated, learnCategories, detectOrphanPayees, runTransfers, }: Partial<Diff<TransactionEntity>> & {
6
4
  learnCategories?: boolean;
7
5
  detectOrphanPayees?: boolean;
8
6
  runTransfers?: boolean;
@@ -1,4 +1,6 @@
1
+ import { Budget } from '../types/budget';
1
2
  import type { AccountEntity, CategoryEntity, CategoryGroupEntity, PayeeEntity } from '../types/models';
3
+ import { RemoteFile } from './cloud-storage';
2
4
  export type APIAccountEntity = Pick<AccountEntity, 'id' | 'name'> & {
3
5
  offbudget: boolean;
4
6
  closed: boolean;
@@ -16,10 +18,10 @@ export type APICategoryEntity = Pick<CategoryEntity, 'id' | 'name' | 'is_income'
16
18
  export declare const categoryModel: {
17
19
  toExternal(category: CategoryEntity): APICategoryEntity;
18
20
  fromExternal(category: APICategoryEntity): {
19
- id?: string;
21
+ id: string;
20
22
  name: string;
21
23
  is_income?: boolean;
22
- cat_group?: string;
24
+ cat_group?: CategoryGroupEntity["id"];
23
25
  sort_order?: number;
24
26
  tombstone?: boolean;
25
27
  hidden?: boolean;
@@ -28,10 +30,10 @@ export declare const categoryModel: {
28
30
  update?: boolean;
29
31
  }): {
30
32
  hidden: number;
31
- id?: string;
33
+ id: string;
32
34
  name: string;
33
35
  is_income?: boolean;
34
- cat_group?: string;
36
+ cat_group?: CategoryGroupEntity["id"];
35
37
  tombstone?: boolean;
36
38
  };
37
39
  };
@@ -45,11 +47,11 @@ export declare const categoryGroupModel: {
45
47
  update?: boolean;
46
48
  }): {
47
49
  hidden: number;
48
- id?: string;
50
+ id: string;
51
+ categories?: CategoryEntity[];
49
52
  name: string;
50
53
  is_income?: boolean;
51
54
  tombstone?: boolean;
52
- categories?: CategoryEntity[];
53
55
  };
54
56
  };
55
57
  export type APIPayeeEntity = Pick<PayeeEntity, 'id' | 'name' | 'transfer_acct'>;
@@ -64,3 +66,16 @@ export declare const payeeModel: {
64
66
  update?: boolean;
65
67
  }): PayeeEntity;
66
68
  };
69
+ export type APIFileEntity = Omit<RemoteFile, 'deleted' | 'fileId'> & {
70
+ id?: string;
71
+ cloudFileId: string;
72
+ state?: 'remote';
73
+ };
74
+ export declare const remoteFileModel: {
75
+ toExternal(file: RemoteFile): APIFileEntity | null;
76
+ fromExternal(file: APIFileEntity): RemoteFile;
77
+ };
78
+ export declare const budgetModel: {
79
+ toExternal(file: Budget): APIFileEntity;
80
+ fromExternal(file: APIFileEntity): Budget;
81
+ };
@@ -75,6 +75,9 @@ export declare const schema: {
75
75
  tombstone: {
76
76
  type: string;
77
77
  };
78
+ favorite: {
79
+ type: string;
80
+ };
78
81
  };
79
82
  accounts: {
80
83
  id: {
@@ -95,6 +98,12 @@ export declare const schema: {
95
98
  tombstone: {
96
99
  type: string;
97
100
  };
101
+ account_id: {
102
+ type: string;
103
+ };
104
+ official_name: {
105
+ type: string;
106
+ };
98
107
  account_sync_source: {
99
108
  type: string;
100
109
  };
@@ -274,9 +283,6 @@ export declare const schema: {
274
283
  include_current: {
275
284
  type: string;
276
285
  };
277
- selected_categories: {
278
- type: string;
279
- };
280
286
  graph_type: {
281
287
  type: string;
282
288
  };
@@ -318,6 +324,9 @@ export declare const schema: {
318
324
  goal: {
319
325
  type: string;
320
326
  };
327
+ long_goal: {
328
+ type: string;
329
+ };
321
330
  };
322
331
  zero_budgets: {
323
332
  id: {
@@ -338,6 +347,35 @@ export declare const schema: {
338
347
  goal: {
339
348
  type: string;
340
349
  };
350
+ long_goal: {
351
+ type: string;
352
+ };
353
+ };
354
+ dashboard: {
355
+ id: {
356
+ type: string;
357
+ };
358
+ type: {
359
+ type: string;
360
+ };
361
+ width: {
362
+ type: string;
363
+ };
364
+ height: {
365
+ type: string;
366
+ };
367
+ x: {
368
+ type: string;
369
+ };
370
+ y: {
371
+ type: string;
372
+ };
373
+ meta: {
374
+ type: string;
375
+ };
376
+ tombstone: {
377
+ type: string;
378
+ };
341
379
  };
342
380
  };
343
381
  export declare const schemaConfig: SchemaConfig;
@@ -9,10 +9,11 @@ export declare function setBudget({ category, month, amount, }: {
9
9
  month: string;
10
10
  amount: unknown;
11
11
  }): Promise<void>;
12
- export declare function setGoal({ month, category, goal }: {
12
+ export declare function setGoal({ month, category, goal, long_goal }: {
13
13
  month: any;
14
14
  category: any;
15
15
  goal: any;
16
+ long_goal: any;
16
17
  }): Promise<void>;
17
18
  export declare function setBuffer(month: string, amount: unknown): Promise<void>;
18
19
  export declare function copyPreviousMonth({ month, }: {
@@ -0,0 +1,9 @@
1
+ import { Schedule } from '../db/types';
2
+ export declare function resetCategoryGoalDefsWithNoTemplates(): Promise<void>;
3
+ export type CategoryWithTemplateNote = {
4
+ id: string;
5
+ name: string;
6
+ note: string;
7
+ };
8
+ export declare function getCategoriesWithTemplateNotes(): Promise<CategoryWithTemplateNote[]>;
9
+ export declare function getActiveSchedules(): Promise<Schedule[]>;
@@ -0,0 +1,5 @@
1
+ import { Notification } from '../../client/state-types/notifications';
2
+ export declare const TEMPLATE_PREFIX = "#template";
3
+ export declare const GOAL_PREFIX = "#goal";
4
+ export declare function storeTemplates(): Promise<void>;
5
+ export declare function checkTemplates(): Promise<Notification>;
@@ -0,0 +1,82 @@
1
+ interface BaseTemplate {
2
+ type: string;
3
+ priority?: number;
4
+ directive: string;
5
+ }
6
+
7
+ interface PercentageTemplate extends BaseTemplate {
8
+ type: 'percentage';
9
+ percent: number;
10
+ previous: boolean;
11
+ category: string;
12
+ }
13
+
14
+ interface WeekTemplate extends BaseTemplate {
15
+ type: 'week';
16
+ amount: number;
17
+ weeks: number | null;
18
+ starting: string;
19
+ limit?: { amount: number; hold: boolean };
20
+ }
21
+
22
+ interface ByTemplate extends BaseTemplate {
23
+ type: 'by';
24
+ amount: number;
25
+ month: string;
26
+ repeat?: { annual: boolean; repeat?: number };
27
+ from?: string;
28
+ }
29
+
30
+ interface SpendTemplate extends BaseTemplate {
31
+ type: 'spend';
32
+ amount: number;
33
+ month: string;
34
+ from: string;
35
+ repeat?: { annual: boolean; repeat?: number };
36
+ }
37
+
38
+ interface SimpleTemplate extends BaseTemplate {
39
+ type: 'simple';
40
+ monthly?: number;
41
+ limit?: { amount: number; hold: boolean };
42
+ }
43
+
44
+ interface ScheduleTemplate extends BaseTemplate {
45
+ type: 'schedule';
46
+ name: string;
47
+ full?: boolean;
48
+ }
49
+
50
+ interface RemainderTemplate extends BaseTemplate {
51
+ type: 'remainder';
52
+ weight: number;
53
+ limit?: { amount: number; hold: boolean };
54
+ }
55
+
56
+ interface AverageTemplate extends BaseTemplate {
57
+ type: 'average';
58
+ amount: number;
59
+ }
60
+
61
+ interface GoalTemplate extends BaseTemplate {
62
+ type: 'simple';
63
+ amount: number;
64
+ }
65
+
66
+ interface ErrorTemplate extends BaseTemplate {
67
+ type: 'error';
68
+ line: string;
69
+ error: string;
70
+ }
71
+
72
+ export type Template =
73
+ | PercentageTemplate
74
+ | WeekTemplate
75
+ | ByTemplate
76
+ | SpendTemplate
77
+ | SimpleTemplate
78
+ | ScheduleTemplate
79
+ | RemainderTemplate
80
+ | AverageTemplate
81
+ | GoalTemplate
82
+ | ErrorTemplate;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  export interface RemoteFile {
3
2
  deleted: boolean;
4
3
  fileId: string;
@@ -0,0 +1,12 @@
1
+ import { DashboardHandlers } from './types/handlers';
2
+ export declare const app: {
3
+ events: any;
4
+ handlers: DashboardHandlers;
5
+ services: any;
6
+ unlistenServices: any;
7
+ 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;
9
+ combine(...apps: any[]): void;
10
+ startServices(): void;
11
+ stopServices(): void;
12
+ };
@@ -0,0 +1,24 @@
1
+ import { type Widget } from '../../../types/models';
2
+ import { type EverythingButIdOptional } from '../../../types/util';
3
+
4
+ export interface DashboardHandlers {
5
+ 'dashboard-update': (
6
+ widgets: EverythingButIdOptional<Omit<Widget, 'tombstone'>>[],
7
+ ) => Promise<void>;
8
+ 'dashboard-update-widget': (
9
+ widget: EverythingButIdOptional<Omit<Widget, 'tombstone'>>,
10
+ ) => Promise<void>;
11
+ 'dashboard-reset': () => Promise<void>;
12
+ 'dashboard-add-widget': (
13
+ widget: Omit<Widget, 'id' | 'x' | 'y' | 'tombstone'> &
14
+ Partial<Pick<Widget, 'x' | 'y'>>,
15
+ ) => Promise<void>;
16
+ 'dashboard-remove-widget': (widgetId: string) => Promise<void>;
17
+ 'dashboard-import': (args: {
18
+ filepath: string;
19
+ }) => Promise<
20
+ | { status: 'ok' }
21
+ | { error: 'json-parse-error' | 'internal-error' }
22
+ | { error: 'validation-error'; message: string }
23
+ >;
24
+ }
@@ -13,7 +13,7 @@ export declare function getDatabase(): {
13
13
  exec(sql: string, params?: import("@jlongster/sql.js").BindParams): import("@jlongster/sql.js").QueryExecResult[];
14
14
  export(): Uint8Array;
15
15
  getRowsModified(): number;
16
- handleError(): null;
16
+ handleError(): null | never;
17
17
  iterateStatements(sql: string): {
18
18
  getRemainingSql(): string;
19
19
  next(): import("@jlongster/sql.js").StatementIteratorResult;
@@ -29,7 +29,7 @@ export declare function getDatabase(): {
29
29
  reset(): void;
30
30
  run(values?: import("@jlongster/sql.js").BindParams): void;
31
31
  step(): boolean;
32
- }, any, undefined>;
32
+ }>;
33
33
  };
34
34
  prepare(sql: string, params?: import("@jlongster/sql.js").BindParams): {
35
35
  bind(values?: import("@jlongster/sql.js").BindParams): boolean;
@@ -62,6 +62,7 @@ export declare function update(table: any, params: any): Promise<void>;
62
62
  export declare function insertWithUUID(table: any, row: any): Promise<any>;
63
63
  export declare function insert(table: any, row: any): Promise<void>;
64
64
  export declare function delete_(table: any, id: any): Promise<void>;
65
+ export declare function deleteAll(table: string): Promise<void>;
65
66
  export declare function selectWithSchema(table: any, sql: any, params: any): Promise<any>;
66
67
  export declare function selectFirstWithSchema(table: any, sql: any, params: any): Promise<any>;
67
68
  export declare function insertWithSchema(table: any, row: any): Promise<any>;
@@ -85,6 +86,7 @@ export declare function deleteTransferPayee(payee: any): Promise<void>;
85
86
  export declare function updatePayee(payee: any): Promise<void>;
86
87
  export declare function mergePayees(target: string, ids: string[]): Promise<void>;
87
88
  export declare function getPayees(): Promise<any>;
89
+ export declare function getCommonPayees(): Promise<any>;
88
90
  export declare function syncGetOrphanedPayees(): Promise<any>;
89
91
  export declare function getOrphanedPayees(): Promise<any>;
90
92
  export declare function getPayeeByName(name: any): Promise<any>;
@@ -0,0 +1,9 @@
1
+ export type Schedule = {
2
+ id: string;
3
+ rule: string;
4
+ active: number;
5
+ completed: number;
6
+ posts_transaction: number;
7
+ tombstone: number;
8
+ name: string | null;
9
+ };
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  export declare function sha256String(str: any): Promise<string>;
3
2
  export declare function randomBytes(n: any): Buffer;
4
3
  export declare function encrypt(masterKey: any, value: any): {
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  export declare function sha256String(str: any): Promise<string>;
3
2
  export declare function randomBytes(n: any): Buffer;
4
3
  export declare function encrypt(masterKey: any, value: any): Promise<{
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  declare class Key {
3
2
  id: any;
4
3
  value: any;