@actual-app/api 6.7.1 → 6.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/@types/app/bundle.api.d.ts +6 -0
  2. package/@types/app/query.d.ts +19 -0
  3. package/@types/index.d.ts +7 -0
  4. package/@types/injected.d.ts +2 -0
  5. package/@types/jest.config.d.ts +9 -0
  6. package/@types/loot-core/client/actions/types.d.ts +6 -0
  7. package/@types/loot-core/client/constants.d.ts +29 -0
  8. package/@types/loot-core/client/platform.d.ts +4 -0
  9. package/@types/loot-core/client/state-types/account.d.ts +27 -0
  10. package/@types/loot-core/client/state-types/app.d.ts +37 -0
  11. package/@types/loot-core/client/state-types/budgets.d.ts +36 -0
  12. package/@types/loot-core/client/state-types/index.d.ts +41 -0
  13. package/@types/loot-core/client/state-types/modals.d.ts +292 -0
  14. package/@types/loot-core/client/state-types/notifications.d.ts +38 -0
  15. package/@types/loot-core/client/state-types/prefs.d.ts +28 -0
  16. package/@types/loot-core/client/state-types/queries.d.ts +69 -0
  17. package/@types/loot-core/client/state-types/user.d.ts +13 -0
  18. package/@types/loot-core/mocks/budget.d.ts +2 -0
  19. package/@types/loot-core/mocks/index.d.ts +26 -0
  20. package/@types/loot-core/mocks/random.d.ts +1 -0
  21. package/@types/loot-core/mocks/util.d.ts +7 -0
  22. package/@types/loot-core/platform/client/fetch/index.d.ts +48 -0
  23. package/@types/loot-core/platform/client/undo/index.d.ts +29 -0
  24. package/@types/loot-core/platform/exceptions/index.d.ts +5 -0
  25. package/@types/loot-core/platform/server/asyncStorage/index.d.ts +20 -0
  26. package/@types/loot-core/platform/server/connection/index.d.ts +23 -0
  27. package/@types/loot-core/platform/server/fetch/index.d.ts +4 -0
  28. package/@types/loot-core/platform/server/fs/index.d.ts +71 -0
  29. package/@types/loot-core/platform/server/fs/path-join.d.ts +2 -0
  30. package/@types/loot-core/platform/server/indexeddb/index.d.ts +24 -0
  31. package/@types/loot-core/platform/server/log/index.d.ts +9 -0
  32. package/@types/loot-core/platform/server/sqlite/index.d.ts +35 -0
  33. package/@types/loot-core/server/accounts/export-to-csv.d.ts +2 -0
  34. package/@types/loot-core/server/accounts/link.d.ts +1 -0
  35. package/@types/loot-core/server/accounts/ofx2json.d.ts +14 -0
  36. package/@types/loot-core/server/accounts/parse-file.d.ts +15 -0
  37. package/@types/loot-core/server/accounts/payees.d.ts +5 -0
  38. package/@types/loot-core/server/accounts/qif2json.d.ts +26 -0
  39. package/@types/loot-core/server/accounts/rules.d.ts +90 -0
  40. package/@types/loot-core/server/accounts/sync.d.ts +13 -0
  41. package/@types/loot-core/server/accounts/title/index.d.ts +3 -0
  42. package/@types/loot-core/server/accounts/title/lower-case.d.ts +1 -0
  43. package/@types/loot-core/server/accounts/title/specials.d.ts +1 -0
  44. package/@types/loot-core/server/accounts/transaction-rules.d.ts +47 -0
  45. package/@types/loot-core/server/accounts/transactions.d.ts +33 -0
  46. package/@types/loot-core/server/accounts/transfer.d.ts +37 -0
  47. package/@types/loot-core/server/accounts/xmlcamt2json.d.ts +10 -0
  48. package/@types/loot-core/server/api-models.d.ts +66 -0
  49. package/@types/loot-core/server/api.d.ts +3 -0
  50. package/@types/loot-core/server/app.d.ts +14 -0
  51. package/@types/loot-core/server/aql/compiler.d.ts +56 -0
  52. package/@types/loot-core/server/aql/exec.d.ts +9 -0
  53. package/@types/loot-core/server/aql/index.d.ts +5 -0
  54. package/@types/loot-core/server/aql/schema/executors.d.ts +6 -0
  55. package/@types/loot-core/server/aql/schema/index.d.ts +340 -0
  56. package/@types/loot-core/server/aql/schema/run-query.d.ts +6 -0
  57. package/@types/loot-core/server/aql/schema-helpers.d.ts +8 -0
  58. package/@types/loot-core/server/aql/views.d.ts +1 -0
  59. package/@types/loot-core/server/backups.d.ts +16 -0
  60. package/@types/loot-core/server/backups.test.d.ts +1 -0
  61. package/@types/loot-core/server/budget/actions.d.ts +63 -0
  62. package/@types/loot-core/server/budget/app.d.ts +12 -0
  63. package/@types/loot-core/server/budget/base.d.ts +17 -0
  64. package/@types/loot-core/server/budget/cleanup-template.d.ts +4 -0
  65. package/@types/loot-core/server/budget/goals/goalsAverage.d.ts +4 -0
  66. package/@types/loot-core/server/budget/goals/goalsBy.d.ts +5 -0
  67. package/@types/loot-core/server/budget/goals/goalsPercentage.d.ts +4 -0
  68. package/@types/loot-core/server/budget/goals/goalsRemainder.d.ts +8 -0
  69. package/@types/loot-core/server/budget/goals/goalsSchedule.d.ts +6 -0
  70. package/@types/loot-core/server/budget/goals/goalsSimple.d.ts +7 -0
  71. package/@types/loot-core/server/budget/goals/goalsSpend.d.ts +4 -0
  72. package/@types/loot-core/server/budget/goals/goalsWeek.d.ts +7 -0
  73. package/@types/loot-core/server/budget/goaltemplates.d.ts +12 -0
  74. package/@types/loot-core/server/budget/report.d.ts +2 -0
  75. package/@types/loot-core/server/budget/rollover.d.ts +4 -0
  76. package/@types/loot-core/server/budget/types/handlers.d.ts +77 -0
  77. package/@types/loot-core/server/budget/util.d.ts +4 -0
  78. package/@types/loot-core/server/cloud-storage.d.ts +33 -0
  79. package/@types/loot-core/server/db/index.d.ts +60 -0
  80. package/@types/loot-core/server/db/mappings.d.ts +3 -0
  81. package/@types/loot-core/server/db/sort.d.ts +11 -0
  82. package/@types/loot-core/server/db/util.d.ts +2 -0
  83. package/@types/loot-core/server/encryption-internals.d.ts +24 -0
  84. package/@types/loot-core/server/encryption-internals.web.d.ts +24 -0
  85. package/@types/loot-core/server/encryption.d.ts +41 -0
  86. package/@types/loot-core/server/encryption.test.d.ts +1 -0
  87. package/@types/loot-core/server/errors.d.ts +73 -0
  88. package/@types/loot-core/server/filters/app.d.ts +12 -0
  89. package/@types/loot-core/server/filters/types/handlers.d.ts +7 -0
  90. package/@types/loot-core/server/importers/actual.d.ts +4 -0
  91. package/@types/loot-core/server/importers/index.d.ts +6 -0
  92. package/@types/loot-core/server/importers/ynab4-types.d.ts +167 -0
  93. package/@types/loot-core/server/importers/ynab4.d.ts +5 -0
  94. package/@types/loot-core/server/importers/ynab5-types.d.ts +79 -0
  95. package/@types/loot-core/server/importers/ynab5.d.ts +5 -0
  96. package/@types/loot-core/server/main-app.d.ts +12 -0
  97. package/@types/loot-core/server/main.d.ts +28 -0
  98. package/@types/loot-core/server/main.test.d.ts +1 -0
  99. package/@types/loot-core/server/migrate/migrations.d.ts +9 -0
  100. package/@types/loot-core/server/models.d.ts +38 -0
  101. package/@types/loot-core/server/mutators.d.ts +17 -0
  102. package/@types/loot-core/server/notes/app.d.ts +12 -0
  103. package/@types/loot-core/server/notes/types/handlers.d.ts +3 -0
  104. package/@types/loot-core/server/platform.d.ts +3 -0
  105. package/@types/loot-core/server/platform.web.d.ts +3 -0
  106. package/@types/loot-core/server/polyfills.d.ts +0 -0
  107. package/@types/loot-core/server/post.d.ts +3 -0
  108. package/@types/loot-core/server/prefs.d.ts +10 -0
  109. package/@types/loot-core/server/reports/app.d.ts +12 -0
  110. package/@types/loot-core/server/reports/types/handlers.d.ts +6 -0
  111. package/@types/loot-core/server/rules/app.d.ts +12 -0
  112. package/@types/loot-core/server/rules/types/handlers.d.ts +42 -0
  113. package/@types/loot-core/server/schedules/app.d.ts +35 -0
  114. package/@types/loot-core/server/schedules/find-schedules.d.ts +1 -0
  115. package/@types/loot-core/server/schedules/types/handlers.d.ts +31 -0
  116. package/@types/loot-core/server/server-config.d.ts +10 -0
  117. package/@types/loot-core/server/sheet.d.ts +11 -0
  118. package/@types/loot-core/server/sheet.test.d.ts +1 -0
  119. package/@types/loot-core/server/spreadsheet/globals.d.ts +1 -0
  120. package/@types/loot-core/server/spreadsheet/graph-data-structure.d.ts +15 -0
  121. package/@types/loot-core/server/spreadsheet/spreadsheet.d.ts +79 -0
  122. package/@types/loot-core/server/spreadsheet/util.d.ts +5 -0
  123. package/@types/loot-core/server/sync/encoder.d.ts +9 -0
  124. package/@types/loot-core/server/sync/index.d.ts +47 -0
  125. package/@types/loot-core/server/sync/make-test-message.d.ts +10 -0
  126. package/@types/loot-core/server/sync/migrate.d.ts +2 -0
  127. package/@types/loot-core/server/sync/repair.d.ts +6 -0
  128. package/@types/loot-core/server/sync/reset.d.ts +6 -0
  129. package/@types/loot-core/server/sync/utils.d.ts +3 -0
  130. package/@types/loot-core/server/tools/app.d.ts +12 -0
  131. package/@types/loot-core/server/tools/types/handlers.d.ts +7 -0
  132. package/@types/loot-core/server/undo.d.ts +14 -0
  133. package/@types/loot-core/server/update.d.ts +1 -0
  134. package/@types/loot-core/server/util/budget-name.d.ts +2 -0
  135. package/@types/loot-core/server/util/rschedule.d.ts +5 -0
  136. package/@types/loot-core/shared/async.d.ts +3 -0
  137. package/@types/loot-core/shared/environment.d.ts +4 -0
  138. package/@types/loot-core/shared/errors.d.ts +22 -0
  139. package/@types/loot-core/shared/months.d.ts +62 -0
  140. package/@types/loot-core/shared/query.d.ts +31 -0
  141. package/@types/loot-core/shared/rules.d.ts +62 -0
  142. package/@types/loot-core/shared/schedules.d.ts +43 -0
  143. package/@types/loot-core/shared/transactions.d.ts +91 -0
  144. package/@types/loot-core/shared/util.d.ts +67 -0
  145. package/@types/loot-core/types/api-handlers.d.ts +158 -0
  146. package/@types/loot-core/types/budget.d.ts +7 -0
  147. package/@types/loot-core/types/file.d.ts +38 -0
  148. package/@types/loot-core/types/handlers.d.ts +23 -0
  149. package/@types/loot-core/types/models/account.d.ts +21 -0
  150. package/@types/loot-core/types/models/category-group.d.ts +11 -0
  151. package/@types/loot-core/types/models/category.d.ts +9 -0
  152. package/@types/loot-core/types/models/gocardless.d.ts +14 -0
  153. package/@types/loot-core/types/models/index.d.ts +12 -0
  154. package/@types/loot-core/types/models/note.d.ts +4 -0
  155. package/@types/loot-core/types/models/payee.d.ts +10 -0
  156. package/@types/loot-core/types/models/reports.d.ts +123 -0
  157. package/@types/loot-core/types/models/rule.d.ts +71 -0
  158. package/@types/loot-core/types/models/schedule.d.ts +58 -0
  159. package/@types/loot-core/types/models/simplefin.d.ts +10 -0
  160. package/@types/loot-core/types/models/transaction-filter.d.ts +7 -0
  161. package/@types/loot-core/types/models/transaction.d.ts +40 -0
  162. package/@types/loot-core/types/prefs.d.ts +69 -0
  163. package/@types/loot-core/types/server-events.d.ts +21 -0
  164. package/@types/loot-core/types/server-handlers.d.ts +344 -0
  165. package/@types/loot-core/types/util.d.ts +5 -0
  166. package/@types/methods.d.ts +85 -0
  167. package/@types/methods.test.d.ts +1 -0
  168. package/@types/migrations/1632571489012_remove_cache.d.ts +1 -0
  169. package/@types/utils.d.ts +2 -0
  170. package/@types/validateNodeVersion.d.ts +1 -0
  171. package/dist/app/bundle.api.js +430 -5643
  172. package/dist/methods.js +25 -1
  173. package/dist/methods.test.js +205 -5
  174. package/dist/package.json +7 -5
  175. package/package.json +7 -5
