@actual-app/api 6.9.0 → 24.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 (82) hide show
  1. package/@types/jest.config.d.ts +7 -7
  2. package/@types/loot-core/client/constants.d.ts +1 -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 +35 -17
  5. package/@types/loot-core/client/state-types/notifications.d.ts +18 -1
  6. package/@types/loot-core/client/state-types/prefs.d.ts +4 -4
  7. package/@types/loot-core/client/state-types/queries.d.ts +4 -4
  8. package/@types/loot-core/mocks/index.d.ts +2 -7
  9. package/@types/loot-core/server/accounts/parse-file.d.ts +1 -0
  10. package/@types/loot-core/server/accounts/rules.d.ts +5 -6
  11. package/@types/loot-core/server/accounts/sync.d.ts +2 -2
  12. package/@types/loot-core/server/accounts/transaction-rules.d.ts +1 -3
  13. package/@types/loot-core/server/accounts/transactions.d.ts +3 -5
  14. package/@types/loot-core/server/api-models.d.ts +6 -6
  15. package/@types/loot-core/server/aql/schema/index.d.ts +34 -3
  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 +5 -4
  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/preferences/app.d.ts +12 -0
  35. package/@types/loot-core/server/preferences/types/handlers.d.ts +8 -0
  36. package/@types/loot-core/server/prefs.d.ts +8 -5
  37. package/@types/loot-core/server/reports/app.d.ts +46 -0
  38. package/@types/loot-core/server/rules/types/handlers.d.ts +4 -6
  39. package/@types/loot-core/server/sync/make-test-message.d.ts +0 -1
  40. package/@types/loot-core/server/util/rschedule.d.ts +0 -1
  41. package/@types/loot-core/shared/dashboard.d.ts +2 -0
  42. package/@types/loot-core/shared/errors.d.ts +1 -1
  43. package/@types/loot-core/shared/months.d.ts +9 -6
  44. package/@types/loot-core/shared/rules.d.ts +6 -29
  45. package/@types/loot-core/shared/schedules.d.ts +22 -22
  46. package/@types/loot-core/shared/transactions.d.ts +26 -73
  47. package/@types/loot-core/shared/util.d.ts +13 -14
  48. package/@types/loot-core/types/api-handlers.d.ts +14 -3
  49. package/@types/loot-core/types/handlers.d.ts +4 -0
  50. package/@types/loot-core/types/models/category-group.d.ts +6 -2
  51. package/@types/loot-core/types/models/category.d.ts +4 -2
  52. package/@types/loot-core/types/models/dashboard.d.ts +89 -0
  53. package/@types/loot-core/types/models/index.d.ts +1 -0
  54. package/@types/loot-core/types/models/payee.d.ts +5 -7
  55. package/@types/loot-core/types/models/reports.d.ts +5 -18
  56. package/@types/loot-core/types/models/rule.d.ts +103 -7
  57. package/@types/loot-core/types/models/schedule.d.ts +18 -14
  58. package/@types/loot-core/types/models/transaction-filter.d.ts +4 -2
  59. package/@types/loot-core/types/models/transaction.d.ts +14 -25
  60. package/@types/loot-core/types/prefs.d.ts +65 -55
  61. package/@types/loot-core/types/server-events.d.ts +1 -0
  62. package/@types/loot-core/types/server-handlers.d.ts +9 -13
  63. package/@types/loot-core/types/util.d.ts +6 -0
  64. package/@types/methods.d.ts +4 -11
  65. package/@types/migrations/1722717601000_reports_move_selected_categories.d.ts +1 -0
  66. package/@types/migrations/1722804019000_create_dashboard_table.d.ts +1 -0
  67. package/@types/migrations/1723665565000_prefs.d.ts +4 -0
  68. package/dist/app/bundle.api.js +5534 -1851
  69. package/dist/app/query.js +1 -2
  70. package/dist/index.js +3 -3
  71. package/dist/injected.js +2 -2
  72. package/dist/methods.js +53 -45
  73. package/dist/methods.test.js +8 -14
  74. package/dist/migrations/1632571489012_remove_cache.js +1 -1
  75. package/dist/migrations/1722717601000_reports_move_selected_categories.js +39 -0
  76. package/dist/migrations/1722804019000_create_dashboard_table.js +38 -0
  77. package/dist/migrations/1723665565000_prefs.js +51 -0
  78. package/dist/package.json +2 -2
  79. package/dist/utils.js +2 -3
  80. package/dist/validateNodeVersion.js +1 -2
  81. package/package.json +2 -2
  82. /package/@types/loot-core/server/budget/{rollover.d.ts → envelope.d.ts} +0 -0
@@ -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
  };
