@actual-app/api 24.11.0 → 24.12.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 (36) hide show
  1. package/@types/loot-core/client/state-types/queries.d.ts +9 -10
  2. package/@types/loot-core/server/accounts/sync.d.ts +5 -0
  3. package/@types/loot-core/server/budget/actions.d.ts +1 -0
  4. package/@types/loot-core/server/budget/app.d.ts +1 -1
  5. package/@types/loot-core/server/budget/categoryTemplate.d.ts +46 -0
  6. package/@types/loot-core/server/budget/goaltemplates.d.ts +4 -0
  7. package/@types/loot-core/server/budget/types/handlers.d.ts +5 -0
  8. package/@types/loot-core/server/budget/types/templates.d.ts +7 -1
  9. package/@types/loot-core/server/main-app.d.ts +1 -1
  10. package/@types/loot-core/server/server-config.d.ts +1 -0
  11. package/@types/loot-core/shared/months.d.ts +1 -1
  12. package/@types/loot-core/shared/query.d.ts +30 -16
  13. package/@types/loot-core/shared/rules.d.ts +2 -2
  14. package/@types/loot-core/shared/schedules.d.ts +4 -1
  15. package/@types/loot-core/types/models/bank-sync.d.ts +21 -0
  16. package/@types/loot-core/types/models/dashboard.d.ts +29 -1
  17. package/@types/loot-core/types/models/gocardless.d.ts +61 -0
  18. package/@types/loot-core/types/models/index.d.ts +1 -0
  19. package/@types/loot-core/types/models/rule.d.ts +3 -0
  20. package/@types/loot-core/types/models/schedule.d.ts +1 -1
  21. package/@types/loot-core/types/models/simplefin.d.ts +7 -0
  22. package/@types/loot-core/types/prefs.d.ts +2 -3
  23. package/@types/loot-core/types/server-handlers.d.ts +14 -1
  24. package/dist/app/bundle.api.js +4704 -2019
  25. package/dist/migrations/1730744182000_fix_dashboard_table.sql +7 -0
  26. package/dist/package.json +1 -1
  27. package/package.json +1 -1
  28. package/@types/loot-core/server/budget/goals/goalsAverage.d.ts +0 -4
  29. package/@types/loot-core/server/budget/goals/goalsBy.d.ts +0 -5
  30. package/@types/loot-core/server/budget/goals/goalsCopy.d.ts +0 -7
  31. package/@types/loot-core/server/budget/goals/goalsPercentage.d.ts +0 -4
  32. package/@types/loot-core/server/budget/goals/goalsRemainder.d.ts +0 -8
  33. package/@types/loot-core/server/budget/goals/goalsSimple.d.ts +0 -7
  34. package/@types/loot-core/server/budget/goals/goalsSpend.d.ts +0 -4
  35. package/@types/loot-core/server/budget/goals/goalsWeek.d.ts +0 -7
  36. /package/@types/loot-core/server/budget/{goals/goalsSchedule.d.ts → goalsSchedule.d.ts} +0 -0
@@ -1,12 +1,12 @@
1
1
  import type { Handlers } from '../../types/handlers';
2
- import { type AccountEntity } from '../../types/models';
2
+ import { type TransactionEntity, type AccountEntity } from '../../types/models';
3
3
  import type * as constants from '../constants';
4
4
 