@@ -0,0 +1,26 @@
1
+ export declare function generateAccount(name: any, isConnected: any, offbudget: any): {
2
+ id: string;
3
+ name: any;
4
+ balance_current: number;
5
+ bank: number;
6
+ bankId: number;
7
+ bankName: string;
8
+ offbudget: number;
9
+ closed: number;
10
+ };
11
+ export declare function generateCategory(name: any, group: any, isIncome?: boolean): {
12
+ id: string;
13
+ name: any;
14
+ cat_group: any;
15
+ is_income: number;
16
+ sort_order: number;
17
+ };
18
+ export declare function generateCategoryGroup(name: any, isIncome?: boolean): {
19
+ id: string;
20
+ name: any;
21
+ is_income: number;
22
+ sort_order: number;
23
+ };
24
+ export declare function generateCategoryGroups(definition: any): any;
25
+ export declare function generateTransaction(data: any, splitAmount?: any, showError?: boolean): any[];
26
+ export declare function generateTransactions(count: any, accountId: any, groupId: any, splitAtIndexes?: any[], showError?: boolean): any[];
@@ -0,0 +1 @@
1
+ export declare const random: () => number;
@@ -0,0 +1,7 @@
1
+ export declare function expectSnapshotWithDiffer(initialValue: any, { onlyUpdates }?: {
2
+ onlyUpdates?: any;
3
+ }): {
4
+ expectToMatchDiff: (value: any) => void;
5
+ };
6
+ export declare function getFixtures(filename: any): void;
7
+ export declare function debugDOM(node: any): string;
@@ -0,0 +1,48 @@
1
+ import type { Handlers } from '../../../types/handlers';
2
+ import type { ServerEvents } from '../../../types/server-events';
3
+
4
+ export function init(socketName: string): Promise<unknown>;
5
+ export type Init = typeof init;
6
+
7
+ export function send<K extends keyof Handlers>(
8
+ name: K,
9
+ args?: Parameters<Handlers[K]>[0],
10
+ options?: { catchErrors: true },
11
+ ): ReturnType<
12
+ | { data: Handlers[K] }
13
+ | { error: { type: 'APIError' | 'InternalError'; message: string } }
14
+ >;
15
+ export function send<K extends keyof Handlers>(
16
+ name: K,
17
+ args?: Parameters<Handlers[K]>[0],
18
+ options?: { catchErrors?: boolean },
19
+ ): ReturnType<Handlers[K]>;
20
+ export type Send = typeof send;
21
+
22
+ export function sendCatch<K extends keyof Handlers>(
23
+ name: K,
24
+ args?: Parameters<Handlers[K]>[0],
25
+ ): ReturnType<
26
+ | { data: Handlers[K] }
27
+ | { error: { type: 'APIError' | 'InternalError'; message: string } }
28
+ >;
29
+ export type SendCatch = typeof sendCatch;
30
+
31
+ export function listen<K extends keyof ServerEvents>(
32
+ name: K,
33
+ cb: (arg: ServerEvents[K]) => void,
34
+ ): () => void;
35
+ export type Listen = typeof listen;
36
+
37
+ export function unlisten(name: string): void;
38
+ export type Unlisten = typeof unlisten;
39
+
40
+ /** Mock functions */
41
+ export function initServer(handlers: unknown): void;
42
+ export type InitServer = typeof initServer;
43
+
44
+ export function serverPush(name: string, args: unknown): void;
45
+ export type ServerPush = typeof serverPush;
46
+
47
+ export async function clearServer(): void;
48
+ export type ClearServer = typeof clearServer;
@@ -0,0 +1,29 @@
1
+ import { type ModalType } from '../../client/state-types/modals';
2
+
3
+ export type UndoState = {
4
+ id?: string;
5
+ url: unknown;
6
+ openModal: ModalType;
7
+ selectedItems: {
8
+ name: string;
9
+ items: Set<string>;
10
+ } | null;
11
+ };
12
+
13
+ export function setUndoState<K extends keyof Omit<UndoState, 'id'>>(
14
+ name: K,
15
+ value: UndoState[K],
16
+ ): void;
17
+ export type SetUndoState = typeof setUndoState;
18
+
19
+ export function getUndoState<K extends keyof UndoState>(name: K): UndoState[K];
20
+ export type GetUndoState = typeof getUndoState;
21
+
22
+ export function getTaggedState(id: string): UndoState | undefined;
23
+ export type GetTaggedState = typeof getTaggedState;
24
+
25
+ export function snapshot(): string;
26
+ export type Snapshot = typeof snapshot;
27
+
28
+ export function gc(id: string): void;
29
+ export type Gc = typeof gc;
@@ -0,0 +1,5 @@
1
+ export function captureException(exc: Error): void;
2
+ export type CaptureException = typeof captureException;
3
+
4
+ export function captureBreadcrumb(breadcrumb: unknown): void;
5
+ export type CaptureBreadcrumb = typeof captureBreadcrumb;
@@ -0,0 +1,20 @@
1
+ export function init(opts?: { persist?: boolean }): void;
2
+ export type Init = typeof init;
3
+
4
+ export function getItem(key: string): Promise<string>;
5
+ export type GetItem = typeof getItem;
6
+
7
+ export function setItem(key: string, value: unknown): void;
8
+ export type SetItem = typeof setItem;
9
+
10
+ export function removeItem(key: string): void;
11
+ export type RemoveItem = typeof removeItem;
12
+
13
+ export function multiGet(keys: string[]): Promise<[string, string][]>;
14
+ export type MultiGet = typeof multiGet;
15
+
16
+ export function multiSet(keyValues: [string, unknown][]): void;
17
+ export type MultiSet = typeof multiSet;
18
+
19
+ export function multiRemove(keys: string[]): void;
20
+ export type MultiRemove = typeof multiRemove;
@@ -0,0 +1,23 @@
1
+ import type { Handlers } from '../../../types/handlers';
2
+ import type { ServerEvents } from '../../../types/server-events';
3
+
4
+ export function init(
5
+ channel: Window | number, // in electron the port number, in web the worker
6
+ handlers: Handlers,
7
+ ): void;
8
+ export type Init = typeof init;
9
+
10
+ export function send<K extends keyof ServerEvents>(
11
+ type: K,
12
+ args?: ServerEvents[k],
13
+ ): void;
14
+ export type Send = typeof send;
15
+
16
+ export function getEvents(): unknown[];
17
+ export type GetEvents = typeof getEvents;
18
+
19
+ export function getNumClients(): number;
20
+ export type GetNumClients = typeof getNumClients;
21
+
22
+ export function resetEvents(): void;
23
+ export type ResetEvents = typeof resetEvents;
@@ -0,0 +1,4 @@
1
+ export function fetch(
2
+ input: RequestInfo | URL,
3
+ options?: unknown,
4
+ ): Promise<Response>;
@@ -0,0 +1,71 @@
1
+ export { join } from './path-join';
2
+
3
+ export function init(): void;
4
+ export type Init = typeof init;
5
+
6
+ export function getDataDir(): string;
7
+ export type GetDataDir = typeof getDataDir;
8
+
9
+ export function _setDocumentDir(dir: string): string;
10
+ export type _setDocumentDir = typeof _setDocumentDir;
11
+
12
+ export function getDocumentDir(): string;
13
+ export type GetDocumentDir = typeof getDocumentDir;
14
+
15
+ export function getBudgetDir(id: string): string;
16
+ export type GetBudgetDir = typeof getBudgetDir;
17
+
18
+ export const bundledDatabasePath: string;
19
+ export type BundledDatabasePath = typeof bundledDatabasePath;
20
+
21
+ export const migrationsPath: string;
22
+ export type MigrationsPath = typeof migrationsPath;
23
+
24
+ export const demoBudgetPath: string;
25
+ export type DemoBudgetPath = typeof demoBudgetPath;
26
+
27
+ export function pathToId(filepath: string): string;
28
+ export type PathToId = typeof pathToId;
29
+
30
+ export function basename(filepath: string): string;
31
+ export type Basename = typeof basename;
32
+
33
+ export function listDir(filepath: string): Promise<string[]>;
34
+ export type ListDir = typeof listDir;
35
+
36
+ export function exists(filepath: string): Promise<boolean>;
37
+ export type Exists = typeof exists;
38
+
39
+ export function mkdir(filepath: string): Promise<undefined>;
40
+ export type Mkdir = typeof mkdir;
41
+
42
+ export function size(filepath: string): Promise<undefined>;
43
+ export type Size = typeof size;
44
+
45
+ export function copyFile(frompath: string, topath: string): Promise<undefined>;
46
+ export type CopyFile = typeof copyFile;
47
+
48
+ export function readFile(
49
+ filepath: string,
50
+ encoding: 'binary' | null,
51
+ ): Promise<Buffer>;
52
+ export function readFile(filepath: string, encoding?: 'utf8'): Promise<string>;
53
+ export type ReadFile = typeof readFile;
54
+
55
+ export function writeFile(
56
+ filepath: string,
57
+ contents: string | ArrayBuffer | NodeJS.ArrayBufferView,
58
+ ): Promise<undefined>;
59
+ export type WriteFile = typeof writeFile;
60
+
61
+ export function removeFile(filepath: string): Promise<undefined>;
62
+ export type RemoveFile = typeof removeFile;
63
+
64
+ export function removeDir(dirpath: string): Promise<undefined>;
65
+ export type RemoveDir = typeof removeDir;
66
+
67
+ export function removeDirRecursively(dirpath: string): Promise<undefined>;
68
+ export type RemoveDirRecursively = typeof removeDirRecursively;
69
+
70
+ export function getModifiedTime(filepath: string): Promise<string>;
71
+ export type GetModifiedTime = typeof getModifiedTime;
@@ -0,0 +1,2 @@
1
+ export function join(...args: string[]): string;
2
+ export type Join = typeof join;
@@ -0,0 +1,24 @@
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;
@@ -0,0 +1,9 @@
1
+ import { type Transports } from 'electron-log';
2
+
3
+ export interface Logger {
4
+ info(...args: unknown[]): void;
5
+ warn(...args: unknown[]): void;
6
+ transports?: Transports;
7
+ }
8
+
9
+ export const logger: Logger;
@@ -0,0 +1,35 @@
1
+ import { type Database } from 'better-sqlite3';
2
+
3
+ export async function init(): unknown;
4
+
5
+ export function _getModule(): SqlJsStatic;
6
+
7
+ export function prepare(db, sql): unknown;
8
+
9
+ export function runQuery(
10
+ db: Database,
11
+ sql: string,
12
+ params?: (string | number)[],
13
+ fetchAll?: false,
14
+ ): { changes: unknown };
15
+ export function runQuery<T>(
16
+ db: Database,
17
+ sql: string,
18
+ params: (string | number)[],
19
+ fetchAll: true,
20
+ ): T[];
21
+
22
+ export function execQuery(db: Database, sql): void;
23
+
24
+ export function transaction(db: Database, fn: () => void): void;
25
+
26
+ export async function asyncTransaction(
27
+ db: Database,
28
+ fn: () => Promise<void>,
29
+ ): Promise<void>;
30
+
31
+ export async function openDatabase(pathOrBuffer?: string | Buffer): Database;
32
+
33
+ export function closeDatabase(db: Database): void;
34
+
35
+ export async function exportDatabase(db: Database): Promise<Uint8Array>;
@@ -0,0 +1,2 @@
1
+ export declare function exportToCSV(transactions: any, accounts: any, categoryGroups: any, payees: any): Promise<string>;
2
+ export declare function exportQueryToCSV(query: any): Promise<string>;
@@ -0,0 +1 @@
1
+ export declare function findOrCreateBank(institution: any, requisitionId: any): Promise<any>;
@@ -0,0 +1,14 @@
1
+ type OFXTransaction = {
2
+ amount: string;
3
+ fitId: string;
4
+ name: string;
5
+ date: string;
6
+ memo: string;
7
+ type: string;
8
+ };
9
+ type OFXParseResult = {
10
+ headers: Record<string, unknown>;
11
+ transactions: OFXTransaction[];
12
+ };
13
+ export declare function ofx2json(ofx: string): Promise<OFXParseResult>;
14
+ export {};
@@ -0,0 +1,15 @@
1
+ type ParseError = {
2
+ message: string;
3
+ internal: string;
4
+ };
5
+ export type ParseFileResult = {
6
+ errors?: ParseError[];
7
+ transactions?: unknown[];
8
+ };
9
+ type ParseFileOptions = {
10
+ hasHeaderRow?: boolean;
11
+ delimiter?: string;
12
+ fallbackMissingPayeeToMemo?: boolean;
13
+ };
14
+ export declare function parseFile(filepath: string, options?: ParseFileOptions): Promise<ParseFileResult>;
15
+ export {};
@@ -0,0 +1,5 @@
1
+ export declare function createPayee(description: any): Promise<any>;
2
+ export declare function getStartingBalancePayee(): Promise<{
3
+ id: any;
4
+ category: any;
5
+ }>;
@@ -0,0 +1,26 @@
1
+ type Division = {
2
+ category?: string;
3
+ subcategory?: string;
4
+ description?: string;
5
+ amount?: number;
6
+ };
7
+ type QIFTransaction = {
8
+ date?: string;
9
+ amount?: string;
10
+ number?: string;
11
+ memo?: string;
12
+ address?: string[];
13
+ clearedStatus?: string;
14
+ category?: string;
15
+ subcategory?: string;
16
+ payee?: string;
17
+ division?: Division[];
18
+ };
19
+ export declare function qif2json(qif: any, options?: {
20
+ dateFormat?: string;
21
+ }): {
22
+ dateFormat: string | undefined;
23
+ type?: any;
24
+ transactions: QIFTransaction[];
25
+ };
26
+ export {};
@@ -0,0 +1,90 @@
1
+ export declare function parseDateString(str: any): {
2
+ type: string;
3
+ date: string;
4
+ };
5
+ export declare class Condition {
6
+ field: any;
7
+ op: any;
8
+ options: any;
9
+ rawValue: any;
10
+ type: any;
11
+ unparsedValue: any;
12
+ value: any;
13
+ constructor(op: any, field: any, value: any, options: any, fieldTypes: any);
14
+ eval(object: any): any;
15
+ getValue(): any;
16
+ serialize(): {
17
+ options: any;
18
+ op: any;
19
+ field: any;
20
+ value: any;
21
+ type: any;
22
+ };
23
+ }
24
+ declare const ACTION_OPS: readonly ["set", "set-split-amount", "link-schedule"];
25
+ type ActionOperator = (typeof ACTION_OPS)[number];
26
+ export declare class Action {
27
+ field: any;
28
+ op: ActionOperator;
29
+ options: any;
30
+ rawValue: any;
31
+ type: any;
32
+ value: any;
33
+ constructor(op: ActionOperator, field: any, value: any, options: any, fieldTypes: any);
34
+ exec(object: any): void;
35
+ serialize(): {
36
+ options: any;
37
+ op: "set" | "set-split-amount" | "link-schedule";
38
+ field: any;
39
+ value: any;
40
+ type: any;
41
+ };
42
+ }
43
+ export declare function execActions(actions: Action[], transaction: any): any;
44
+ export declare class Rule {
45
+ actions: any;
46
+ conditions: any;
47
+ conditionsOp: any;
48
+ id: any;
49
+ stage: any;
50
+ constructor({ id, stage, conditionsOp, conditions, actions, fieldTypes, }: {
51
+ id?: string;
52
+ stage?: any;
53
+ conditionsOp: any;
54
+ conditions: any;
55
+ actions: any;
56
+ fieldTypes: any;
57
+ });
58
+ evalConditions(object: any): any;
59
+ execActions<T>(object: T): Partial<T>;
60
+ exec(object: any): Partial<any>;
61
+ apply(object: any): any;
62
+ getId(): any;
63
+ serialize(): {
64
+ id: any;
65
+ stage: any;
66
+ conditionsOp: any;
67
+ conditions: any;
68
+ actions: any;
69
+ };
70
+ }
71
+ export declare class RuleIndexer {
72
+ field: any;
73
+ method: any;
74
+ rules: any;
75
+ constructor({ field, method }: {
76
+ field: string;
77
+ method?: string;
78
+ });
79
+ getIndex(key: any): any;
80
+ getIndexForValue(value: any): any;
81
+ getKey(value: any): string;
82
+ getIndexes(rule: any): any[];
83
+ index(rule: any): void;
84
+ remove(rule: any): void;
85
+ getApplicableRules(object: any): Set<unknown>;
86
+ }
87
+ export declare function rankRules(rules: any): any[];
88
+ export declare function migrateIds(rule: any, mappings: any): void;
89
+ export declare function iterateIds(rules: any, fieldName: any, func: any): void;
90
+ export {};
@@ -0,0 +1,13 @@
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<{
3
+ added: any[];
4
+ updated: any[];
5
+ }>;
6
+ export declare function addTransactions(acctId: any, transactions: any, { runTransfers, learnCategories }?: {
7
+ runTransfers?: boolean;
8
+ learnCategories?: boolean;
9
+ }): Promise<any>;
10
+ export declare function syncAccount(userId: string, userKey: string, id: string, acctId: string, bankId: string): Promise<{
11
+ added: any[];
12
+ updated: any[];
13
+ }>;
@@ -0,0 +1,3 @@
1
+ export declare function title(str: any, options?: {
2
+ special: any;
3
+ }): any;
@@ -0,0 +1 @@
1
+ export declare const lowerCaseSet: Set<string>;
@@ -0,0 +1 @@
1
+ export declare const specials: string[];
@@ -0,0 +1,47 @@
1
+ import { type TransactionEntity, type RuleActionEntity, type RuleEntity } from '../../types/models';
2
+ import { Action } from './rules';
3
+ export { iterateIds } from './rules';
4
+ export declare function resetState(): void;
5
+ export declare function parseConditionsOrActions(str: any): any[];
6
+ export declare function serializeConditionsOrActions(arr: any): string;
7
+ export declare const ruleModel: {
8
+ validate(rule: any, { update }?: {
9
+ update?: boolean;
10
+ }): any;
11
+ toJS(row: any): any;
12
+ fromJS(rule: any): any;
13
+ };
14
+ export declare function makeRule(data: any): any;
15
+ export declare function loadRules(): Promise<void>;
16
+ export declare function getRules(): any[];
17
+ export declare function insertRule(rule: Omit<RuleEntity, 'id'> & {
18
+ id?: string;
19
+ }): Promise<any>;
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>;
24
+ export declare function runRules(trans: any): any;
25
+ export declare function conditionsToAQL(conditions: any, { recurDateBounds }?: {
26
+ recurDateBounds?: number;
27
+ }): {
28
+ filters: any;
29
+ errors: any[];
30
+ };
31
+ export declare function applyActions(transactions: TransactionEntity[], actions: Array<Action | RuleActionEntity>): Promise<{
32
+ added: TransactionEntity[];
33
+ updated: TransactionEntity[] | ({
34
+ id: any;
35
+ transfer_id: any;
36
+ } | {
37
+ id: any;
38
+ payee: any;
39
+ } | {
40
+ id: any;
41
+ category: any;
42
+ })[];
43
+ }>;
44
+ export declare function getRulesForPayee(payeeId: any): any[];
45
+ export declare function updatePayeeRenameRule(fromNames: string[], to: string): Promise<any>;
46
+ export declare function getProbableCategory(transactions: any): any;
47
+ export declare function updateCategoryRules(transactions: any): Promise<void>;
@@ -0,0 +1,33 @@
1
+ import { TransactionEntity } from '../../types/models';
2
+ export declare function batchUpdateTransactions({ added, deleted, updated, learnCategories, detectOrphanPayees, runTransfers, }: {
3
+ added?: Array<{
4
+ id: string;
5
+ payee: unknown;
6
+ category: unknown;
7
+ }>;
8
+ deleted?: Array<{
9
+ id: string;
10
+ payee: unknown;
11
+ }>;
12
+ updated?: Array<{
13
+ id: string;
14
+ payee?: unknown;
15
+ account?: unknown;
16
+ category?: unknown;
17
+ }>;
18
+ learnCategories?: boolean;
19
+ detectOrphanPayees?: boolean;
20
+ runTransfers?: boolean;
21
+ }): Promise<{
22
+ added: TransactionEntity[];
23
+ updated: TransactionEntity[] | ({
24
+ id: any;
25
+ transfer_id: any;
26
+ } | {
27
+ id: any;
28
+ payee: any;
29
+ } | {
30
+ id: any;
31
+ category: any;
32
+ })[];
33
+ }>;
@@ -0,0 +1,37 @@
1
+ export declare function addTransfer(transaction: any, transferredAccount: any): Promise<{
2
+ id: any;
3
+ payee: any;
4
+ } | {
5
+ category?: any;
6
+ id: any;
7
+ transfer_id: any;
8
+ payee?: undefined;
9
+ }>;
10
+ export declare function removeTransfer(transaction: any): Promise<{
11
+ id: any;
12
+ transfer_id: any;
13
+ }>;
14
+ export declare function updateTransfer(transaction: any, transferredAccount: any): Promise<{
15
+ id: any;
16
+ category: any;
17
+ }>;
18
+ export declare function onInsert(transaction: any): Promise<{
19
+ id: any;
20
+ payee: any;
21
+ } | {
22
+ category?: any;
23
+ id: any;
24
+ transfer_id: any;
25
+ payee?: undefined;
26
+ }>;
27
+ export declare function onDelete(transaction: any): Promise<void>;
28
+ export declare function onUpdate(transaction: any): Promise<{
29
+ id: any;
30
+ transfer_id: any;
31
+ } | {
32
+ id: any;
33
+ payee: any;
34
+ } | {
35
+ id: any;
36
+ category: any;
37
+ }>;
@@ -0,0 +1,10 @@
1
+ interface TransactionCAMT {
2
+ amount: number;
3
+ date: string;
4
+ payee_name: string | null;
5
+ imported_payee: string | null;
6
+ notes: string | null;
7
+ imported_id?: string;
8
+ }
9
+ export declare function xmlCAMT2json(content: string): Promise<TransactionCAMT[]>;
10
+ export {};