@@ -22,6 +22,7 @@ export declare const COLLAPSE_MODALS = "COLLAPSE_MODALS";
22
22
  export declare const POP_MODAL = "POP_MODAL";
23
23
  export declare const ADD_NOTIFICATION = "ADD_NOTIFICATION";
24
24
  export declare const REMOVE_NOTIFICATION = "REMOVE_NOTIFICATION";
25
+ export declare const SET_NOTIFICATION_INSET = "SET_NOTIFICATION_INSET";
25
26
  export declare const GET_USER_DATA = "GET_USER_DATA";
26
27
  export declare const SET_LAST_UNDO_STATE = "SET_LAST_UNDO_STATE";
27
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';
@@ -38,7 +39,7 @@ type FinanceModals = {
38
39
  };
39
40
  'select-linked-accounts': {
40
41
  accounts: unknown[];
41
- requisitionId: string;
42
+ requisitionId?: string;
42
43
  upgradingAccountId?: string;
43
44
  syncSource?: AccountSyncSource;
44
45
  };
@@ -53,7 +54,7 @@ type FinanceModals = {
53
54
  'manage-rules': { payeeId?: string };
54
55
  'edit-rule': {
55
56
  rule: RuleEntity | NewRuleEntity;
56
- onSave: (rule: RuleEntity) => void;
57
+ onSave?: (rule: RuleEntity) => void;
57
58
  };
58
59
  'merge-unused-payees': {
59
60
  payeeIds: string[];
@@ -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,7 +128,14 @@ 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
 
@@ -146,7 +157,7 @@ type FinanceModals = {
146
157
  onBudgetAction: (month: string, action: string, args?: unknown) => void;
147
158
  onClose?: () => void;
148
159
  };
149
- 'rollover-budget-menu': {
160
+ 'envelope-budget-menu': {
150
161
  categoryId: string;
151
162
  month: string;
152
163
  onUpdateBudget: (amount: number) => void;
@@ -154,7 +165,7 @@ type FinanceModals = {
154
165
  onSetMonthsAverage: (numberOfMonths: number) => void;
155
166
  onApplyBudgetTemplate: () => void;
156
167
  };
157
- 'report-budget-menu': {
168
+ 'tracking-budget-menu': {
158
169
  categoryId: string;
159
170
  month: string;
160
171
  onUpdateBudget: (amount: number) => void;
@@ -176,8 +187,8 @@ type FinanceModals = {
176
187
  name: string;
177
188
  onSave: (id: string, notes: string) => void;
178
189
  };
179
- 'report-budget-summary': { month: string };
180
- 'rollover-budget-summary': {
190
+ 'tracking-budget-summary': { month: string };
191
+ 'envelope-budget-summary': {
181
192
  month: string;
182
193
  onBudgetAction: (
183
194
  month: string,
@@ -193,27 +204,28 @@ type FinanceModals = {
193
204
  onValidate?: (value: string) => string;
194
205
  onSubmit: (value: string) => Promise<void>;
195
206
  };
196
- 'rollover-balance-menu': {
207
+ 'envelope-balance-menu': {
197
208
  categoryId: string;
198
209
  month: string;
199
210
  onCarryover: (carryover: boolean) => void;
200
211
  onTransfer: () => void;
201
212
  onCover: () => void;
202
213
  };
203
- 'rollover-summary-to-budget-menu': {
214
+ 'envelope-summary-to-budget-menu': {
204
215
  month: string;
205
216
  onTransfer: () => void;
206
217
  onCover: () => void;
207
218
  onHoldBuffer: () => void;
208
219
  onResetHoldBuffer: () => void;
209
220
  };
210
- 'report-balance-menu': {
221
+ 'tracking-balance-menu': {
211
222
  categoryId: string;
212
223
  month: string;
213
224
  onCarryover: (carryover: boolean) => void;
214
225
  };
215
226
  transfer: {
216
227
  title: string;
228
+ categoryId?: CategoryEntity['id'];
217
229
  month: string;
218
230
  amount: number;
219
231
  onSubmit: (amount: number, toCategoryId: string) => void;
@@ -221,6 +233,7 @@ type FinanceModals = {
221
233
  };
222
234
  cover: {
223
235
  title: string;
236
+ categoryId?: CategoryEntity['id'];
224
237
  month: string;
225
238
  showToBeBudgeted?: boolean;
226
239
  onSubmit: (fromCategoryId: string) => void;
@@ -239,12 +252,12 @@ type FinanceModals = {
239
252
  onToggleHiddenCategories: () => void;
240
253
  onSwitchBudgetFile: () => void;
241
254
  };
242
- 'rollover-budget-month-menu': {
255
+ 'envelope-budget-month-menu': {
243
256
  month: string;
244
257
  onBudgetAction: (month: string, action: string, arg?: unknown) => void;
245
258
  onEditNotes: (month: string) => void;
246
259
  };
247
- 'report-budget-month-menu': {
260
+ 'tracking-budget-month-menu': {
248
261
  month: string;
249
262
  onBudgetAction: (month: string, action: string, arg?: unknown) => void;
250
263
  onEditNotes: (month: string) => void;
@@ -256,8 +269,13 @@ type FinanceModals = {
256
269
  confirmReason: string;
257
270
  };
258
271
  'confirm-transaction-delete': {
272
+ message?: string;
259
273
  onConfirm: () => void;
260
274
  };
275
+ 'confirm-unlink-account': {
276
+ accountName: string;
277
+ onUnlink: () => void;
278
+ };
261
279
  };
262
280
 
263
281
  export type PushModalAction = {
@@ -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,20 @@
1
- import type { LocalPrefs, GlobalPrefs } from '../../types/prefs';
1
+ import type { GlobalPrefs, MetadataPrefs } from '../../types/prefs';
2
2
  import type * as constants from '../constants';
3
3
 
4
4
  export type PrefsState = {
5
- local: LocalPrefs;
5
+ local: MetadataPrefs;
6
6
  global: GlobalPrefs;
7
7
  };
8
8
 
9
9
  export type SetPrefsAction = {
10
10
  type: typeof constants.SET_PREFS;
11
- prefs: LocalPrefs;
11
+ prefs: MetadataPrefs;
12
12
  globalPrefs: GlobalPrefs;
13
13
  };
14
14
 
15
15
  export type MergeLocalPrefsAction = {
16
16
  type: typeof constants.MERGE_LOCAL_PREFS;
17
- prefs: LocalPrefs;
17
+ prefs: MetadataPrefs;
18
18
  };
19
19
 
20
20
  export type MergeGlobalPrefsAction = {
@@ -3,8 +3,8 @@ import { type AccountEntity } from '../../types/models';
3
3
  import type * as constants from '../constants';
4
4
 
5
5
  export type QueriesState = {
6
- newTransactions: unknown[];
7
- matchedTransactions: unknown[];
6
+ newTransactions: string[];
7
+ matchedTransactions: string[];
8
8
  lastTransaction: unknown | null;
9
9
  updatedAccounts: string[];
10
10
  accounts: AccountEntity[];
@@ -20,8 +20,8 @@ export type QueriesState = {
20
20
 
21
21
  type SetNewTransactionsAction = {
22
22
  type: typeof constants.SET_NEW_TRANSACTIONS;
23
- newTransactions?: unknown[];
24
- matchedTransactions?: unknown[];
23
+ newTransactions?: string[];
24
+ matchedTransactions?: string[];
25
25
  updatedAccounts?: string[];
26
26
  };
27
27
 
@@ -1,12 +1,7 @@
1
- export declare function generateAccount(name: any, isConnected: any, offbudget: any): {
2
- id: string;
3
- name: any;
4
- balance_current: number;
5
- bank: number;
1
+ import type { AccountEntity } from '../types/models';
2
+ export declare function generateAccount(name: any, isConnected: any, offbudget: any): AccountEntity & {
6
3
  bankId: number;
7
4
  bankName: string;
8
- offbudget: number;
9
- closed: number;
10
5
  };
11
6
  export declare function generateCategory(name: any, group: any, isIncome?: boolean): {
12
7
  id: string;
@@ -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 {};
@@ -10,7 +10,7 @@ export declare class Condition {
10
10
  type: any;
11
11
  unparsedValue: any;
12
12
  value: any;
13
- constructor(op: any, field: any, value: any, options: any, fieldTypes: any);
13
+ constructor(op: any, field: any, value: any, options: any);
14
14
  eval(object: any): any;
15
15
  getValue(): any;
16
16
  serialize(): {
@@ -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;
@@ -30,11 +30,11 @@ export declare class Action {
30
30
  rawValue: any;
31
31
  type: any;
32
32
  value: any;
33
- constructor(op: ActionOperator, field: any, value: any, options: any, fieldTypes: any);
33
+ constructor(op: ActionOperator, field: any, value: any, options: any);
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;
@@ -47,13 +47,12 @@ export declare class Rule {
47
47
  conditionsOp: any;
48
48
  id: any;
49
49
  stage: any;
50
- constructor({ id, stage, conditionsOp, conditions, actions, fieldTypes, }: {
50
+ constructor({ id, stage, conditionsOp, conditions, actions, }: {
51
51
  id?: string;
52
52
  stage?: any;
53
53
  conditionsOp: any;
54
54
  conditions: any;
55
55
  actions: any;
56
- fieldTypes: any;
57
56
  });
58
57
  evalConditions(object: any): any;
59
58
  execActions<T>(object: T): Partial<T>;
@@ -1,10 +1,10 @@
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, isPreview?: 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
5
  updatedPreview: any[];
6
6
  }>;
7
- export declare function matchTransactions(acctId: any, transactions: any, isBankSyncAccount?: boolean): Promise<{
7
+ export declare function matchTransactions(acctId: any, transactions: any, isBankSyncAccount?: boolean, strictIdChecking?: boolean): Promise<{
8
8
  payeesToCreate: Map<any, any>;
9
9
  transactionsStep1: any[];
10
10
  transactionsStep2: any[];
@@ -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;
@@ -18,10 +18,10 @@ export type APICategoryEntity = Pick<CategoryEntity, 'id' | 'name' | 'is_income'
18
18
  export declare const categoryModel: {
19
19
  toExternal(category: CategoryEntity): APICategoryEntity;
20
20
  fromExternal(category: APICategoryEntity): {
21
- id?: string;
21
+ id: string;
22
22
  name: string;
23
23
  is_income?: boolean;
24
- cat_group?: string;
24
+ cat_group?: CategoryGroupEntity["id"];
25
25
  sort_order?: number;
26
26
  tombstone?: boolean;
27
27
  hidden?: boolean;
@@ -30,10 +30,10 @@ export declare const categoryModel: {
30
30
  update?: boolean;
31
31
  }): {
32
32
  hidden: number;
33
- id?: string;
33
+ id: string;
34
34
  name: string;
35
35
  is_income?: boolean;
36
- cat_group?: string;
36
+ cat_group?: CategoryGroupEntity["id"];
37
37
  tombstone?: boolean;
38
38
  };
39
39
  };
@@ -47,11 +47,11 @@ export declare const categoryGroupModel: {
47
47
  update?: boolean;
48
48
  }): {
49
49
  hidden: number;
50
- id?: string;
50
+ id: string;
51
+ categories?: CategoryEntity[];
51
52
  name: string;
52
53
  is_income?: boolean;
53
54
  tombstone?: boolean;
54
- categories?: CategoryEntity[];
55
55
  };
56
56
  };
57
57
  export type APIPayeeEntity = Pick<PayeeEntity, 'id' | 'name' | 'transfer_acct'>;
@@ -223,6 +223,14 @@ export declare const schema: {
223
223
  type: string;
224
224
  };
225
225
  };
226
+ preferences: {
227
+ id: {
228
+ type: string;
229
+ };
230
+ value: {
231
+ type: string;
232
+ };
233
+ };
226
234
  transaction_filters: {
227
235
  id: {
228
236
  type: string;
@@ -283,9 +291,6 @@ export declare const schema: {
283
291
  include_current: {
284
292
  type: string;
285
293
  };
286
- selected_categories: {
287
- type: string;
288
- };
289
294
  graph_type: {
290
295
  type: string;
291
296
  };
@@ -354,5 +359,31 @@ export declare const schema: {
354
359
  type: string;
355
360
  };
356
361
  };
362
+ dashboard: {
363
+ id: {
364
+ type: string;
365
+ };
366
+ type: {
367
+ type: string;
368
+ };
369
+ width: {
370
+ type: string;
371
+ };
372
+ height: {
373
+ type: string;
374
+ };
375
+ x: {
376
+ type: string;
377
+ };
378
+ y: {
379
+ type: string;
380
+ };
381
+ meta: {
382
+ type: string;
383
+ };
384
+ tombstone: {
385
+ type: string;
386
+ };
387
+ };
357
388
  };
358
389
  export declare const schemaConfig: SchemaConfig;
@@ -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,12 +62,13 @@ 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>;
68
69
  export declare function updateWithSchema(table: any, fields: any): Promise<void>;
69
- export declare function getCategories(): Promise<CategoryEntity[]>;
70
- export declare function getCategoriesGrouped(): Promise<Array<CategoryGroupEntity>>;
70
+ export declare function getCategories(ids?: Array<CategoryEntity['id']>): Promise<CategoryEntity[]>;
71
+ export declare function getCategoriesGrouped(ids?: Array<CategoryGroupEntity['id']>): Promise<Array<CategoryGroupEntity>>;
71
72
  export declare function insertCategoryGroup(group: any): Promise<any>;
72
73
  export declare function updateCategoryGroup(group: any): Promise<void>;
73
74
  export declare function moveCategoryGroup(id: any, targetId: any): Promise<void>;