5
5
  export type QueriesState = {
6
- newTransactions: string[];
7
- matchedTransactions: string[];
8
- lastTransaction: unknown | null;
9
- updatedAccounts: string[];
6
+ newTransactions: Array<TransactionEntity['id']>;
7
+ matchedTransactions: Array<TransactionEntity['id']>;
8
+ lastTransaction: TransactionEntity | null;
9
+ updatedAccounts: Array<AccountEntity['id']>;
10
10
  accounts: AccountEntity[];
11
11
  accountsLoaded: boolean;
12
12
  categories: Awaited<ReturnType<Handlers['get-categories']>>;
@@ -15,14 +15,13 @@ export type QueriesState = {
15
15
  commonPayees: Awaited<ReturnType<Handlers['common-payees-get']>>;
16
16
  payees: Awaited<ReturnType<Handlers['payees-get']>>;
17
17
  payeesLoaded: boolean;
18
- earliestTransaction: unknown | null;
19
18
  };
20
19
 
21
20
  type SetNewTransactionsAction = {
22
21
  type: typeof constants.SET_NEW_TRANSACTIONS;
23
- newTransactions?: string[];
24
- matchedTransactions?: string[];
25
- updatedAccounts?: string[];
22
+ newTransactions?: Array<TransactionEntity['id']>;
23
+ matchedTransactions?: Array<TransactionEntity['id']>;
24
+ updatedAccounts?: Array<AccountEntity['id']>;
26
25
  };
27
26
 
28
27
  type UpdateNewTransactionsAction = {
@@ -32,7 +31,7 @@ type UpdateNewTransactionsAction = {
32
31
 
33
32
  type SetLastTransactionAction = {
34
33
  type: typeof constants.SET_LAST_TRANSACTION;
35
- transaction: unknown;
34
+ transaction: TransactionEntity;
36
35
  };
37
36
 
38
37
  type MarkAccountReadAction = {
@@ -1,3 +1,4 @@
1
+ import { AccountEntity } from '../../types/models';
1
2
  export declare function getGoCardlessAccounts(userId: any, userKey: any, id: any): Promise<any>;
2
3
  export declare function reconcileTransactions(acctId: any, transactions: any, isBankSyncAccount?: boolean, strictIdChecking?: boolean, isPreview?: boolean): Promise<{
3
4
  added: any[];
@@ -22,3 +23,7 @@ export declare function syncAccount(userId: string, userKey: string, id: string,
22
23
  added: any[];
23
24
  updated: any[];
24
25
  }>;
26
+ export declare function SimpleFinBatchSync(accounts: {
27
+ id: AccountEntity['id'];
28
+ accountId: AccountEntity['account_id'];
29
+ }[]): Promise<any[]>;
@@ -1,4 +1,5 @@
1
1
  export declare function getSheetValue(sheetName: string, cell: string): Promise<number>;
2
+ export declare function getSheetBoolean(sheetName: string, cell: string): Promise<boolean>;
2
3
  export declare function isReflectBudget(): boolean;
3
4
  export declare function getBudget({ category, month, }: {
4
5
  category: string;
@@ -4,7 +4,7 @@ export declare const app: {
4
4
  handlers: BudgetHandlers;
5
5
  services: any;
6
6
  unlistenServices: any;
7
- method<Name extends "budget/budget-amount" | "budget/copy-previous-month" | "budget/set-zero" | "budget/set-3month-avg" | "budget/check-templates" | "budget/apply-goal-template" | "budget/overwrite-goal-template" | "budget/cleanup-goal-template" | "budget/hold-for-next-month" | "budget/reset-hold" | "budget/cover-overspending" | "budget/transfer-available" | "budget/cover-overbudgeted" | "budget/transfer-category" | "budget/set-carryover" | "budget/apply-single-template" | "budget/set-n-month-avg" | "budget/copy-single-month">(name: Name, func: BudgetHandlers[Name]): void;
7
+ method<Name extends "budget/budget-amount" | "budget/copy-previous-month" | "budget/set-zero" | "budget/set-3month-avg" | "budget/check-templates" | "budget/apply-goal-template" | "budget/overwrite-goal-template" | "budget/cleanup-goal-template" | "budget/hold-for-next-month" | "budget/reset-hold" | "budget/cover-overspending" | "budget/transfer-available" | "budget/cover-overbudgeted" | "budget/transfer-category" | "budget/set-carryover" | "budget/apply-single-template" | "budget/set-n-month-avg" | "budget/copy-single-month" | "budget/apply-multiple-templates">(name: Name, func: BudgetHandlers[Name]): void;
8
8
  service(func: any): void;
9
9
  combine(...apps: any[]): void;
10
10
  startServices(): void;
@@ -0,0 +1,46 @@
1
+ import { Template } from './types/templates';
2
+ export declare class CategoryTemplate {
3
+ static init(templates: Template[], categoryID: string, month: any): Promise<CategoryTemplate>;
4
+ getPriorities(): number[];
5
+ getRemainderWeight(): number;
6
+ getLimitExcess(): number;
7
+ runAll(available: number): Promise<number>;
8
+ runTemplatesForPriority(priority: number, budgetAvail: number, availStart: number): Promise<number>;
9
+ runRemainder(budgetAvail: number, perWeight: number): number;
10
+ getValues(): {
11
+ budgeted: any;
12
+ goal: any;
13
+ longGoal: any;
14
+ };
15
+ readonly categoryID: string;
16
+ private month;
17
+ private templates;
18
+ private remainder;
19
+ private goals;
20
+ private priorities;
21
+ private remainderWeight;
22
+ private toBudgetAmount;
23
+ private fullAmount;
24
+ private isLongGoal;
25
+ private goalAmount;
26
+ private fromLastMonth;
27
+ private limitMet;
28
+ private limitExcess;
29
+ private limitAmount;
30
+ private limitCheck;
31
+ private limitHold;
32
+ private constructor();
33
+ private runGoal;
34
+ static checkByAndScheduleAndSpend(templates: any, month: any): Promise<void>;
35
+ static checkPercentage(templates: any): Promise<void>;
36
+ private checkLimit;
37
+ private checkSpend;
38
+ private checkGoal;
39
+ private runSimple;
40
+ private runCopy;
41
+ private runWeek;
42
+ private runSpend;
43
+ private runPercentage;
44
+ private runAverage;
45
+ private runBy;
46
+ }
@@ -5,6 +5,10 @@ export declare function applyTemplate({ month }: {
5
5
  export declare function overwriteTemplate({ month }: {
6
6
  month: any;
7
7
  }): Promise<Notification>;
8
+ export declare function applyMultipleCategoryTemplates({ month, categoryIds }: {
9
+ month: any;
10
+ categoryIds: any;
11
+ }): Promise<Notification>;
8
12
  export declare function applySingleCategoryTemplate({ month, category }: {
9
13
  month: any;
10
14
  category: any;
@@ -79,4 +79,9 @@ export interface BudgetHandlers {
79
79
  month: string;
80
80
  category: string; //category id
81
81
  }) => Promise<void>;
82
+
83
+ 'budget/apply-multiple-templates': (arg: {
84
+ month: string;
85
+ categoryIds: string[];
86
+ }) => Promise<Notification>;
82
87
  }
@@ -55,7 +55,7 @@ interface RemainderTemplate extends BaseTemplate {
55
55
 
56
56
  interface AverageTemplate extends BaseTemplate {
57
57
  type: 'average';
58
- amount: number;
58
+ numMonths: number;
59
59
  }
60
60
 
61
61
  interface GoalTemplate extends BaseTemplate {
@@ -63,6 +63,11 @@ interface GoalTemplate extends BaseTemplate {
63
63
  amount: number;
64
64
  }
65
65
 
66
+ interface CopyTemplate extends BaseTemplate {
67
+ type: 'copy';
68
+ lookBack: number;
69
+ }
70
+
66
71
  interface ErrorTemplate extends BaseTemplate {
67
72
  type: 'error';
68
73
  line: string;
@@ -79,4 +84,5 @@ export type Template =
79
84
  | RemainderTemplate
80
85
  | AverageTemplate
81
86
  | GoalTemplate
87
+ | CopyTemplate
82
88
  | ErrorTemplate;
@@ -4,7 +4,7 @@ export declare const app: {
4
4
  handlers: Handlers;
5
5
  services: any;
6
6
  unlistenServices: any;
7
- method<Name extends "sync" | "transaction-update" | "undo" | "redo" | "transactions-batch-update" | "transaction-add" | "transaction-delete" | "transactions-parse-file" | "transactions-export" | "transactions-export-query" | "get-categories" | "get-earliest-transaction" | "get-budget-bounds" | "envelope-budget-month" | "tracking-budget-month" | "category-create" | "category-update" | "category-move" | "category-delete" | "category-group-create" | "category-group-update" | "category-group-move" | "category-group-delete" | "must-category-transfer" | "payee-create" | "common-payees-get" | "payees-get" | "payees-get-rule-counts" | "payees-merge" | "payees-batch-change" | "payees-check-orphaned" | "payees-get-rules" | "make-filters-from-conditions" | "getCell" | "getCells" | "getCellNamesInSheet" | "debugCell" | "create-query" | "query" | "account-update" | "accounts-get" | "account-properties" | "gocardless-accounts-link" | "simplefin-accounts-link" | "account-create" | "account-close" | "account-reopen" | "account-move" | "secret-set" | "secret-check" | "gocardless-poll-web-token" | "gocardless-status" | "simplefin-status" | "simplefin-accounts" | "gocardless-get-banks" | "gocardless-poll-web-token-stop" | "gocardless-create-web-token" | "accounts-bank-sync" | "transactions-import" | "account-unlink" | "save-global-prefs" | "load-global-prefs" | "save-prefs" | "load-prefs" | "sync-reset" | "sync-repair" | "key-make" | "key-test" | "get-did-bootstrap" | "subscribe-needs-bootstrap" | "subscribe-bootstrap" | "subscribe-get-user" | "subscribe-change-password" | "subscribe-sign-in" | "subscribe-sign-out" | "get-server-version" | "get-server-url" | "set-server-url" | "get-budgets" | "get-remote-files" | "reset-budget-cache" | "upload-budget" | "download-budget" | "sync-budget" | "load-budget" | "create-demo-budget" | "close-budget" | "delete-budget" | "create-budget" | "import-budget" | "export-budget" | "upload-file-web" | "backups-get" | "backup-load" | "backup-make" | "get-last-opened-backup" | "app-focused" | "api/batch-budget-start" | "api/batch-budget-end" | "api/load-budget" | "api/download-budget" | "api/get-budgets" | "api/start-import" | "api/finish-import" | "api/abort-import" | "api/query" | "api/budget-months" | "api/budget-month" | "api/budget-set-amount" | "api/budget-set-carryover" | "api/budget-hold-for-next-month" | "api/budget-reset-hold" | "api/transactions-export" | "api/transactions-import" | "api/transactions-add" | "api/transactions-get" | "api/transaction-update" | "api/transaction-delete" | "api/sync" | "api/bank-sync" | "api/accounts-get" | "api/account-create" | "api/account-update" | "api/account-close" | "api/account-reopen" | "api/account-delete" | "api/account-balance" | "api/categories-get" | "api/category-groups-get" | "api/category-group-create" | "api/category-group-update" | "api/category-group-delete" | "api/category-create" | "api/category-update" | "api/category-delete" | "api/payees-get" | "api/common-payees-get" | "api/payee-create" | "api/payee-update" | "api/payee-delete" | "api/payees-merge" | "api/rules-get" | "api/payee-rules-get" | "api/rule-create" | "api/rule-update" | "api/rule-delete" | "budget/budget-amount" | "budget/copy-previous-month" | "budget/set-zero" | "budget/set-3month-avg" | "budget/check-templates" | "budget/apply-goal-template" | "budget/overwrite-goal-template" | "budget/cleanup-goal-template" | "budget/hold-for-next-month" | "budget/reset-hold" | "budget/cover-overspending" | "budget/transfer-available" | "budget/cover-overbudgeted" | "budget/transfer-category" | "budget/set-carryover" | "budget/apply-single-template" | "budget/set-n-month-avg" | "budget/copy-single-month" | "dashboard-update" | "dashboard-update-widget" | "dashboard-reset" | "dashboard-add-widget" | "dashboard-remove-widget" | "dashboard-import" | "filter-create" | "filter-update" | "filter-delete" | "notes-save" | "preferences/save" | "preferences/get" | "report/create" | "report/update" | "report/delete" | "rule-validate" | "rule-add" | "rule-update" | "rule-delete" | "rule-delete-all" | "rule-apply-actions" | "rule-add-payee-rename" | "rules-get" | "rule-get" | "rules-run" | "schedule/create" | "schedule/update" | "schedule/delete" | "schedule/skip-next-date" | "schedule/post-transaction" | "schedule/force-run-service" | "schedule/discover" | "schedule/get-upcoming-dates" | "tools/fix-split-transactions">(name: Name, func: Handlers[Name]): void;
7
+ method<Name extends "sync" | "transaction-update" | "undo" | "redo" | "transactions-batch-update" | "transaction-add" | "transaction-delete" | "transactions-parse-file" | "transactions-export" | "transactions-export-query" | "get-categories" | "get-earliest-transaction" | "get-budget-bounds" | "envelope-budget-month" | "tracking-budget-month" | "category-create" | "category-update" | "category-move" | "category-delete" | "category-group-create" | "category-group-update" | "category-group-move" | "category-group-delete" | "must-category-transfer" | "payee-create" | "common-payees-get" | "payees-get" | "payees-get-rule-counts" | "payees-merge" | "payees-batch-change" | "payees-check-orphaned" | "payees-get-orphaned" | "payees-get-rules" | "make-filters-from-conditions" | "getCell" | "getCells" | "getCellNamesInSheet" | "debugCell" | "create-query" | "query" | "account-update" | "accounts-get" | "account-properties" | "gocardless-accounts-link" | "simplefin-accounts-link" | "account-create" | "account-close" | "account-reopen" | "account-move" | "secret-set" | "secret-check" | "gocardless-poll-web-token" | "gocardless-status" | "simplefin-status" | "simplefin-accounts" | "simplefin-batch-sync" | "gocardless-get-banks" | "gocardless-poll-web-token-stop" | "gocardless-create-web-token" | "accounts-bank-sync" | "transactions-import" | "account-unlink" | "save-global-prefs" | "load-global-prefs" | "save-prefs" | "load-prefs" | "sync-reset" | "sync-repair" | "key-make" | "key-test" | "get-did-bootstrap" | "subscribe-needs-bootstrap" | "subscribe-bootstrap" | "subscribe-get-user" | "subscribe-change-password" | "subscribe-sign-in" | "subscribe-sign-out" | "get-server-version" | "get-server-url" | "set-server-url" | "get-budgets" | "get-remote-files" | "reset-budget-cache" | "upload-budget" | "download-budget" | "sync-budget" | "load-budget" | "create-demo-budget" | "close-budget" | "delete-budget" | "create-budget" | "import-budget" | "export-budget" | "upload-file-web" | "backups-get" | "backup-load" | "backup-make" | "get-last-opened-backup" | "app-focused" | "api/batch-budget-start" | "api/batch-budget-end" | "api/load-budget" | "api/download-budget" | "api/get-budgets" | "api/start-import" | "api/finish-import" | "api/abort-import" | "api/query" | "api/budget-months" | "api/budget-month" | "api/budget-set-amount" | "api/budget-set-carryover" | "api/budget-hold-for-next-month" | "api/budget-reset-hold" | "api/transactions-export" | "api/transactions-import" | "api/transactions-add" | "api/transactions-get" | "api/transaction-update" | "api/transaction-delete" | "api/sync" | "api/bank-sync" | "api/accounts-get" | "api/account-create" | "api/account-update" | "api/account-close" | "api/account-reopen" | "api/account-delete" | "api/account-balance" | "api/categories-get" | "api/category-groups-get" | "api/category-group-create" | "api/category-group-update" | "api/category-group-delete" | "api/category-create" | "api/category-update" | "api/category-delete" | "api/payees-get" | "api/common-payees-get" | "api/payee-create" | "api/payee-update" | "api/payee-delete" | "api/payees-merge" | "api/rules-get" | "api/payee-rules-get" | "api/rule-create" | "api/rule-update" | "api/rule-delete" | "budget/budget-amount" | "budget/copy-previous-month" | "budget/set-zero" | "budget/set-3month-avg" | "budget/check-templates" | "budget/apply-goal-template" | "budget/overwrite-goal-template" | "budget/cleanup-goal-template" | "budget/hold-for-next-month" | "budget/reset-hold" | "budget/cover-overspending" | "budget/transfer-available" | "budget/cover-overbudgeted" | "budget/transfer-category" | "budget/set-carryover" | "budget/apply-single-template" | "budget/set-n-month-avg" | "budget/copy-single-month" | "budget/apply-multiple-templates" | "dashboard-update" | "dashboard-update-widget" | "dashboard-reset" | "dashboard-add-widget" | "dashboard-remove-widget" | "dashboard-import" | "filter-create" | "filter-update" | "filter-delete" | "notes-save" | "preferences/save" | "preferences/get" | "report/create" | "report/update" | "report/delete" | "rule-validate" | "rule-add" | "rule-update" | "rule-delete" | "rule-delete-all" | "rule-apply-actions" | "rule-add-payee-rename" | "rules-get" | "rule-get" | "rules-run" | "schedule/create" | "schedule/update" | "schedule/delete" | "schedule/skip-next-date" | "schedule/post-transaction" | "schedule/force-run-service" | "schedule/discover" | "schedule/get-upcoming-dates" | "tools/fix-split-transactions">(name: Name, func: Handlers[Name]): void;
8
8
  service(func: any): void;
9
9
  combine(...apps: any[]): void;
10
10
  startServices(): void;
@@ -5,6 +5,7 @@ type ServerConfig = {
5
5
  GOCARDLESS_SERVER: string;
6
6
  SIMPLEFIN_SERVER: string;
7
7
  };
8
+ export declare function isValidBaseURL(base: string): boolean;
8
9
  export declare function setServer(url: string): void;
9
10
  export declare function getServer(url?: string): ServerConfig | null;
10
11
  export {};
@@ -54,7 +54,7 @@ export declare function getYearStart(month: string): string;
54
54
  export declare function getYearEnd(month: string): string;
55
55
  export declare function sheetForMonth(month: string): string;
56
56
  export declare function nameForMonth(month: DateLike): string;
57
- export declare function format(month: DateLike, str: string): string;
57
+ export declare function format(month: DateLike, format: string): string;
58
58
  export declare const getDateFormatRegex: import("memoize-one").MemoizedFn<(format: string) => RegExp>;
59
59
  export declare const getDayMonthFormat: import("memoize-one").MemoizedFn<(format: string) => string>;
60
60
  export declare const getDayMonthRegex: import("memoize-one").MemoizedFn<(format: string) => RegExp>;
@@ -1,8 +1,14 @@
1
+ import { WithRequired } from '../types/util';
2
+ type ObjectExpression = {
3
+ [key: string]: ObjectExpression | unknown;
4
+ };
1
5
  export type QueryState = {
2
- filterExpressions: Array<string>;
3
- selectExpressions: Array<unknown>;
4
- groupExpressions: Array<unknown>;
5
- orderExpressions: Array<unknown>;
6
+ table: string;
7
+ tableOptions: Record<string, unknown>;
8
+ filterExpressions: Array<ObjectExpression>;
9
+ selectExpressions: Array<ObjectExpression | string | '*'>;
10
+ groupExpressions: Array<ObjectExpression | string>;
11
+ orderExpressions: Array<ObjectExpression | string>;
6
12
  calculation: boolean;
7
13
  rawMode: boolean;
8
14
  withDead: boolean;
@@ -12,20 +18,28 @@ export type QueryState = {
12
18
  };
13
19
  export declare class Query {
14
20
  state: QueryState;
15
- constructor(state: any);
16
- filter(expr: any): Query;
17
- unfilter(exprs: any): Query;
18
- select(exprs?: Array<unknown> | unknown): Query;
19
- calculate(expr: any): Query;
20
- groupBy(exprs: any): Query;
21
- orderBy(exprs: any): Query;
22
- limit(num: any): Query;
23
- offset(num: any): Query;
21
+ constructor(state: WithRequired<Partial<QueryState>, 'table'>);
22
+ filter(expr: ObjectExpression): Query;
23
+ unfilter(exprs?: Array<keyof ObjectExpression>): Query;
24
+ select(exprs?: Array<ObjectExpression | string> | ObjectExpression | string | '*' | ['*']): Query;
25
+ calculate(expr: ObjectExpression | string): Query;
26
+ groupBy(exprs: ObjectExpression | string | Array<ObjectExpression | string>): Query;
27
+ orderBy(exprs: ObjectExpression | string | Array<ObjectExpression | string>): Query;
28
+ limit(num: number): Query;
29
+ offset(num: number): Query;
24
30
  raw(): Query;
25
31
  withDead(): Query;
26
32
  withoutValidatedRefs(): Query;
27
- options(opts: any): Query;
33
+ options(opts: Record<string, unknown>): Query;
34
+ reset(): Query;
28
35
  serialize(): QueryState;
29
36
  }
30
- export declare function getPrimaryOrderBy(query: any, defaultOrderBy: any): any;
31
- export declare function q(table: any): Query;
37
+ export declare function getPrimaryOrderBy(query: Query, defaultOrderBy: ObjectExpression | null): {
38
+ order: string;
39
+ field?: undefined;
40
+ } | {
41
+ field: string;
42
+ order: unknown;
43
+ };
44
+ export declare function q(table: QueryState['table']): Query;
45
+ export {};
@@ -1,6 +1,6 @@
1
1
  import { FieldValueTypes, RuleConditionOp } from '../types/models';
2
2
  export declare const FIELD_TYPES: Map<keyof FieldValueTypes, string>;
3
- export declare function isValidOp(field: keyof FieldValueTypes, op: RuleConditionOp): boolean;
3
+ export declare function isValidOp(field: keyof FieldValueTypes, op: RuleConditionOp): any;
4
4
  export declare function getValidOps(field: keyof FieldValueTypes): any;
5
5
  export declare const ALLOCATION_METHODS: {
6
6
  'fixed-amount': string;
@@ -8,7 +8,7 @@ export declare const ALLOCATION_METHODS: {
8
8
  remainder: string;
9
9
  };
10
10
  export declare function mapField(field: any, opts?: any): any;
11
- export declare function friendlyOp(op: any, type?: any): "" | "is" | "contains" | "matches" | "one of" | "not one of" | "is not" | "is approx" | "is between" | "has tag(s)" | "does not contain" | "is after" | "is greater than" | "is after or equals" | "is greater than or equals" | "is before" | "is less than" | "is before or equals" | "is less than or equals" | "is true" | "is false" | "set" | "allocate" | "link schedule" | "prepend to notes" | "append to notes" | "and" | "or";
11
+ export declare function friendlyOp(op: any, type?: any): string;
12
12
  export declare function deserializeField(field: any): {
13
13
  field: string;
14
14
  options: {
@@ -39,5 +39,8 @@ export declare function extractScheduleConds(conditions: any): {
39
39
  amount: any;
40
40
  date: any;
41
41
  };
42
- export declare function getScheduledAmount(amount: any): any;
42
+ export declare function getScheduledAmount(amount: number | {
43
+ num1: number;
44
+ num2: number;
45
+ }, inverse?: boolean): number;
43
46
  export declare function describeSchedule(schedule: any, payee: any): string;
@@ -0,0 +1,21 @@
1
+ import {
2
+ GoCardlessAmount,
3
+ GoCardlessBalance,
4
+ GoCardlessTransaction,
5
+ } from './gocardless';
6
+
7
+ export type BankSyncBalance = GoCardlessBalance;
8
+ export type BankSyncAmount = GoCardlessAmount;
9
+ export type BankSyncTransaction = GoCardlessTransaction;
10
+
11
+ export type BankSyncResponse = {
12
+ transactions: {
13
+ all: BankSyncTransaction[];
14
+ booked: BankSyncTransaction[];
15
+ pending: BankSyncTransaction[];
16
+ };
17
+ balances: BankSyncBalance[];
18
+ startingBalance: number;
19
+ error_type: string;
20
+ error_code: string;
21
+ };
@@ -37,6 +37,7 @@ export type CashFlowWidget = AbstractWidget<
37
37
  conditions?: RuleConditionEntity[];
38
38
  conditionsOp?: 'and' | 'or';
39
39
  timeFrame?: TimeFrame;
40
+ showBalance?: boolean;
40
41
  } | null
41
42
  >;
42
43
  export type SpendingWidget = AbstractWidget<
@@ -64,7 +65,8 @@ type SpecializedWidget =
64
65
  | NetWorthWidget
65
66
  | CashFlowWidget
66
67
  | SpendingWidget
67
- | MarkdownWidget;
68
+ | MarkdownWidget
69
+ | SummaryWidget;
68
70
  export type Widget = SpecializedWidget | CustomReportWidget;
69
71
  export type NewWidget = Omit<Widget, 'id' | 'tombstone'>;
70
72
 
@@ -87,3 +89,29 @@ export type ExportImportDashboard = {
87
89
  version: 1;
88
90
  widgets: ExportImportDashboardWidget[];
89
91
  };
92
+
93
+ export type SummaryWidget = AbstractWidget<
94
+ 'summary-card',
95
+ {
96
+ name?: string;
97
+ conditions?: RuleConditionEntity[];
98
+ conditionsOp?: 'and' | 'or';
99
+ timeFrame?: TimeFrame;
100
+ content?: string;
101
+ } | null
102
+ >;
103
+
104
+ export type BaseSummaryContent = {
105
+ type: 'sum' | 'avgPerMonth' | 'avgPerTransact';
106
+ fontSize?: number;
107
+ };
108
+
109
+ export type PercentageSummaryContent = {
110
+ type: 'percentage';
111
+ divisorConditions: RuleConditionEntity[];
112
+ divisorConditionsOp: 'and' | 'or';
113
+ divisorAllTimeDateRange?: boolean;
114
+ fontSize?: number;
115
+ };
116
+
117
+ export type SummaryContent = BaseSummaryContent | PercentageSummaryContent;
@@ -12,3 +12,64 @@ export type GoCardlessInstitution = {
12
12
  logo: string;
13
13
  identification_codes: string[];
14
14
  };
15
+
16
+ export type GoCardlessBalance = {
17
+ balanceAmount: GoCardlessAmount;
18
+ balanceType:
19
+ | 'closingBooked'
20
+ | 'expected'
21
+ | 'forwardAvailable'
22
+ | 'interimAvailable'
23
+ | 'interimBooked'
24
+ | 'nonInvoiced'
25
+ | 'openingBooked';
26
+ creditLimitIncluded?: boolean;
27
+ lastChangeDateTime?: string;
28
+ lastCommittedTransaction?: string;
29
+ referenceDate?: string;
30
+ };
31
+
32
+ export type GoCardlessAmount = {
33
+ amount: string;
34
+ currency: string;
35
+ };
36
+
37
+ export type GoCardlessTransaction = {
38
+ additionalInformation?: string;
39
+ bookingStatus?: string;
40
+ balanceAfterTransaction?: Pick<
41
+ GoCardlessBalance,
42
+ 'balanceType' | 'balanceAmount'
43
+ >;
44
+ bankTransactionCode?: string;
45
+ bookingDate?: string;
46
+ bookingDateTime?: string;
47
+ checkId?: string;
48
+ creditorAccount?: string;
49
+ creditorAgent?: string;
50
+ creditorId?: string;
51
+ creditorName?: string;
52
+ currencyExchange?: string[];
53
+ debtorAccount?: {
54
+ iban: string;
55
+ };
56
+ debtorAgent?: string;
57
+ debtorName?: string;
58
+ endToEndId?: string;
59
+ entryReference?: string;
60
+ internalTransactionId?: string;
61
+ mandateId?: string;
62
+ merchantCategoryCode?: string;
63
+ proprietaryBankTransactionCode?: string;
64
+ purposeCode?: string;
65
+ remittanceInformationStructured?: string;
66
+ remittanceInformationStructuredArray?: string[];
67
+ remittanceInformationUnstructured?: string;
68
+ remittanceInformationUnstructuredArray?: string[];
69
+ transactionAmount: GoCardlessAmount;
70
+ transactionId?: string;
71
+ ultimateCreditor?: string;
72
+ ultimateDebtor?: string;
73
+ valueDate?: string;
74
+ valueDateTime?: string;
75
+ };
@@ -1,4 +1,5 @@
1
1
  export type * from './account';
2
+ export type * from './bank-sync';
2
3
  export type * from './category';
3
4
  export type * from './category-group';
4
5
  export type * from './dashboard';
@@ -26,6 +26,7 @@ export type RuleConditionOp =
26
26
  | 'contains'
27
27
  | 'doesNotContain'
28
28
  | 'hasTags'
29
+ | 'and'
29
30
  | 'matches';
30
31
 
31
32
  type FieldValueTypes = {
@@ -38,6 +39,8 @@ type FieldValueTypes = {
38
39
  payee_name: string;
39
40
  imported_payee: string;
40
41
  saved: string;
42
+ transfer: boolean;
43
+ parent: boolean;
41
44
  cleared: boolean;
42
45
  reconciled: boolean;
43
46
  };
@@ -32,7 +32,7 @@ export interface ScheduleEntity {
32
32
  // underlying rule
33
33
  _payee: PayeeEntity['id'];
34
34
  _account: AccountEntity['id'];
35
- _amount: unknown;
35
+ _amount: number | { num1: number; num2: number };
36
36
  _amountOp: string;
37
37
  _date: RecurConfig;
38
38
  _conditions: unknown;
@@ -1,3 +1,6 @@
1
+ import { AccountEntity } from './account';
2
+ import { BankSyncResponse } from './bank-sync';
3
+
1
4
  export type SimpleFinOrganization = {
2
5
  name: string;
3
6
  domain: string;
@@ -8,3 +11,7 @@ export type SimpleFinAccount = {
8
11
  name: string;
9
12
  org: SimpleFinOrganization;
10
13
  };
14
+
15
+ export interface SimpleFinBatchSyncResponse {
16
+ [accountId: AccountEntity['account_id']]: BankSyncResponse;
17
+ }
@@ -1,9 +1,8 @@
1
1
  export type FeatureFlag =
2
- | 'dashboards'
3
- | 'reportBudget'
4
2
  | 'goalTemplatesEnabled'
5
3
  | 'actionTemplating'
6
- | 'upcomingLengthAdjustment';
4
+ | 'upcomingLengthAdjustment'
5
+ | 'contextMenus';
7
6
 
8
7
  /**
9
8
  * Cross-device preferences. These sync across devices when they are changed.
@@ -116,6 +116,7 @@ export interface ServerHandlers {
116
116
  }) => Promise<unknown>;
117
117
 
118
118
  'payees-check-orphaned': (arg: { ids }) => Promise<unknown>;
119
+ 'payees-get-orphaned': () => Promise<PayeeEntity[]>;
119
120
 
120
121
  'payees-get-rules': (arg: { id: string }) => Promise<RuleEntity[]>;
121
122
 
@@ -193,6 +194,18 @@ export interface ServerHandlers {
193
194
 
194
195
  'simplefin-accounts': () => Promise<{ accounts: SimpleFinAccount[] }>;
195
196
 
197
+ 'simplefin-batch-sync': ({ ids }: { ids: string[] }) => Promise<
198
+ {
199
+ accountId: string;
200
+ res: {
201
+ errors;
202
+ newTransactions;
203
+ matchedTransactions;
204
+ updatedAccounts;
205
+ };
206
+ }[]
207
+ >;
208
+
196
209
  'gocardless-get-banks': (country: string) => Promise<{
197
210
  data: GoCardlessInstitution[];
198
211
  error?: { reason: string };
@@ -213,7 +226,7 @@ export interface ServerHandlers {
213
226
  | { error: 'failed' }
214
227
  >;
215
228
 
216
- 'accounts-bank-sync': (arg: { id?: string }) => Promise<{
229
+ 'accounts-bank-sync': (arg: { ids?: AccountEntity['id'][] }) => Promise<{
217
230
  errors;
218
231
  newTransactions;
219
232
  matchedTransactions;