@actual-app/api 25.6.1 → 25.7.0-nightly.20250611
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.
- package/@types/loot-core/server/accounts/app.d.ts +1 -1
- package/@types/loot-core/server/budget/actions.d.ts +3 -0
- package/@types/loot-core/server/budget/app.d.ts +2 -1
- package/@types/loot-core/server/main-app.d.ts +1 -1
- package/@types/loot-core/types/api-handlers.d.ts +2 -7
- package/@types/loot-core/types/models/import-transaction.d.ts +56 -0
- package/@types/methods.d.ts +4 -5
- package/dist/app/bundle.api.js +47 -46
- package/dist/package.json +2 -3
- package/package.json +2 -3
|
@@ -128,7 +128,7 @@ declare function simpleFinBatchSync({ ids, }: {
|
|
|
128
128
|
accountId: AccountEntity['id'];
|
|
129
129
|
res: SyncResponseWithErrors;
|
|
130
130
|
}>>;
|
|
131
|
-
type ImportTransactionsResult = bankSync.ReconcileTransactionsResult & {
|
|
131
|
+
export type ImportTransactionsResult = bankSync.ReconcileTransactionsResult & {
|
|
132
132
|
errors: Array<{
|
|
133
133
|
message: string;
|
|
134
134
|
}>;
|
|
@@ -24,6 +24,7 @@ export interface BudgetHandlers {
|
|
|
24
24
|
'budget/cover-overbudgeted': typeof actions.coverOverbudgeted;
|
|
25
25
|
'budget/transfer-category': typeof actions.transferCategory;
|
|
26
26
|
'budget/set-carryover': typeof actions.setCategoryCarryover;
|
|
27
|
+
'budget/reset-income-carryover': typeof actions.resetIncomeCarryover;
|
|
27
28
|
'get-categories': typeof getCategories;
|
|
28
29
|
'get-budget-bounds': typeof getBudgetBounds;
|
|
29
30
|
'envelope-budget-month': typeof envelopeBudgetMonth;
|
|
@@ -49,7 +50,7 @@ export declare const app: {
|
|
|
49
50
|
handlers: BudgetHandlers;
|
|
50
51
|
services: (() => () => void)[];
|
|
51
52
|
unlistenServices: (() => void)[];
|
|
52
|
-
method<Name extends "budget/budget-amount" | "budget/copy-previous-month" | "budget/copy-single-month" | "budget/set-zero" | "budget/set-3month-avg" | "budget/set-6month-avg" | "budget/set-12month-avg" | "budget/set-n-month-avg" | "budget/check-templates" | "budget/apply-goal-template" | "budget/apply-multiple-templates" | "budget/overwrite-goal-template" | "budget/apply-single-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" | "get-categories" | "get-budget-bounds" | "envelope-budget-month" | "tracking-budget-month" | "category-create" | "category-update" | "category-move" | "category-delete" | "get-category-groups" | "category-group-create" | "category-group-update" | "category-group-move" | "category-group-delete" | "must-category-transfer">(name: Name, func: BudgetHandlers[Name]): void;
|
|
53
|
+
method<Name extends "budget/budget-amount" | "budget/copy-previous-month" | "budget/copy-single-month" | "budget/set-zero" | "budget/set-3month-avg" | "budget/set-6month-avg" | "budget/set-12month-avg" | "budget/set-n-month-avg" | "budget/check-templates" | "budget/apply-goal-template" | "budget/apply-multiple-templates" | "budget/overwrite-goal-template" | "budget/apply-single-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/reset-income-carryover" | "get-categories" | "get-budget-bounds" | "envelope-budget-month" | "tracking-budget-month" | "category-create" | "category-update" | "category-move" | "category-delete" | "get-category-groups" | "category-group-create" | "category-group-update" | "category-group-move" | "category-group-delete" | "must-category-transfer">(name: Name, func: BudgetHandlers[Name]): void;
|
|
53
54
|
service(func: () => () => void): void;
|
|
54
55
|
combine(...apps: any[]): void;
|
|
55
56
|
startServices(): void;
|
|
@@ -9,7 +9,7 @@ export declare const app: {
|
|
|
9
9
|
handlers: Handlers;
|
|
10
10
|
services: (() => () => void)[];
|
|
11
11
|
unlistenServices: (() => void)[];
|
|
12
|
-
method<Name extends "sync" | "load-budget" | "undo" | "redo" | "make-filters-from-conditions" | "query" | "get-server-version" | "get-server-url" | "set-server-url" | "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/copy-single-month" | "budget/set-zero" | "budget/set-3month-avg" | "budget/set-6month-avg" | "budget/set-12month-avg" | "budget/set-n-month-avg" | "budget/check-templates" | "budget/apply-goal-template" | "budget/apply-multiple-templates" | "budget/overwrite-goal-template" | "budget/apply-single-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" | "get-categories" | "get-budget-bounds" | "envelope-budget-month" | "tracking-budget-month" | "category-create" | "category-update" | "category-move" | "category-delete" | "get-category-groups" | "category-group-create" | "category-group-update" | "category-group-move" | "category-group-delete" | "must-category-transfer" | "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" | "save-global-prefs" | "load-global-prefs" | "save-prefs" | "load-prefs" | "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" | "transactions-batch-update" | "transaction-add" | "transaction-update" | "transaction-delete" | "transactions-parse-file" | "transactions-export" | "transactions-export-query" | "transactions-merge" | "get-earliest-transaction" | "users-get" | "user-delete-all" | "user-add" | "user-update" | "access-add" | "access-delete-all" | "access-get-available-users" | "transfer-ownership" | "owner-created" | "tools/fix-split-transactions" | "account-update" | "accounts-get" | "account-balance" | "account-properties" | "gocardless-accounts-link" | "simplefin-accounts-link" | "pluggyai-accounts-link" | "account-create" | "account-close" | "account-reopen" | "account-move" | "secret-set" | "secret-check" | "gocardless-poll-web-token" | "gocardless-poll-web-token-stop" | "gocardless-status" | "simplefin-status" | "pluggyai-status" | "simplefin-accounts" | "pluggyai-accounts" | "gocardless-get-banks" | "gocardless-create-web-token" | "accounts-bank-sync" | "simplefin-batch-sync" | "transactions-import" | "account-unlink" | "payee-create" | "common-payees-get" | "payees-get" | "payees-get-orphaned" | "payees-get-rule-counts" | "payees-merge" | "payees-batch-change" | "payees-check-orphaned" | "payees-get-rules" | "get-cell" | "get-cell-names" | "create-query" | "sync-reset" | "sync-repair" | "validate-budget-name" | "unique-budget-name" | "get-budgets" | "get-remote-files" | "get-user-file-info" | "reset-budget-cache" | "upload-budget" | "download-budget" | "sync-budget" | "create-demo-budget" | "close-budget" | "delete-budget" | "duplicate-budget" | "create-budget" | "import-budget" | "export-budget" | "upload-file-web" | "backups-get" | "backup-load" | "backup-make" | "get-last-opened-backup" | "key-make" | "key-test" | "get-did-bootstrap" | "subscribe-needs-bootstrap" | "subscribe-bootstrap" | "subscribe-get-login-methods" | "subscribe-get-user" | "subscribe-change-password" | "subscribe-sign-in" | "subscribe-sign-out" | "subscribe-set-token" | "enable-openid" | "get-openid-config" | "enable-password">(name: Name, func: Handlers[Name]): void;
|
|
12
|
+
method<Name extends "sync" | "load-budget" | "undo" | "redo" | "make-filters-from-conditions" | "query" | "get-server-version" | "get-server-url" | "set-server-url" | "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/copy-single-month" | "budget/set-zero" | "budget/set-3month-avg" | "budget/set-6month-avg" | "budget/set-12month-avg" | "budget/set-n-month-avg" | "budget/check-templates" | "budget/apply-goal-template" | "budget/apply-multiple-templates" | "budget/overwrite-goal-template" | "budget/apply-single-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/reset-income-carryover" | "get-categories" | "get-budget-bounds" | "envelope-budget-month" | "tracking-budget-month" | "category-create" | "category-update" | "category-move" | "category-delete" | "get-category-groups" | "category-group-create" | "category-group-update" | "category-group-move" | "category-group-delete" | "must-category-transfer" | "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" | "save-global-prefs" | "load-global-prefs" | "save-prefs" | "load-prefs" | "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" | "transactions-batch-update" | "transaction-add" | "transaction-update" | "transaction-delete" | "transactions-parse-file" | "transactions-export" | "transactions-export-query" | "transactions-merge" | "get-earliest-transaction" | "users-get" | "user-delete-all" | "user-add" | "user-update" | "access-add" | "access-delete-all" | "access-get-available-users" | "transfer-ownership" | "owner-created" | "tools/fix-split-transactions" | "account-update" | "accounts-get" | "account-balance" | "account-properties" | "gocardless-accounts-link" | "simplefin-accounts-link" | "pluggyai-accounts-link" | "account-create" | "account-close" | "account-reopen" | "account-move" | "secret-set" | "secret-check" | "gocardless-poll-web-token" | "gocardless-poll-web-token-stop" | "gocardless-status" | "simplefin-status" | "pluggyai-status" | "simplefin-accounts" | "pluggyai-accounts" | "gocardless-get-banks" | "gocardless-create-web-token" | "accounts-bank-sync" | "simplefin-batch-sync" | "transactions-import" | "account-unlink" | "payee-create" | "common-payees-get" | "payees-get" | "payees-get-orphaned" | "payees-get-rule-counts" | "payees-merge" | "payees-batch-change" | "payees-check-orphaned" | "payees-get-rules" | "get-cell" | "get-cell-names" | "create-query" | "sync-reset" | "sync-repair" | "validate-budget-name" | "unique-budget-name" | "get-budgets" | "get-remote-files" | "get-user-file-info" | "reset-budget-cache" | "upload-budget" | "download-budget" | "sync-budget" | "create-demo-budget" | "close-budget" | "delete-budget" | "duplicate-budget" | "create-budget" | "import-budget" | "export-budget" | "upload-file-web" | "backups-get" | "backup-load" | "backup-make" | "get-last-opened-backup" | "key-make" | "key-test" | "get-did-bootstrap" | "subscribe-needs-bootstrap" | "subscribe-bootstrap" | "subscribe-get-login-methods" | "subscribe-get-user" | "subscribe-change-password" | "subscribe-sign-in" | "subscribe-sign-out" | "subscribe-set-token" | "enable-openid" | "get-openid-config" | "enable-password">(name: Name, func: Handlers[Name]): void;
|
|
13
13
|
service(func: () => () => void): void;
|
|
14
14
|
combine(...apps: any[]): void;
|
|
15
15
|
startServices(): void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ImportTransactionsOpts } from '@actual-app/api';
|
|
2
|
+
import type { ImportTransactionsResult } from '../server/accounts/app';
|
|
2
3
|
import type { APIAccountEntity, APICategoryEntity, APICategoryGroupEntity, APIFileEntity, APIPayeeEntity } from '../server/api-models';
|
|
3
4
|
import { BudgetFileHandlers } from '../server/budgetfiles/app';
|
|
4
5
|
import { type batchUpdateTransactions } from '../server/transactions';
|
|
@@ -64,13 +65,7 @@ export interface ApiHandlers {
|
|
|
64
65
|
transactions: any;
|
|
65
66
|
isPreview?: any;
|
|
66
67
|
opts?: ImportTransactionsOpts;
|
|
67
|
-
}) => Promise<
|
|
68
|
-
errors?: {
|
|
69
|
-
message: string;
|
|
70
|
-
}[];
|
|
71
|
-
added: any;
|
|
72
|
-
updated: any;
|
|
73
|
-
}>;
|
|
68
|
+
}) => Promise<ImportTransactionsResult>;
|
|
74
69
|
'api/transactions-add': (arg: {
|
|
75
70
|
accountId: any;
|
|
76
71
|
transactions: any;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a transaction object specifically for import operations.
|
|
3
|
+
* This type is used when importing transactions from external sources.
|
|
4
|
+
*/
|
|
5
|
+
export interface ImportTransactionEntity {
|
|
6
|
+
/** Required. The ID of the account this transaction belongs to */
|
|
7
|
+
account: string;
|
|
8
|
+
|
|
9
|
+
/** Required. Transaction date in YYYY-MM-DD format */
|
|
10
|
+
date: string;
|
|
11
|
+
|
|
12
|
+
/** A currency amount as an integer representing the value without decimal places.
|
|
13
|
+
* For example, USD amount of $120.30 would be 12030 */
|
|
14
|
+
amount?: number;
|
|
15
|
+
|
|
16
|
+
/** In a create/import request, this overrides payee_name.
|
|
17
|
+
* Should be an existing payee ID */
|
|
18
|
+
payee?: string;
|
|
19
|
+
|
|
20
|
+
/** If given, a payee will be created with this name.
|
|
21
|
+
* If this matches an already existing payee, that payee will be used.
|
|
22
|
+
* Only available in create/import requests */
|
|
23
|
+
payee_name?: string;
|
|
24
|
+
|
|
25
|
+
/** This can be anything. Meant to represent the raw description when importing,
|
|
26
|
+
* allowing the user to see the original value */
|
|
27
|
+
imported_payee?: string;
|
|
28
|
+
|
|
29
|
+
/** The ID of the category to assign to this transaction */
|
|
30
|
+
category?: string;
|
|
31
|
+
|
|
32
|
+
/** Any additional notes for the transaction */
|
|
33
|
+
notes?: string;
|
|
34
|
+
|
|
35
|
+
/** A unique id usually given by the bank, if importing.
|
|
36
|
+
* Use this to avoid duplicate transactions */
|
|
37
|
+
imported_id?: string;
|
|
38
|
+
|
|
39
|
+
/** If a transfer, the id of the corresponding transaction in the other account.
|
|
40
|
+
* You should not change this for existing transfers.
|
|
41
|
+
* Only set this when importing */
|
|
42
|
+
transfer_id?: string;
|
|
43
|
+
|
|
44
|
+
/** A flag indicating if the transaction has cleared or not */
|
|
45
|
+
cleared?: boolean;
|
|
46
|
+
|
|
47
|
+
/** An array of subtransactions for a split transaction.
|
|
48
|
+
* Only available in get or create/import requests.
|
|
49
|
+
* If amounts don't equal total amount, API call will succeed but error will show in app */
|
|
50
|
+
subtransactions?: Array<{
|
|
51
|
+
/** The only required field for subtransactions */
|
|
52
|
+
amount: number;
|
|
53
|
+
category?: string;
|
|
54
|
+
notes?: string;
|
|
55
|
+
}>;
|
|
56
|
+
}
|
package/@types/methods.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ImportTransactionEntity } from './loot-core/types/models/import-transaction';
|
|
1
2
|
export { q } from './app/query';
|
|
2
3
|
export declare function runImport(name: any, func: any): Promise<void>;
|
|
3
4
|
export declare function loadBudget(budgetId: any): Promise<void>;
|
|
@@ -39,12 +40,10 @@ export declare function addTransactions(accountId: any, transactions: any, { lea
|
|
|
39
40
|
export interface ImportTransactionsOpts {
|
|
40
41
|
defaultCleared?: boolean;
|
|
41
42
|
}
|
|
42
|
-
export declare function importTransactions(accountId:
|
|
43
|
-
errors
|
|
43
|
+
export declare function importTransactions(accountId: string, transactions: ImportTransactionEntity[], opts?: ImportTransactionsOpts): Promise<import("./@types/loot-core/server/accounts/sync").ReconcileTransactionsResult & {
|
|
44
|
+
errors: Array<{
|
|
44
45
|
message: string;
|
|
45
|
-
}
|
|
46
|
-
added: any;
|
|
47
|
-
updated: any;
|
|
46
|
+
}>;
|
|
48
47
|
}>;
|
|
49
48
|
export declare function getTransactions(accountId: any, startDate: any, endDate: any): Promise<import("./@types/loot-core/types/models").TransactionEntity[]>;
|
|
50
49
|
export declare function updateTransaction(id: any, fields: any): Promise<import("./@types/loot-core/types/models").TransactionEntity[] | ({
|
package/dist/app/bundle.api.js
CHANGED
|
@@ -10108,46 +10108,47 @@ Actual: ` + parser.attribValue);
|
|
|
10108
10108
|
}, "./node_modules/slash/index.js": module1 => {
|
|
10109
10109
|
"use strict";
|
|
10110
10110
|
module1.exports = path => { let isExtendedLengthPath = /^\\\\\?\\/.test(path), hasNonAscii = /[^\u0000-\u0080]+/.test(path); return isExtendedLengthPath || hasNonAscii ? path : path.replace(/\\/g, "/"); };
|
|
10111
|
-
}, "./node_modules/uuid/dist/esm
|
|
10111
|
+
}, "./node_modules/uuid/dist/esm/native.js": (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
10112
10112
|
"use strict";
|
|
10113
10113
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, { default: () => __WEBPACK_DEFAULT_EXPORT__ });
|
|
10114
|
-
|
|
10115
|
-
|
|
10116
|
-
}, "./node_modules/uuid/dist/esm-node/regex.js": (__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
10114
|
+
let __WEBPACK_DEFAULT_EXPORT__ = { randomUUID: __webpack_require__("crypto").randomUUID };
|
|
10115
|
+
}, "./node_modules/uuid/dist/esm/regex.js": (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
10117
10116
|
"use strict";
|
|
10118
10117
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, { default: () => __WEBPACK_DEFAULT_EXPORT__ });
|
|
10119
|
-
let __WEBPACK_DEFAULT_EXPORT__ = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-
|
|
10120
|
-
}, "./node_modules/uuid/dist/esm
|
|
10118
|
+
let __WEBPACK_DEFAULT_EXPORT__ = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
|
|
10119
|
+
}, "./node_modules/uuid/dist/esm/rng.js": (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
10121
10120
|
"use strict";
|
|
10122
10121
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, { default: () => rng });
|
|
10123
|
-
var crypto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("crypto")
|
|
10122
|
+
var crypto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("crypto");
|
|
10124
10123
|
let rnds8Pool = new Uint8Array(256), poolPtr = rnds8Pool.length;
|
|
10125
|
-
function rng() { return poolPtr > rnds8Pool.length - 16 && (
|
|
10126
|
-
}, "./node_modules/uuid/dist/esm
|
|
10124
|
+
function rng() { return poolPtr > rnds8Pool.length - 16 && ((0, crypto__WEBPACK_IMPORTED_MODULE_0__.randomFillSync)(rnds8Pool), poolPtr = 0), rnds8Pool.slice(poolPtr, poolPtr += 16); }
|
|
10125
|
+
}, "./node_modules/uuid/dist/esm/stringify.js": (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
10127
10126
|
"use strict";
|
|
10128
10127
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, { default: () => __WEBPACK_DEFAULT_EXPORT__, unsafeStringify: () => unsafeStringify });
|
|
10129
|
-
var _validate_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./node_modules/uuid/dist/esm
|
|
10128
|
+
var _validate_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./node_modules/uuid/dist/esm/validate.js");
|
|
10130
10129
|
let byteToHex = [];
|
|
10131
10130
|
for (let i1 = 0; i1 < 256; ++i1)
|
|
10132
10131
|
byteToHex.push((i1 + 256).toString(16).slice(1));
|
|
10133
|
-
function unsafeStringify(arr, offset = 0) { return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]; }
|
|
10132
|
+
function unsafeStringify(arr, offset = 0) { return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); }
|
|
10134
10133
|
let __WEBPACK_DEFAULT_EXPORT__ = function (arr, offset = 0) { let uuid = unsafeStringify(arr, offset); if (!(0, _validate_js__WEBPACK_IMPORTED_MODULE_0__.default)(uuid))
|
|
10135
10134
|
throw TypeError("Stringified UUID is invalid"); return uuid; };
|
|
10136
|
-
}, "./node_modules/uuid/dist/esm
|
|
10135
|
+
}, "./node_modules/uuid/dist/esm/v4.js": (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
10137
10136
|
"use strict";
|
|
10138
10137
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, { default: () => __WEBPACK_DEFAULT_EXPORT__ });
|
|
10139
|
-
var _native_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./node_modules/uuid/dist/esm
|
|
10138
|
+
var _native_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./node_modules/uuid/dist/esm/native.js"), _rng_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./node_modules/uuid/dist/esm/rng.js"), _stringify_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./node_modules/uuid/dist/esm/stringify.js");
|
|
10140
10139
|
let __WEBPACK_DEFAULT_EXPORT__ = function (options, buf, offset) { if (_native_js__WEBPACK_IMPORTED_MODULE_0__.default.randomUUID && !buf && !options)
|
|
10141
|
-
return _native_js__WEBPACK_IMPORTED_MODULE_0__.default.randomUUID(); let rnds = (options = options || {}).random
|
|
10142
|
-
|
|
10140
|
+
return _native_js__WEBPACK_IMPORTED_MODULE_0__.default.randomUUID(); let rnds = (options = options || {}).random ?? options.rng?.() ?? (0, _rng_js__WEBPACK_IMPORTED_MODULE_1__.default)(); if (rnds.length < 16)
|
|
10141
|
+
throw Error("Random bytes length must be >= 16"); if (rnds[6] = 15 & rnds[6] | 64, rnds[8] = 63 & rnds[8] | 128, buf) {
|
|
10142
|
+
if ((offset = offset || 0) < 0 || offset + 16 > buf.length)
|
|
10143
|
+
throw RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
|
|
10143
10144
|
for (let i1 = 0; i1 < 16; ++i1)
|
|
10144
10145
|
buf[offset + i1] = rnds[i1];
|
|
10145
10146
|
return buf;
|
|
10146
10147
|
} return (0, _stringify_js__WEBPACK_IMPORTED_MODULE_2__.unsafeStringify)(rnds); };
|
|
10147
|
-
}, "./node_modules/uuid/dist/esm
|
|
10148
|
+
}, "./node_modules/uuid/dist/esm/validate.js": (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
10148
10149
|
"use strict";
|
|
10149
10150
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, { default: () => __WEBPACK_DEFAULT_EXPORT__ });
|
|
10150
|
-
var _regex_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./node_modules/uuid/dist/esm
|
|
10151
|
+
var _regex_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./node_modules/uuid/dist/esm/regex.js");
|
|
10151
10152
|
let __WEBPACK_DEFAULT_EXPORT__ = function (uuid) { return "string" == typeof uuid && _regex_js__WEBPACK_IMPORTED_MODULE_0__.default.test(uuid); };
|
|
10152
10153
|
}, "./node_modules/which-boxed-primitive/index.js": (module1, __unused_webpack_exports, __webpack_require__) => {
|
|
10153
10154
|
"use strict";
|
|
@@ -10815,7 +10816,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
10815
10816
|
}, "./packages/loot-core/migrations/1722804019000_create_dashboard_table.js": (__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
10816
10817
|
"use strict";
|
|
10817
10818
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, { default: () => runMigration });
|
|
10818
|
-
var uuid__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./node_modules/uuid/dist/esm
|
|
10819
|
+
var uuid__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./node_modules/uuid/dist/esm/v4.js");
|
|
10819
10820
|
async function runMigration(db) {
|
|
10820
10821
|
db.transaction(() => {
|
|
10821
10822
|
db.execQuery(`
|
|
@@ -10858,7 +10859,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
10858
10859
|
}, "./packages/loot-core/src/mocks/budget.ts": (__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
10859
10860
|
"use strict";
|
|
10860
10861
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, { createTestBudget: () => createTestBudget });
|
|
10861
|
-
var uuid__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__("./node_modules/uuid/dist/esm
|
|
10862
|
+
var uuid__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__("./node_modules/uuid/dist/esm/v4.js"), _server_accounts_sync__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./packages/loot-core/src/server/accounts/sync.ts"), _server_aql__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./packages/loot-core/src/server/aql/index.ts"), _server_budget_actions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./packages/loot-core/src/server/budget/actions.ts"), _server_budget_base__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./packages/loot-core/src/server/budget/base.ts"), _server_db__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("./packages/loot-core/src/server/db/index.ts"), _server_mutators__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("./packages/loot-core/src/server/mutators.ts"), _server_sheet__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("./packages/loot-core/src/server/sheet.ts"), _server_sync__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("./packages/loot-core/src/server/sync/index.ts"), _shared_months__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("./packages/loot-core/src/shared/months.ts"), _shared_query__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__("./packages/loot-core/src/shared/query.ts"), _random__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__("./packages/loot-core/src/mocks/random.ts");
|
|
10862
10863
|
function pickRandom(list) { return list[Math.floor((0, _random__WEBPACK_IMPORTED_MODULE_10__.random)() * list.length) % list.length]; }
|
|
10863
10864
|
function integer(start, end) { return Math.round(start + (end - start) * (0, _random__WEBPACK_IMPORTED_MODULE_10__.random)()); }
|
|
10864
10865
|
function getStartingBalanceCat(categories) { return categories.find(c => "Starting Balances" === c.name).id; }
|
|
@@ -11012,7 +11013,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
11012
11013
|
}, "./packages/loot-core/src/platform/server/sqlite/index.electron.ts": (__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
11013
11014
|
"use strict";
|
|
11014
11015
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, { asyncTransaction: () => asyncTransaction, closeDatabase: () => closeDatabase, execQuery: () => execQuery, exportDatabase: () => exportDatabase, init: () => init, openDatabase: () => openDatabase, prepare: () => prepare, runQuery: () => runQuery, transaction: () => transaction });
|
|
11015
|
-
var better_sqlite3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("better-sqlite3"), better_sqlite3__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(better_sqlite3__WEBPACK_IMPORTED_MODULE_0__), uuid__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("./node_modules/uuid/dist/esm
|
|
11016
|
+
var better_sqlite3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("better-sqlite3"), better_sqlite3__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(better_sqlite3__WEBPACK_IMPORTED_MODULE_0__), uuid__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("./node_modules/uuid/dist/esm/v4.js"), _fs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./packages/loot-core/src/platform/server/fs/index.electron.ts"), _normalise__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./packages/loot-core/src/platform/server/sqlite/normalise.ts"), _unicodeLike__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./packages/loot-core/src/platform/server/sqlite/unicodeLike.ts");
|
|
11016
11017
|
async function init() { }
|
|
11017
11018
|
function prepare(db, sql) { return db.prepare(sql); }
|
|
11018
11019
|
function runQuery(db, sql, params = [], fetchAll = !1) { let stmt; params && params.forEach(val1 => { if ("string" != typeof val1 && "number" != typeof val1 && null !== val1)
|
|
@@ -11061,7 +11062,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
11061
11062
|
}, "./packages/loot-core/src/server/accounts/app.ts": (__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
11062
11063
|
"use strict";
|
|
11063
11064
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, { app: () => app });
|
|
11064
|
-
var i18next__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./node_modules/i18next/dist/esm/i18next.js"), uuid__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__("./node_modules/uuid/dist/esm
|
|
11065
|
+
var i18next__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./node_modules/i18next/dist/esm/i18next.js"), uuid__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__("./node_modules/uuid/dist/esm/v4.js"), _platform_exceptions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./packages/loot-core/src/platform/exceptions/index.ts"), _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./packages/loot-core/src/platform/server/asyncStorage/index.electron.ts"), _platform_server_connection__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./packages/loot-core/src/platform/server/connection/index.api.ts"), _shared_environment__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("./packages/loot-core/src/shared/environment.ts"), _shared_months__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("./packages/loot-core/src/shared/months.ts"), _shared_util__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("./packages/loot-core/src/shared/util.ts"), _app__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("./packages/loot-core/src/server/app.ts"), _db__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("./packages/loot-core/src/server/db/index.ts"), _errors__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__("./packages/loot-core/src/server/errors.ts"), _main_app__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__("./packages/loot-core/src/server/main-app.ts"), _mutators__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__("./packages/loot-core/src/server/mutators.ts"), _post__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__("./packages/loot-core/src/server/post.ts"), _server_config__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__("./packages/loot-core/src/server/server-config.ts"), _sync__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__("./packages/loot-core/src/server/sync/index.ts"), _undo__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__("./packages/loot-core/src/server/undo.ts"), _link__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__("./packages/loot-core/src/server/accounts/link.ts"), _payees__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__("./packages/loot-core/src/server/accounts/payees.ts"), _sync__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__("./packages/loot-core/src/server/accounts/sync.ts");
|
|
11065
11066
|
async function updateAccount({ id, name, last_reconciled }) { return await _db__WEBPACK_IMPORTED_MODULE_8__.update("accounts", { id, name, ...last_reconciled && { last_reconciled } }), {}; }
|
|
11066
11067
|
async function getAccounts() { return _db__WEBPACK_IMPORTED_MODULE_8__.getAccounts(); }
|
|
11067
11068
|
async function getAccountBalance({ id, cutoff }) { let result = await _db__WEBPACK_IMPORTED_MODULE_8__.first("SELECT sum(amount) as balance FROM transactions WHERE acct = ? AND isParent = 0 AND tombstone = 0 AND date <= ?", [id, _db__WEBPACK_IMPORTED_MODULE_8__.toDateRepr((0, _shared_months__WEBPACK_IMPORTED_MODULE_5__.dayFromDate)(cutoff))]); return result?.balance ? result.balance : 0; }
|
|
@@ -11271,7 +11272,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
11271
11272
|
}, "./packages/loot-core/src/server/accounts/link.ts": (__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
11272
11273
|
"use strict";
|
|
11273
11274
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, { findOrCreateBank: () => findOrCreateBank });
|
|
11274
|
-
var uuid__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./node_modules/uuid/dist/esm
|
|
11275
|
+
var uuid__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./node_modules/uuid/dist/esm/v4.js"), _db__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./packages/loot-core/src/server/db/index.ts");
|
|
11275
11276
|
async function findOrCreateBank(institution, requisitionId) { let bank = await _db__WEBPACK_IMPORTED_MODULE_0__.first("SELECT id, bank_id FROM banks WHERE bank_id = ?", [requisitionId]); if (bank)
|
|
11276
11277
|
return bank; let bankData = { id: (0, uuid__WEBPACK_IMPORTED_MODULE_1__.default)(), bank_id: requisitionId, name: institution.name }; return await _db__WEBPACK_IMPORTED_MODULE_0__.insertWithUUID("banks", bankData), bankData; }
|
|
11277
11278
|
}, "./packages/loot-core/src/server/accounts/payees.ts": (__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
@@ -11291,7 +11292,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
11291
11292
|
}, "./packages/loot-core/src/server/accounts/sync.ts": (__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
11292
11293
|
"use strict";
|
|
11293
11294
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, { addTransactions: () => addTransactions, getGoCardlessAccounts: () => getGoCardlessAccounts, matchTransactions: () => matchTransactions, reconcileTransactions: () => reconcileTransactions, simpleFinBatchSync: () => simpleFinBatchSync, syncAccount: () => syncAccount });
|
|
11294
|
-
var date_fns__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__("./node_modules/date-fns/max.js"), date_fns__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__("./node_modules/date-fns/differenceInMilliseconds.js"), date_fns__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__("./node_modules/date-fns/parseISO.js"), uuid__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__("./node_modules/uuid/dist/esm
|
|
11295
|
+
var date_fns__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__("./node_modules/date-fns/max.js"), date_fns__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__("./node_modules/date-fns/differenceInMilliseconds.js"), date_fns__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__("./node_modules/date-fns/parseISO.js"), uuid__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__("./node_modules/uuid/dist/esm/v4.js"), _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./packages/loot-core/src/platform/server/asyncStorage/index.electron.ts"), _shared_months__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./packages/loot-core/src/shared/months.ts"), _shared_query__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./packages/loot-core/src/shared/query.ts"), _shared_transactions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./packages/loot-core/src/shared/transactions.ts"), _shared_util__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("./packages/loot-core/src/shared/util.ts"), _aql__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("./packages/loot-core/src/server/aql/index.ts"), _db__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("./packages/loot-core/src/server/db/index.ts"), _mutators__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("./packages/loot-core/src/server/mutators.ts"), _post__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("./packages/loot-core/src/server/post.ts"), _server_config__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__("./packages/loot-core/src/server/server-config.ts"), _sync__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__("./packages/loot-core/src/server/sync/index.ts"), _transactions__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__("./packages/loot-core/src/server/transactions/index.ts"), _transactions_transaction_rules__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__("./packages/loot-core/src/server/transactions/transaction-rules.ts"), _util_custom_sync_mapping__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__("./packages/loot-core/src/server/util/custom-sync-mapping.ts"), _payees__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__("./packages/loot-core/src/server/accounts/payees.ts"), _title__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__("./packages/loot-core/src/server/accounts/title/index.ts");
|
|
11295
11296
|
function BankSyncError(type, code, details) { return { type: "BankSyncError", category: type, code, details }; }
|
|
11296
11297
|
function makeSplitTransaction(trans, subtransactions) { let { subtransactions: sub, ...parent } = (0, _shared_transactions__WEBPACK_IMPORTED_MODULE_3__.recalculateSplit)({ ...trans, is_parent: !0, subtransactions: subtransactions.map((transaction, idx) => (0, _shared_transactions__WEBPACK_IMPORTED_MODULE_3__.makeChild)(trans, { ...transaction, sort_order: 0 - idx })) }); return [parent, ...sub]; }
|
|
11297
11298
|
async function updateAccountBalance(id, balance) { await _db__WEBPACK_IMPORTED_MODULE_6__.runQuery("UPDATE accounts SET balance_current = ? WHERE id = ?", [(0, _shared_util__WEBPACK_IMPORTED_MODULE_4__.amountToInteger)(balance), id]); }
|
|
@@ -12391,7 +12392,7 @@ Expression stack:` + stackStr, error;
|
|
|
12391
12392
|
app.method("get-did-bootstrap", didBootstrap), app.method("subscribe-needs-bootstrap", needsBootstrap), app.method("subscribe-bootstrap", bootstrap), app.method("subscribe-get-login-methods", getLoginMethods), app.method("subscribe-get-user", getUser), app.method("subscribe-change-password", changePassword), app.method("subscribe-sign-in", signIn), app.method("subscribe-sign-out", signOut), app.method("subscribe-set-token", setToken), app.method("enable-openid", enableOpenId), app.method("get-openid-config", getOpenIdConfig), app.method("enable-password", enablePassword);
|
|
12392
12393
|
}, "./packages/loot-core/src/server/budget/actions.ts": (__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
12393
12394
|
"use strict";
|
|
12394
|
-
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, { copyPreviousMonth: () => copyPreviousMonth, copySinglePreviousMonth: () => copySinglePreviousMonth, coverOverbudgeted: () => coverOverbudgeted, coverOverspending: () => coverOverspending, getBudget: () => getBudget, getSheetBoolean: () => getSheetBoolean, getSheetValue: () => getSheetValue, holdForNextMonth: () => holdForNextMonth, isReflectBudget: () => isReflectBudget, resetHold: () => resetHold, set12MonthAvg: () => set12MonthAvg, set3MonthAvg: () => set3MonthAvg, set6MonthAvg: () => set6MonthAvg, setBudget: () => setBudget, setBuffer: () => setBuffer, setCategoryCarryover: () => setCategoryCarryover, setGoal: () => setGoal, setNMonthAvg: () => setNMonthAvg, setZero: () => setZero, transferAvailable: () => transferAvailable, transferCategory: () => transferCategory });
|
|
12395
|
+
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, { copyPreviousMonth: () => copyPreviousMonth, copySinglePreviousMonth: () => copySinglePreviousMonth, coverOverbudgeted: () => coverOverbudgeted, coverOverspending: () => coverOverspending, getBudget: () => getBudget, getSheetBoolean: () => getSheetBoolean, getSheetValue: () => getSheetValue, holdForNextMonth: () => holdForNextMonth, isReflectBudget: () => isReflectBudget, resetHold: () => resetHold, resetIncomeCarryover: () => resetIncomeCarryover, set12MonthAvg: () => set12MonthAvg, set3MonthAvg: () => set3MonthAvg, set6MonthAvg: () => set6MonthAvg, setBudget: () => setBudget, setBuffer: () => setBuffer, setCategoryCarryover: () => setCategoryCarryover, setGoal: () => setGoal, setNMonthAvg: () => setNMonthAvg, setZero: () => setZero, transferAvailable: () => transferAvailable, transferCategory: () => transferCategory });
|
|
12395
12396
|
var _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./packages/loot-core/src/platform/server/asyncStorage/index.electron.ts"), _shared_locale__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./packages/loot-core/src/shared/locale.ts"), _shared_months__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./packages/loot-core/src/shared/months.ts"), _shared_util__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./packages/loot-core/src/shared/util.ts"), _db__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("./packages/loot-core/src/server/db/index.ts"), _sheet__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("./packages/loot-core/src/server/sheet.ts"), _sync__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("./packages/loot-core/src/server/sync/index.ts");
|
|
12396
12397
|
async function getSheetValue(sheetName, cell) { let node = await _sheet__WEBPACK_IMPORTED_MODULE_5__.getCell(sheetName, cell); return (0, _shared_util__WEBPACK_IMPORTED_MODULE_3__.safeNumber)("number" == typeof node.value ? node.value : 0); }
|
|
12397
12398
|
async function getSheetBoolean(sheetName, cell) { let node = await _sheet__WEBPACK_IMPORTED_MODULE_5__.getCell(sheetName, cell); return "boolean" == typeof node.value && node.value; }
|
|
@@ -12402,6 +12403,7 @@ Expression stack:` + stackStr, error;
|
|
|
12402
12403
|
function setBudget({ category, month, amount }) { amount = (0, _shared_util__WEBPACK_IMPORTED_MODULE_3__.safeNumber)("number" == typeof amount ? amount : 0); let table = getBudgetTable(), existing = _db__WEBPACK_IMPORTED_MODULE_4__.firstSync(`SELECT id FROM ${table} WHERE month = ? AND category = ?`, [dbMonth(month), category]); return existing ? _db__WEBPACK_IMPORTED_MODULE_4__.update(table, { id: existing.id, amount }) : _db__WEBPACK_IMPORTED_MODULE_4__.insert(table, { id: `${dbMonth(month)}-${category}`, month: dbMonth(month), category, amount }); }
|
|
12403
12404
|
function setGoal({ month, category, goal, long_goal }) { let table = getBudgetTable(), existing = _db__WEBPACK_IMPORTED_MODULE_4__.firstSync(`SELECT id FROM ${table} WHERE month = ? AND category = ?`, [dbMonth(month), category]); return existing ? _db__WEBPACK_IMPORTED_MODULE_4__.update(table, { id: existing.id, goal, long_goal }) : _db__WEBPACK_IMPORTED_MODULE_4__.insert(table, { id: `${dbMonth(month)}-${category}`, month: dbMonth(month), category, goal, long_goal }); }
|
|
12404
12405
|
function setBuffer(month, amount) { let existing = _db__WEBPACK_IMPORTED_MODULE_4__.firstSync("SELECT id FROM zero_budget_months WHERE id = ?", [month]); return existing ? _db__WEBPACK_IMPORTED_MODULE_4__.update("zero_budget_months", { id: existing.id, buffered: amount }) : _db__WEBPACK_IMPORTED_MODULE_4__.insert("zero_budget_months", { id: month, buffered: amount }); }
|
|
12406
|
+
function setCarryover(table, category, month, flag) { let existing = _db__WEBPACK_IMPORTED_MODULE_4__.firstSync(`SELECT id FROM ${table} WHERE month = ? AND category = ?`, [month, category]); return existing ? _db__WEBPACK_IMPORTED_MODULE_4__.update(table, { id: existing.id, carryover: +!!flag }) : _db__WEBPACK_IMPORTED_MODULE_4__.insert(table, { id: `${month}-${category}`, month, category, carryover: +!!flag }); }
|
|
12405
12407
|
async function copyPreviousMonth({ month }) {
|
|
12406
12408
|
var month1;
|
|
12407
12409
|
let prevMonth = dbMonth(_shared_months__WEBPACK_IMPORTED_MODULE_2__.prevMonth(month)), table = getBudgetTable(), budgetData = await (month1 = prevMonth.toString(), _db__WEBPACK_IMPORTED_MODULE_4__.all(`
|
|
@@ -12443,17 +12445,16 @@ Expression stack:` + stackStr, error;
|
|
|
12443
12445
|
await setBudget({ category: to, month, amount: toBudgeted + amount });
|
|
12444
12446
|
} await addMovementNotes({ month, amount, to, from }); }); }
|
|
12445
12447
|
async function setCategoryCarryover({ startMonth, category, flag }) { let table = getBudgetTable(), months = function (startMonth) { let { createdMonths } = _sheet__WEBPACK_IMPORTED_MODULE_5__.get().meta(), latest = null; for (let month of createdMonths)
|
|
12446
|
-
(null == latest || month > latest) && (latest = month); return _shared_months__WEBPACK_IMPORTED_MODULE_2__.rangeInclusive(startMonth, latest); }(startMonth); await (0, _sync__WEBPACK_IMPORTED_MODULE_6__.batchMessages)(async () => { for (let
|
|
12447
|
-
|
|
12448
|
-
let existing = _db__WEBPACK_IMPORTED_MODULE_4__.firstSync(`SELECT id FROM ${table1} WHERE month = ? AND category = ?`, [month, category1]);
|
|
12449
|
-
existing ? _db__WEBPACK_IMPORTED_MODULE_4__.update(table1, { id: existing.id, carryover: +!!flag1 }) : _db__WEBPACK_IMPORTED_MODULE_4__.insert(table1, { id: `${month}-${category1}`, month, category: category1, carryover: +!!flag1 });
|
|
12450
|
-
} }); }
|
|
12448
|
+
(null == latest || month > latest) && (latest = month); return _shared_months__WEBPACK_IMPORTED_MODULE_2__.rangeInclusive(startMonth, latest); }(startMonth); await (0, _sync__WEBPACK_IMPORTED_MODULE_6__.batchMessages)(async () => { for (let month of months)
|
|
12449
|
+
setCarryover(table, category, dbMonth(month).toString(), flag); }); }
|
|
12451
12450
|
async function addMovementNotes({ month, amount, to, from }) {
|
|
12452
12451
|
var notes;
|
|
12453
12452
|
let displayAmount = (0, _shared_util__WEBPACK_IMPORTED_MODULE_3__.integerToCurrency)(amount), monthBudgetNotesId = `budget-${month}`, existingMonthBudgetNotes = (notes = _db__WEBPACK_IMPORTED_MODULE_4__.firstSync("SELECT n.note FROM notes n WHERE n.id = ?", [monthBudgetNotesId])?.note) ? `${notes}${notes && `
|
|
12454
12453
|
`}` : "", locale = (0, _shared_locale__WEBPACK_IMPORTED_MODULE_1__.getLocale)(await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_0__.getItem("language")), displayDay = _shared_months__WEBPACK_IMPORTED_MODULE_2__.format(_shared_months__WEBPACK_IMPORTED_MODULE_2__.currentDate(), "MMMM dd", locale), categories = await _db__WEBPACK_IMPORTED_MODULE_4__.getCategories([from, to].filter(c => "to-budget" !== c && "overbudgeted" !== c)), fromCategoryName = "to-budget" === from ? "To Budget" : categories.find(c => c.id === from)?.name, toCategoryName = "to-budget" === to ? "To Budget" : "overbudgeted" === to ? "Overbudgeted" : categories.find(c => c.id === to)?.name, note = `Reassigned ${displayAmount} from ${fromCategoryName} → ${toCategoryName} on ${displayDay}`;
|
|
12455
12454
|
await _db__WEBPACK_IMPORTED_MODULE_4__.update("notes", { id: monthBudgetNotesId, note: `${existingMonthBudgetNotes}- ${note}` });
|
|
12456
12455
|
}
|
|
12456
|
+
async function resetIncomeCarryover({ month }) { let table = getBudgetTable(), categories = await _db__WEBPACK_IMPORTED_MODULE_4__.all("SELECT * FROM v_categories WHERE is_income = 1 AND tombstone = 0"); await (0, _sync__WEBPACK_IMPORTED_MODULE_6__.batchMessages)(async () => { for (let category of categories)
|
|
12457
|
+
await setCarryover(table, category.id, dbMonth(month).toString(), !1); }); }
|
|
12457
12458
|
}, "./packages/loot-core/src/server/budget/app.ts": (__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
12458
12459
|
"use strict";
|
|
12459
12460
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, { app: () => app });
|
|
@@ -12507,7 +12508,7 @@ Expression stack:` + stackStr, error;
|
|
|
12507
12508
|
LEFT JOIN category_mapping cm ON cm.id = t.category
|
|
12508
12509
|
WHERE cm.transferId = ? AND t.tombstone = 0`, [id], !0))[0].count || [..._sheet__WEBPACK_IMPORTED_MODULE_8__.get().meta().createdMonths].some(month => { let sheetName = _shared_months__WEBPACK_IMPORTED_MODULE_0__.sheetForMonth(month), value = _sheet__WEBPACK_IMPORTED_MODULE_8__.get().getCellValue(sheetName, "budget-" + id); return null != value && 0 !== value; });
|
|
12509
12510
|
}
|
|
12510
|
-
app.method("budget/budget-amount", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_actions__WEBPACK_IMPORTED_MODULE_12__.setBudget))), app.method("budget/copy-previous-month", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_actions__WEBPACK_IMPORTED_MODULE_12__.copyPreviousMonth))), app.method("budget/copy-single-month", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_actions__WEBPACK_IMPORTED_MODULE_12__.copySinglePreviousMonth))), app.method("budget/set-zero", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_actions__WEBPACK_IMPORTED_MODULE_12__.setZero))), app.method("budget/set-3month-avg", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_actions__WEBPACK_IMPORTED_MODULE_12__.set3MonthAvg))), app.method("budget/set-6month-avg", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_actions__WEBPACK_IMPORTED_MODULE_12__.set6MonthAvg))), app.method("budget/set-12month-avg", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_actions__WEBPACK_IMPORTED_MODULE_12__.set12MonthAvg))), app.method("budget/set-n-month-avg", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_actions__WEBPACK_IMPORTED_MODULE_12__.setNMonthAvg))), app.method("budget/check-templates", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_goal_template__WEBPACK_IMPORTED_MODULE_15__.runCheckTemplates))), app.method("budget/apply-goal-template", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_goal_template__WEBPACK_IMPORTED_MODULE_15__.applyTemplate))), app.method("budget/apply-multiple-templates", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_goal_template__WEBPACK_IMPORTED_MODULE_15__.applyMultipleCategoryTemplates))), app.method("budget/overwrite-goal-template", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_goal_template__WEBPACK_IMPORTED_MODULE_15__.overwriteTemplate))), app.method("budget/apply-single-template", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_goal_template__WEBPACK_IMPORTED_MODULE_15__.applySingleCategoryTemplate))), app.method("budget/cleanup-goal-template", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_cleanup_template__WEBPACK_IMPORTED_MODULE_14__.cleanupTemplate))), app.method("budget/hold-for-next-month", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_actions__WEBPACK_IMPORTED_MODULE_12__.holdForNextMonth))), app.method("budget/reset-hold", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_actions__WEBPACK_IMPORTED_MODULE_12__.resetHold))), app.method("budget/cover-overspending", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_actions__WEBPACK_IMPORTED_MODULE_12__.coverOverspending))), app.method("budget/transfer-available", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_actions__WEBPACK_IMPORTED_MODULE_12__.transferAvailable))), app.method("budget/cover-overbudgeted", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_actions__WEBPACK_IMPORTED_MODULE_12__.coverOverbudgeted))), app.method("budget/transfer-category", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_actions__WEBPACK_IMPORTED_MODULE_12__.transferCategory))), app.method("budget/set-carryover", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_actions__WEBPACK_IMPORTED_MODULE_12__.setCategoryCarryover))), app.method("get-categories", getCategories), app.method("get-budget-bounds", getBudgetBounds), app.method("envelope-budget-month", envelopeBudgetMonth), app.method("tracking-budget-month", trackingBudgetMonth), app.method("category-create", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(createCategory))), app.method("category-update", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(updateCategory))), app.method("category-move", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(moveCategory))), app.method("category-delete", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(deleteCategory))), app.method("get-category-groups", getCategoryGroups), app.method("category-group-create", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(createCategoryGroup))), app.method("category-group-update", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(updateCategoryGroup))), app.method("category-group-move", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(moveCategoryGroup))), app.method("category-group-delete", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(deleteCategoryGroup))), app.method("must-category-transfer", isCategoryTransferRequired);
|
|
12511
|
+
app.method("budget/budget-amount", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_actions__WEBPACK_IMPORTED_MODULE_12__.setBudget))), app.method("budget/copy-previous-month", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_actions__WEBPACK_IMPORTED_MODULE_12__.copyPreviousMonth))), app.method("budget/copy-single-month", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_actions__WEBPACK_IMPORTED_MODULE_12__.copySinglePreviousMonth))), app.method("budget/set-zero", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_actions__WEBPACK_IMPORTED_MODULE_12__.setZero))), app.method("budget/set-3month-avg", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_actions__WEBPACK_IMPORTED_MODULE_12__.set3MonthAvg))), app.method("budget/set-6month-avg", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_actions__WEBPACK_IMPORTED_MODULE_12__.set6MonthAvg))), app.method("budget/set-12month-avg", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_actions__WEBPACK_IMPORTED_MODULE_12__.set12MonthAvg))), app.method("budget/set-n-month-avg", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_actions__WEBPACK_IMPORTED_MODULE_12__.setNMonthAvg))), app.method("budget/check-templates", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_goal_template__WEBPACK_IMPORTED_MODULE_15__.runCheckTemplates))), app.method("budget/apply-goal-template", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_goal_template__WEBPACK_IMPORTED_MODULE_15__.applyTemplate))), app.method("budget/apply-multiple-templates", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_goal_template__WEBPACK_IMPORTED_MODULE_15__.applyMultipleCategoryTemplates))), app.method("budget/overwrite-goal-template", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_goal_template__WEBPACK_IMPORTED_MODULE_15__.overwriteTemplate))), app.method("budget/apply-single-template", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_goal_template__WEBPACK_IMPORTED_MODULE_15__.applySingleCategoryTemplate))), app.method("budget/cleanup-goal-template", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_cleanup_template__WEBPACK_IMPORTED_MODULE_14__.cleanupTemplate))), app.method("budget/hold-for-next-month", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_actions__WEBPACK_IMPORTED_MODULE_12__.holdForNextMonth))), app.method("budget/reset-hold", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_actions__WEBPACK_IMPORTED_MODULE_12__.resetHold))), app.method("budget/cover-overspending", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_actions__WEBPACK_IMPORTED_MODULE_12__.coverOverspending))), app.method("budget/transfer-available", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_actions__WEBPACK_IMPORTED_MODULE_12__.transferAvailable))), app.method("budget/cover-overbudgeted", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_actions__WEBPACK_IMPORTED_MODULE_12__.coverOverbudgeted))), app.method("budget/transfer-category", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_actions__WEBPACK_IMPORTED_MODULE_12__.transferCategory))), app.method("budget/set-carryover", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_actions__WEBPACK_IMPORTED_MODULE_12__.setCategoryCarryover))), app.method("budget/reset-income-carryover", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(_actions__WEBPACK_IMPORTED_MODULE_12__.resetIncomeCarryover))), app.method("get-categories", getCategories), app.method("get-budget-bounds", getBudgetBounds), app.method("envelope-budget-month", envelopeBudgetMonth), app.method("tracking-budget-month", trackingBudgetMonth), app.method("category-create", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(createCategory))), app.method("category-update", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(updateCategory))), app.method("category-move", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(moveCategory))), app.method("category-delete", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(deleteCategory))), app.method("get-category-groups", getCategoryGroups), app.method("category-group-create", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(createCategoryGroup))), app.method("category-group-update", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(updateCategoryGroup))), app.method("category-group-move", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(moveCategoryGroup))), app.method("category-group-delete", (0, _mutators__WEBPACK_IMPORTED_MODULE_7__.mutator)((0, _undo__WEBPACK_IMPORTED_MODULE_11__.undoable)(deleteCategoryGroup))), app.method("must-category-transfer", isCategoryTransferRequired);
|
|
12511
12512
|
}, "./packages/loot-core/src/server/budget/base.ts": (__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
12512
12513
|
"use strict";
|
|
12513
12514
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, { createAllBudgets: () => createAllBudgets, createBudget: () => createBudget, createCategory: () => createCategory, doTransfer: () => doTransfer, getBudgetRange: () => getBudgetRange, getBudgetType: () => getBudgetType, setType: () => setType, triggerBudgetChanges: () => triggerBudgetChanges });
|
|
@@ -12899,7 +12900,7 @@ Expression stack:` + stackStr, error;
|
|
|
12899
12900
|
} }
|
|
12900
12901
|
function createCategory(cat, sheetName, prevSheetName) { cat.is_income || (_sheet__WEBPACK_IMPORTED_MODULE_3__.get().createStatic(sheetName, `budget-${cat.id}`, 0), null == _sheet__WEBPACK_IMPORTED_MODULE_3__.get().getCellValue(sheetName, `budget-${cat.id}`) && _sheet__WEBPACK_IMPORTED_MODULE_3__.get().set((0, _spreadsheet_util__WEBPACK_IMPORTED_MODULE_4__.resolveName)(sheetName, `budget-${cat.id}`), 0), _sheet__WEBPACK_IMPORTED_MODULE_3__.get().createStatic(sheetName, `carryover-${cat.id}`, !1), _sheet__WEBPACK_IMPORTED_MODULE_3__.get().createDynamic(sheetName, `leftover-${cat.id}`, { initialValue: 0, dependencies: [`budget-${cat.id}`, `sum-amount-${cat.id}`, `${prevSheetName}!carryover-${cat.id}`, `${prevSheetName}!leftover-${cat.id}`, `${prevSheetName}!leftover-pos-${cat.id}`], run: (budgeted, spent, prevCarryover, prevLeftover, prevLeftoverPos) => (0, _shared_util__WEBPACK_IMPORTED_MODULE_1__.safeNumber)((0, _util__WEBPACK_IMPORTED_MODULE_6__.number)(budgeted) + (0, _util__WEBPACK_IMPORTED_MODULE_6__.number)(spent) + (prevCarryover ? (0, _util__WEBPACK_IMPORTED_MODULE_6__.number)(prevLeftover) : (0, _util__WEBPACK_IMPORTED_MODULE_6__.number)(prevLeftoverPos))) }), _sheet__WEBPACK_IMPORTED_MODULE_3__.get().createDynamic(sheetName, "leftover-pos-" + cat.id, { initialValue: 0, dependencies: [`leftover-${cat.id}`], run: leftover => leftover < 0 ? 0 : leftover })); }
|
|
12901
12902
|
function createCategoryGroup(group, sheetName) { _sheet__WEBPACK_IMPORTED_MODULE_3__.get().createDynamic(sheetName, "group-sum-amount-" + group.id, { initialValue: 0, dependencies: group.categories.map(cat => `sum-amount-${cat.id}`), run: _util__WEBPACK_IMPORTED_MODULE_6__.sumAmounts }), group.is_income || (_sheet__WEBPACK_IMPORTED_MODULE_3__.get().createDynamic(sheetName, "group-budget-" + group.id, { initialValue: 0, dependencies: group.categories.map(cat => `budget-${cat.id}`), run: _util__WEBPACK_IMPORTED_MODULE_6__.sumAmounts }), _sheet__WEBPACK_IMPORTED_MODULE_3__.get().createDynamic(sheetName, "group-leftover-" + group.id, { initialValue: 0, dependencies: group.categories.map(cat => `leftover-${cat.id}`), run: _util__WEBPACK_IMPORTED_MODULE_6__.sumAmounts })); }
|
|
12902
|
-
function createSummary(groups, categories, prevSheetName, sheetName) { let incomeGroup = groups.filter(group => group.is_income)[0], expenseCategories = categories.filter(cat => !cat.is_income); _sheet__WEBPACK_IMPORTED_MODULE_3__.get().createStatic(sheetName, "buffered", 0), _sheet__WEBPACK_IMPORTED_MODULE_3__.get().createDynamic(sheetName, "from-last-month", { initialValue: 0, dependencies: [`${prevSheetName}!to-budget`, `${prevSheetName}!buffered`], run: (toBudget, buffered) => (0, _shared_util__WEBPACK_IMPORTED_MODULE_1__.safeNumber)((0, _util__WEBPACK_IMPORTED_MODULE_6__.number)(toBudget) + (0, _util__WEBPACK_IMPORTED_MODULE_6__.number)(buffered)) }), _sheet__WEBPACK_IMPORTED_MODULE_3__.get().createDynamic(sheetName, "total-income", { initialValue: 0, dependencies: [`group-sum-amount-${incomeGroup.id}`], run: amount => amount }), _sheet__WEBPACK_IMPORTED_MODULE_3__.get().createDynamic(sheetName, "available-funds", { initialValue: 0, dependencies: ["total-income", "from-last-month"], run: (income, fromLastMonth) => (0, _shared_util__WEBPACK_IMPORTED_MODULE_1__.safeNumber)((0, _util__WEBPACK_IMPORTED_MODULE_6__.number)(income) + (0, _util__WEBPACK_IMPORTED_MODULE_6__.number)(fromLastMonth)) }), _sheet__WEBPACK_IMPORTED_MODULE_3__.get().createDynamic(sheetName, "last-month-overspent", { initialValue: 0, dependencies: (0, _util__WEBPACK_IMPORTED_MODULE_6__.flatten2)(expenseCategories.map(cat => [`${prevSheetName}!leftover-${cat.id}`, `${prevSheetName}!carryover-${cat.id}`])), run: (...data1) => (data1 = (0, _util__WEBPACK_IMPORTED_MODULE_6__.unflatten2)(data1), (0, _shared_util__WEBPACK_IMPORTED_MODULE_1__.safeNumber)(data1.reduce((total, [leftover, carryover]) => carryover ? total : total + Math.min(0, (0, _util__WEBPACK_IMPORTED_MODULE_6__.number)(leftover)), 0))) }), _sheet__WEBPACK_IMPORTED_MODULE_3__.get().createDynamic(sheetName, "total-budgeted", { initialValue: 0, dependencies: groups.filter(group => !group.is_income).map(group => `group-budget-${group.id}`), run: (...amounts) => -(0, _util__WEBPACK_IMPORTED_MODULE_6__.sumAmounts)(...amounts) }), _sheet__WEBPACK_IMPORTED_MODULE_3__.get().createDynamic(sheetName, "buffered", { initialValue: 0 }), _sheet__WEBPACK_IMPORTED_MODULE_3__.get().createDynamic(sheetName, "to-budget", { initialValue: 0, dependencies: ["available-funds", "last-month-overspent", "total-budgeted", "buffered"], run: (available, lastOverspent, totalBudgeted, buffered) => (0, _shared_util__WEBPACK_IMPORTED_MODULE_1__.safeNumber)((0, _util__WEBPACK_IMPORTED_MODULE_6__.number)(available) + (0, _util__WEBPACK_IMPORTED_MODULE_6__.number)(lastOverspent) + (0, _util__WEBPACK_IMPORTED_MODULE_6__.number)(totalBudgeted) - (0, _util__WEBPACK_IMPORTED_MODULE_6__.number)(buffered)) }), _sheet__WEBPACK_IMPORTED_MODULE_3__.get().createDynamic(sheetName, "total-spent", { initialValue: 0, dependencies: groups.filter(group => !group.is_income).map(group => `group-sum-amount-${group.id}`), run: _util__WEBPACK_IMPORTED_MODULE_6__.sumAmounts }), _sheet__WEBPACK_IMPORTED_MODULE_3__.get().createDynamic(sheetName, "total-leftover", { initialValue: 0, dependencies: groups.filter(group => !group.is_income).map(group => `group-leftover-${group.id}`), run: _util__WEBPACK_IMPORTED_MODULE_6__.sumAmounts }); }
|
|
12903
|
+
function createSummary(groups, categories, prevSheetName, sheetName) { let incomeGroup = groups.filter(group => group.is_income)[0], expenseCategories = categories.filter(cat => !cat.is_income), incomeCategories = categories.filter(cat => cat.is_income); _sheet__WEBPACK_IMPORTED_MODULE_3__.get().createStatic(sheetName, "buffered", 0), _sheet__WEBPACK_IMPORTED_MODULE_3__.get().createDynamic(sheetName, "from-last-month", { initialValue: 0, dependencies: [`${prevSheetName}!to-budget`, `${prevSheetName}!buffered-selected`], run: (toBudget, buffered) => (0, _shared_util__WEBPACK_IMPORTED_MODULE_1__.safeNumber)((0, _util__WEBPACK_IMPORTED_MODULE_6__.number)(toBudget) + (0, _util__WEBPACK_IMPORTED_MODULE_6__.number)(buffered)) }), _sheet__WEBPACK_IMPORTED_MODULE_3__.get().createDynamic(sheetName, "total-income", { initialValue: 0, dependencies: [`group-sum-amount-${incomeGroup.id}`], run: amount => amount }), _sheet__WEBPACK_IMPORTED_MODULE_3__.get().createDynamic(sheetName, "available-funds", { initialValue: 0, dependencies: ["total-income", "from-last-month"], run: (income, fromLastMonth) => (0, _shared_util__WEBPACK_IMPORTED_MODULE_1__.safeNumber)((0, _util__WEBPACK_IMPORTED_MODULE_6__.number)(income) + (0, _util__WEBPACK_IMPORTED_MODULE_6__.number)(fromLastMonth)) }), _sheet__WEBPACK_IMPORTED_MODULE_3__.get().createDynamic(sheetName, "last-month-overspent", { initialValue: 0, dependencies: (0, _util__WEBPACK_IMPORTED_MODULE_6__.flatten2)(expenseCategories.map(cat => [`${prevSheetName}!leftover-${cat.id}`, `${prevSheetName}!carryover-${cat.id}`])), run: (...data1) => (data1 = (0, _util__WEBPACK_IMPORTED_MODULE_6__.unflatten2)(data1), (0, _shared_util__WEBPACK_IMPORTED_MODULE_1__.safeNumber)(data1.reduce((total, [leftover, carryover]) => carryover ? total : total + Math.min(0, (0, _util__WEBPACK_IMPORTED_MODULE_6__.number)(leftover)), 0))) }), _sheet__WEBPACK_IMPORTED_MODULE_3__.get().createDynamic(sheetName, "total-budgeted", { initialValue: 0, dependencies: groups.filter(group => !group.is_income).map(group => `group-budget-${group.id}`), run: (...amounts) => -(0, _util__WEBPACK_IMPORTED_MODULE_6__.sumAmounts)(...amounts) }), _sheet__WEBPACK_IMPORTED_MODULE_3__.get().createDynamic(sheetName, "buffered", { initialValue: 0 }), _sheet__WEBPACK_IMPORTED_MODULE_3__.get().createDynamic(sheetName, "buffered-auto", { initialValue: 0, dependencies: (0, _util__WEBPACK_IMPORTED_MODULE_6__.flatten2)(incomeCategories.map(c => [`${sheetName}!sum-amount-${c.id}`, `${sheetName}!carryover-${c.id}`])), run: (...data1) => (data1 = (0, _util__WEBPACK_IMPORTED_MODULE_6__.unflatten2)(data1), (0, _shared_util__WEBPACK_IMPORTED_MODULE_1__.safeNumber)(data1.reduce((total, [sumAmount, carryover]) => carryover ? total + sumAmount : total, 0))) }), _sheet__WEBPACK_IMPORTED_MODULE_3__.get().createDynamic(sheetName, "buffered-selected", { initialValue: 0, dependencies: [`${sheetName}!buffered`, `${sheetName}!buffered-auto`], run: (man, auto) => 0 !== man ? man : auto }), _sheet__WEBPACK_IMPORTED_MODULE_3__.get().createDynamic(sheetName, "to-budget", { initialValue: 0, dependencies: ["available-funds", "last-month-overspent", "total-budgeted", "buffered-selected"], run: (available, lastOverspent, totalBudgeted, buffered) => (0, _shared_util__WEBPACK_IMPORTED_MODULE_1__.safeNumber)((0, _util__WEBPACK_IMPORTED_MODULE_6__.number)(available) + (0, _util__WEBPACK_IMPORTED_MODULE_6__.number)(lastOverspent) + (0, _util__WEBPACK_IMPORTED_MODULE_6__.number)(totalBudgeted) - (0, _util__WEBPACK_IMPORTED_MODULE_6__.number)(buffered)) }), _sheet__WEBPACK_IMPORTED_MODULE_3__.get().createDynamic(sheetName, "total-spent", { initialValue: 0, dependencies: groups.filter(group => !group.is_income).map(group => `group-sum-amount-${group.id}`), run: _util__WEBPACK_IMPORTED_MODULE_6__.sumAmounts }), _sheet__WEBPACK_IMPORTED_MODULE_3__.get().createDynamic(sheetName, "total-leftover", { initialValue: 0, dependencies: groups.filter(group => !group.is_income).map(group => `group-leftover-${group.id}`), run: _util__WEBPACK_IMPORTED_MODULE_6__.sumAmounts }); }
|
|
12903
12904
|
function createBudget(meta, categories, months) { let blankSheet = getBlankSheet(months); meta.blankSheet !== blankSheet && (_sheet__WEBPACK_IMPORTED_MODULE_3__.get().clearSheet(meta.blankSheet), _sheet__WEBPACK_IMPORTED_MODULE_3__.get().createStatic(blankSheet, "is-blank", !0), _sheet__WEBPACK_IMPORTED_MODULE_3__.get().createStatic(blankSheet, "to-budget", 0), _sheet__WEBPACK_IMPORTED_MODULE_3__.get().createStatic(blankSheet, "buffered", 0), categories.forEach(cat => createBlankCategory(cat, months)), meta.blankSheet = blankSheet); }
|
|
12904
12905
|
function handleCategoryChange(months, oldValue, newValue) { function addDeps(sheetName, groupId, catId) { _sheet__WEBPACK_IMPORTED_MODULE_3__.get().addDependencies(sheetName, `group-sum-amount-${groupId}`, [`sum-amount-${catId}`]), _sheet__WEBPACK_IMPORTED_MODULE_3__.get().addDependencies(sheetName, `group-budget-${groupId}`, [`budget-${catId}`]), _sheet__WEBPACK_IMPORTED_MODULE_3__.get().addDependencies(sheetName, `group-leftover-${groupId}`, [`leftover-${catId}`]); } function removeDeps(sheetName, groupId, catId) { _sheet__WEBPACK_IMPORTED_MODULE_3__.get().removeDependencies(sheetName, `group-sum-amount-${groupId}`, [`sum-amount-${catId}`]), _sheet__WEBPACK_IMPORTED_MODULE_3__.get().removeDependencies(sheetName, `group-budget-${groupId}`, [`budget-${catId}`]), _sheet__WEBPACK_IMPORTED_MODULE_3__.get().removeDependencies(sheetName, `group-leftover-${groupId}`, [`leftover-${catId}`]); } if (oldValue && 0 === oldValue.tombstone && 1 === newValue.tombstone) {
|
|
12905
12906
|
let id = newValue.id, groupId = newValue.cat_group;
|
|
@@ -13073,7 +13074,7 @@ Expression stack:` + stackStr, error;
|
|
|
13073
13074
|
peg$currPos = s0, s0 = peg$FAILED;
|
|
13074
13075
|
if (s0 === peg$FAILED && ((s0 = peg$currPos, (s1 = peg$parsetemplate()) !== peg$FAILED && (s2 = peg$parse_(), "average" === input.substr(peg$currPos, 7).toLowerCase() ? (s3 = input.substr(peg$currPos, 7), peg$currPos += 7) : (s3 = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$e0)), s3 !== peg$FAILED && (s4 = peg$parse_(), (s5 = peg$parsepositive()) !== peg$FAILED))) ? (s6 = peg$parse_(), input.substr(peg$currPos, 6).toLowerCase() === peg$c1 ? (s7 = input.substr(peg$currPos, 6), peg$currPos += 6) : (s7 = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$e1)), s7 === peg$FAILED && (s7 = null), peg$savedPos = s0, s0 = { type: "average", numMonths: +s5, priority: (template7 = s1).priority, directive: template7.directive }) : (peg$currPos = s0, s0 = peg$FAILED), s0 === peg$FAILED) && ((s0 = peg$currPos, (s1 = peg$parsetemplate()) !== peg$FAILED && (s2 = peg$parse_(), "copy from" === input.substr(peg$currPos, 9).toLowerCase() ? (s3 = input.substr(peg$currPos, 9), peg$currPos += 9) : (s3 = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$e2)), s3 !== peg$FAILED && (s4 = peg$parse_(), (s5 = peg$parsepositive()) !== peg$FAILED && (s6 = peg$parse_(), "months ago" === input.substr(peg$currPos, 10).toLowerCase() ? (s7 = input.substr(peg$currPos, 10), peg$currPos += 10) : (s7 = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$e3)), s7 !== peg$FAILED)))) ? ((s8 = peg$parselimit()) === peg$FAILED && (s8 = null), peg$savedPos = s0, template8 = s1, lookBack = s5, limit1 = s8, s0 = { type: "copy", priority: template8.priority, directive: template8.directive, lookBack: +lookBack, limit: limit1 }) : (peg$currPos = s0, s0 = peg$FAILED), s0 === peg$FAILED)) {
|
|
13075
13076
|
if (s0 = peg$currPos, s010 = peg$currPos, "#goal" === input.substr(peg$currPos, 5).toLowerCase() ? (s19 = input.substr(peg$currPos, 5), peg$currPos += 5) : (s19 = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$e32)), s19 !== peg$FAILED && (peg$savedPos = s010, s19 = "goal"), (s1 = s010 = s19) !== peg$FAILED)
|
|
13076
|
-
(s2 = peg$parseamount()) !== peg$FAILED ? (peg$savedPos = s0, s0 = { type: "
|
|
13077
|
+
(s2 = peg$parseamount()) !== peg$FAILED ? (peg$savedPos = s0, s0 = { type: "goal", amount: s2, priority: null, directive: s1 }) : (peg$currPos = s0, s0 = peg$FAILED);
|
|
13077
13078
|
else
|
|
13078
13079
|
peg$currPos = s0, s0 = peg$FAILED;
|
|
13079
13080
|
}
|
|
@@ -13143,7 +13144,7 @@ Expression stack:` + stackStr, error;
|
|
|
13143
13144
|
var _shared_months__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./packages/loot-core/src/shared/months.ts"), _shared_query__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./packages/loot-core/src/shared/query.ts"), _aql__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./packages/loot-core/src/server/aql/index.ts"), _sync__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./packages/loot-core/src/server/sync/index.ts"), _actions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("./packages/loot-core/src/server/budget/actions.ts"), _category_template_context__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("./packages/loot-core/src/server/budget/category-template-context.ts"), _template_notes__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("./packages/loot-core/src/server/budget/template-notes.ts");
|
|
13144
13145
|
async function applyTemplate({ month }) { await (0, _template_notes__WEBPACK_IMPORTED_MODULE_6__.storeTemplates)(); let categoryTemplates = await getTemplates(); return await processTemplate(month, !1, categoryTemplates); }
|
|
13145
13146
|
async function overwriteTemplate({ month }) { await (0, _template_notes__WEBPACK_IMPORTED_MODULE_6__.storeTemplates)(); let categoryTemplates = await getTemplates(); return await processTemplate(month, !0, categoryTemplates); }
|
|
13146
|
-
async function applyMultipleCategoryTemplates({ month, categoryIds }) { let { data: categoryData } = await (0, _aql__WEBPACK_IMPORTED_MODULE_2__.aqlQuery)((0, _shared_query__WEBPACK_IMPORTED_MODULE_1__.q)("categories").filter({ $oneof: categoryIds }).select("*")); await (0, _template_notes__WEBPACK_IMPORTED_MODULE_6__.storeTemplates)(); let categoryTemplates = await getTemplates(c => categoryIds.includes(c.id)); return await processTemplate(month, !0, categoryTemplates, categoryData); }
|
|
13147
|
+
async function applyMultipleCategoryTemplates({ month, categoryIds }) { let { data: categoryData } = await (0, _aql__WEBPACK_IMPORTED_MODULE_2__.aqlQuery)((0, _shared_query__WEBPACK_IMPORTED_MODULE_1__.q)("categories").filter({ id: { $oneof: categoryIds } }).select("*")); await (0, _template_notes__WEBPACK_IMPORTED_MODULE_6__.storeTemplates)(); let categoryTemplates = await getTemplates(c => categoryIds.includes(c.id)); return await processTemplate(month, !0, categoryTemplates, categoryData); }
|
|
13147
13148
|
async function applySingleCategoryTemplate({ month, category }) { let { data: categoryData } = await (0, _aql__WEBPACK_IMPORTED_MODULE_2__.aqlQuery)((0, _shared_query__WEBPACK_IMPORTED_MODULE_1__.q)("categories").filter({ id: category }).select("*")); await (0, _template_notes__WEBPACK_IMPORTED_MODULE_6__.storeTemplates)(); let categoryTemplates = await getTemplates(c => c.id === category); return await processTemplate(month, !0, categoryTemplates, categoryData); }
|
|
13148
13149
|
function runCheckTemplates() { return (0, _template_notes__WEBPACK_IMPORTED_MODULE_6__.checkTemplates)(); }
|
|
13149
13150
|
async function getCategories() { let { data: categoryGroups } = await (0, _aql__WEBPACK_IMPORTED_MODULE_2__.aqlQuery)((0, _shared_query__WEBPACK_IMPORTED_MODULE_1__.q)("category_groups").filter({ hidden: !1 }).select("*")); return categoryGroups.flatMap(g => g.categories || []).filter(c => !c.hidden); }
|
|
@@ -13483,7 +13484,7 @@ Error: ${template.error}`) : errors.push(`${name}: ${template.line}`) : "schedul
|
|
|
13483
13484
|
}, "./packages/loot-core/src/server/budgetfiles/backups.ts": (__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
13484
13485
|
"use strict";
|
|
13485
13486
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, { getAvailableBackups: () => getAvailableBackups, loadBackup: () => loadBackup, makeBackup: () => makeBackup, startBackupService: () => startBackupService, stopBackupService: () => stopBackupService, updateBackups: () => updateBackups });
|
|
13486
|
-
var date_fns__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("./node_modules/date-fns/format.js"), uuid__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("./node_modules/uuid/dist/esm
|
|
13487
|
+
var date_fns__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("./node_modules/date-fns/format.js"), uuid__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("./node_modules/uuid/dist/esm/v4.js"), _platform_server_connection__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./packages/loot-core/src/platform/server/connection/index.api.ts"), _platform_server_fs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./packages/loot-core/src/platform/server/fs/index.electron.ts"), _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./packages/loot-core/src/platform/server/sqlite/index.electron.ts"), _shared_months__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./packages/loot-core/src/shared/months.ts"), _cloud_storage__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("./packages/loot-core/src/server/cloud-storage.ts"), _prefs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("./packages/loot-core/src/server/prefs.ts");
|
|
13487
13488
|
let LATEST_BACKUP_FILENAME = "db.latest.sqlite", serviceInterval = null;
|
|
13488
13489
|
async function getBackups(id) { let budgetDir = _platform_server_fs__WEBPACK_IMPORTED_MODULE_1__.getBudgetDir(id), backupDir = _platform_server_fs__WEBPACK_IMPORTED_MODULE_1__.join(budgetDir, "backups"), paths = []; await _platform_server_fs__WEBPACK_IMPORTED_MODULE_1__.exists(backupDir) && (paths = (paths = await _platform_server_fs__WEBPACK_IMPORTED_MODULE_1__.listDir(backupDir)).filter(file => file.match(/\.sqlite$/))); let backups = await Promise.all(paths.map(async (path) => { let mtime = await _platform_server_fs__WEBPACK_IMPORTED_MODULE_1__.getModifiedTime(_platform_server_fs__WEBPACK_IMPORTED_MODULE_1__.join(backupDir, path)); return { id: path, date: new Date(mtime) }; })); return backups.sort((b1, b2) => b1.date < b2.date ? 1 : b1.date > b2.date ? -1 : 0), backups; }
|
|
13489
13490
|
async function getLatestBackup(id) { let budgetDir = _platform_server_fs__WEBPACK_IMPORTED_MODULE_1__.getBudgetDir(id); return await _platform_server_fs__WEBPACK_IMPORTED_MODULE_1__.exists(_platform_server_fs__WEBPACK_IMPORTED_MODULE_1__.join(budgetDir, LATEST_BACKUP_FILENAME)) ? { id: LATEST_BACKUP_FILENAME, date: null, isLatest: !0 } : null; }
|
|
@@ -13516,7 +13517,7 @@ Error: ${template.error}`) : errors.push(`${name}: ${template.line}`) : "schedul
|
|
|
13516
13517
|
}, "./packages/loot-core/src/server/cloud-storage.ts": (__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
13517
13518
|
"use strict";
|
|
13518
13519
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, { checkKey: () => checkKey, download: () => download, exportBuffer: () => exportBuffer, getRemoteFile: () => getRemoteFile, importBuffer: () => importBuffer, listRemoteFiles: () => listRemoteFiles, possiblyUpload: () => possiblyUpload, removeFile: () => removeFile, resetSyncState: () => resetSyncState, upload: () => upload });
|
|
13519
|
-
var adm_zip__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./node_modules/adm-zip/adm-zip.js"), adm_zip__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(adm_zip__WEBPACK_IMPORTED_MODULE_0__), uuid__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__("./node_modules/uuid/dist/esm
|
|
13520
|
+
var adm_zip__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./node_modules/adm-zip/adm-zip.js"), adm_zip__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(adm_zip__WEBPACK_IMPORTED_MODULE_0__), uuid__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__("./node_modules/uuid/dist/esm/v4.js"), _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./packages/loot-core/src/platform/server/asyncStorage/index.electron.ts"), _platform_server_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./packages/loot-core/src/platform/server/fetch/index.api.ts"), _platform_server_fs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./packages/loot-core/src/platform/server/fs/index.electron.ts"), _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("./packages/loot-core/src/platform/server/sqlite/index.electron.ts"), _shared_months__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("./packages/loot-core/src/shared/months.ts"), _encryption__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("./packages/loot-core/src/server/encryption/index.ts"), _errors__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("./packages/loot-core/src/server/errors.ts"), _mutators__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("./packages/loot-core/src/server/mutators.ts"), _post__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__("./packages/loot-core/src/server/post.ts"), _prefs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__("./packages/loot-core/src/server/prefs.ts"), _server_config__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__("./packages/loot-core/src/server/server-config.ts");
|
|
13520
13521
|
async function checkHTTPStatus(res) { if (200 === res.status)
|
|
13521
13522
|
return res; if (403 === res.status)
|
|
13522
13523
|
try {
|
|
@@ -13678,7 +13679,7 @@ Error: ${template.error}`) : errors.push(`${name}: ${template.line}`) : "schedul
|
|
|
13678
13679
|
}, "./packages/loot-core/src/server/db/index.ts": (__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
13679
13680
|
"use strict";
|
|
13680
13681
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, { all: () => all, asyncTransaction: () => asyncTransaction, cache: () => cache, closeDatabase: () => closeDatabase, deleteAccount: () => deleteAccount, deleteAll: () => deleteAll, deleteCategory: () => deleteCategory, deleteCategoryGroup: () => deleteCategoryGroup, deletePayee: () => deletePayee, deleteTransaction: () => deleteTransaction, deleteTransferPayee: () => deleteTransferPayee, delete_: () => delete_, execQuery: () => execQuery, first: () => first, firstSync: () => firstSync, fromDateRepr: () => _models__WEBPACK_IMPORTED_MODULE_7__.fromDateRepr, getAccount: () => getAccount, getAccounts: () => getAccounts, getCategories: () => getCategories, getCategoriesGrouped: () => getCategoriesGrouped, getCommonPayees: () => getCommonPayees, getDatabase: () => getDatabase, getDatabasePath: () => getDatabasePath, getOrphanedPayees: () => getOrphanedPayees, getPayee: () => getPayee, getPayeeByName: () => getPayeeByName, getPayees: () => getPayees, getTransaction: () => getTransaction, getTransactions: () => getTransactions, insert: () => insert, insertAccount: () => insertAccount, insertCategory: () => insertCategory, insertCategoryGroup: () => insertCategoryGroup, insertPayee: () => insertPayee, insertTransaction: () => insertTransaction, insertWithSchema: () => insertWithSchema, insertWithUUID: () => insertWithUUID, loadClock: () => loadClock, mergePayees: () => mergePayees, moveAccount: () => moveAccount, moveCategory: () => moveCategory, moveCategoryGroup: () => moveCategoryGroup, openDatabase: () => openDatabase, run: () => run, runQuery: () => runQuery, select: () => select, selectFirstWithSchema: () => selectFirstWithSchema, selectWithSchema: () => selectWithSchema, setDatabase: () => setDatabase, syncGetOrphanedPayees: () => syncGetOrphanedPayees, toDateRepr: () => _models__WEBPACK_IMPORTED_MODULE_7__.toDateRepr, transaction: () => transaction, update: () => update, updateAccount: () => updateAccount, updateCategory: () => updateCategory, updateCategoryGroup: () => updateCategoryGroup, updatePayee: () => updatePayee, updateTransaction: () => updateTransaction, updateWithSchema: () => updateWithSchema });
|
|
13681
|
-
var _actual_app_crdt__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("@actual-app/crdt"), lru_cache__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./node_modules/lru-cache/dist/esm/index.js"), uuid__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__("./node_modules/uuid/dist/esm
|
|
13682
|
+
var _actual_app_crdt__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("@actual-app/crdt"), lru_cache__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./node_modules/lru-cache/dist/esm/index.js"), uuid__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__("./node_modules/uuid/dist/esm/v4.js"), _platform_server_fs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./packages/loot-core/src/platform/server/fs/index.electron.ts"), _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./packages/loot-core/src/platform/server/sqlite/index.electron.ts"), _shared_months__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("./packages/loot-core/src/shared/months.ts"), _shared_util__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("./packages/loot-core/src/shared/util.ts"), _aql__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("./packages/loot-core/src/server/aql/index.ts"), _models__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("./packages/loot-core/src/server/models.ts"), _sync__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("./packages/loot-core/src/server/sync/index.ts"), _sort__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__("./packages/loot-core/src/server/db/sort.ts");
|
|
13682
13683
|
__webpack_require__("./packages/loot-core/src/server/db/types/index.ts");
|
|
13683
13684
|
let dbPath = null, db = null;
|
|
13684
13685
|
function getDatabasePath() { return dbPath; }
|
|
@@ -13889,7 +13890,7 @@ Error: ${template.error}`) : errors.push(`${name}: ${template.line}`) : "schedul
|
|
|
13889
13890
|
}, "./packages/loot-core/src/server/encryption/app.ts": (__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
13890
13891
|
"use strict";
|
|
13891
13892
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, { app: () => app });
|
|
13892
|
-
var uuid__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("./node_modules/uuid/dist/esm
|
|
13893
|
+
var uuid__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("./node_modules/uuid/dist/esm/v4.js"), _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./packages/loot-core/src/platform/server/asyncStorage/index.electron.ts"), _app__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./packages/loot-core/src/server/app.ts"), _post__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./packages/loot-core/src/server/post.ts"), _prefs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./packages/loot-core/src/server/prefs.ts"), _server_config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("./packages/loot-core/src/server/server-config.ts"), _sync__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("./packages/loot-core/src/server/sync/index.ts"), ___WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("./packages/loot-core/src/server/encryption/index.ts");
|
|
13893
13894
|
let app = (0, _app__WEBPACK_IMPORTED_MODULE_1__.createApp)();
|
|
13894
13895
|
async function keyMake({ password }) { if (!_prefs__WEBPACK_IMPORTED_MODULE_3__.getPrefs())
|
|
13895
13896
|
throw Error("key-make must be called with file loaded"); let salt = ___WEBPACK_IMPORTED_MODULE_6__.randomBytes(32).toString("base64"), id = (0, uuid__WEBPACK_IMPORTED_MODULE_7__.default)(), key = await ___WEBPACK_IMPORTED_MODULE_6__.createKey({ id, password, salt }); await ___WEBPACK_IMPORTED_MODULE_6__.loadKey(key); let testContent = await (0, _sync__WEBPACK_IMPORTED_MODULE_5__.makeTestMessage)(key.getId()); return await (0, _sync__WEBPACK_IMPORTED_MODULE_5__.resetSync)({ key, salt, testContent: JSON.stringify({ ...testContent, value: testContent.value.toString("base64") }) }); }
|
|
@@ -13922,7 +13923,7 @@ Error: ${template.error}`) : errors.push(`${name}: ${template.line}`) : "schedul
|
|
|
13922
13923
|
}, "./packages/loot-core/src/server/encryption/index.ts": (__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
13923
13924
|
"use strict";
|
|
13924
13925
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, { createKey: () => createKey, decrypt: () => decrypt, encrypt: () => encrypt, getKey: () => getKey, hasKey: () => hasKey, loadKey: () => loadKey, randomBytes: () => randomBytes, unloadAllKeys: () => unloadAllKeys, unloadKey: () => unloadKey });
|
|
13925
|
-
var uuid__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./node_modules/uuid/dist/esm
|
|
13926
|
+
var uuid__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./node_modules/uuid/dist/esm/v4.js"), _encryption_internals__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./packages/loot-core/src/server/encryption/encryption-internals.ts");
|
|
13926
13927
|
let keys = {};
|
|
13927
13928
|
class Key {
|
|
13928
13929
|
constructor({ id }) { this.id = id || (0, uuid__WEBPACK_IMPORTED_MODULE_1__.default)(); }
|
|
@@ -13970,7 +13971,7 @@ Error: ${template.error}`) : errors.push(`${name}: ${template.line}`) : "schedul
|
|
|
13970
13971
|
}, "./packages/loot-core/src/server/filters/app.ts": (__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
13971
13972
|
"use strict";
|
|
13972
13973
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, { app: () => app });
|
|
13973
|
-
var uuid__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("./node_modules/uuid/dist/esm
|
|
13974
|
+
var uuid__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("./node_modules/uuid/dist/esm/v4.js"), _app__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./packages/loot-core/src/server/app.ts"), _db__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./packages/loot-core/src/server/db/index.ts"), _models__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./packages/loot-core/src/server/models.ts"), _mutators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./packages/loot-core/src/server/mutators.ts"), _transactions_transaction_rules__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("./packages/loot-core/src/server/transactions/transaction-rules.ts"), _undo__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("./packages/loot-core/src/server/undo.ts");
|
|
13974
13975
|
let filterModel = { validate(filter, { update } = {}) { if ((0, _models__WEBPACK_IMPORTED_MODULE_2__.requiredFields)("transaction_filters", filter, ["conditions"], update), (!update || "conditionsOp" in filter) && !["and", "or"].includes(filter.conditionsOp))
|
|
13975
13976
|
throw Error("Invalid filter conditionsOp: " + filter.conditionsOp); return filter; }, toJS(row) { let { conditions, conditions_op, ...fields } = row; return { ...fields, conditionsOp: conditions_op, conditions: (0, _transactions_transaction_rules__WEBPACK_IMPORTED_MODULE_4__.parseConditionsOrActions)(conditions) }; }, fromJS(filter) { let { conditionsOp, ...row } = filter; return conditionsOp && (row.conditions_op = conditionsOp), row; } };
|
|
13976
13977
|
async function filterNameExists(name, filterId, newItem) { let idForName = await _db__WEBPACK_IMPORTED_MODULE_1__.first("SELECT id from transaction_filters WHERE tombstone = 0 AND name = ?", [name]); return null !== idForName && (!!newItem || idForName.id !== filterId); }
|
|
@@ -14053,7 +14054,7 @@ Error: ${template.error}`) : errors.push(`${name}: ${template.line}`) : "schedul
|
|
|
14053
14054
|
}, "./packages/loot-core/src/server/importers/ynab4.ts": (__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
14054
14055
|
"use strict";
|
|
14055
14056
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, { doImport: () => doImport, getBudgetName: () => getBudgetName, parseFile: () => parseFile });
|
|
14056
|
-
var _actual_app_api_injected__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./packages/api/injected.js"), _actual_app_api_methods__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./packages/api/methods.ts"), _actual_app_api_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./packages/api/utils.js"), adm_zip__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./node_modules/adm-zip/adm-zip.js"), adm_zip__WEBPACK_IMPORTED_MODULE_3___default = __webpack_require__.n(adm_zip__WEBPACK_IMPORTED_MODULE_3__), slash__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("./node_modules/slash/index.js"), slash__WEBPACK_IMPORTED_MODULE_4___default = __webpack_require__.n(slash__WEBPACK_IMPORTED_MODULE_4__), uuid__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("./node_modules/uuid/dist/esm
|
|
14057
|
+
var _actual_app_api_injected__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./packages/api/injected.js"), _actual_app_api_methods__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./packages/api/methods.ts"), _actual_app_api_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./packages/api/utils.js"), adm_zip__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./node_modules/adm-zip/adm-zip.js"), adm_zip__WEBPACK_IMPORTED_MODULE_3___default = __webpack_require__.n(adm_zip__WEBPACK_IMPORTED_MODULE_3__), slash__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("./node_modules/slash/index.js"), slash__WEBPACK_IMPORTED_MODULE_4___default = __webpack_require__.n(slash__WEBPACK_IMPORTED_MODULE_4__), uuid__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("./node_modules/uuid/dist/esm/v4.js"), _shared_months__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("./packages/loot-core/src/shared/months.ts"), _shared_util__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("./packages/loot-core/src/shared/util.ts");
|
|
14057
14058
|
async function importAccounts(data1, entityIdMap) { return Promise.all((0, _shared_util__WEBPACK_IMPORTED_MODULE_6__.sortByKey)(data1.accounts, "sortableIndex").map(async (account) => { if (!account.isTombstone) {
|
|
14058
14059
|
let id = await _actual_app_api_methods__WEBPACK_IMPORTED_MODULE_1__.createAccount({ name: account.accountName, offbudget: !account.onBudget, closed: !!account.hidden });
|
|
14059
14060
|
entityIdMap.set(account.entityId, id);
|
|
@@ -14115,7 +14116,7 @@ Error: ${template.error}`) : errors.push(`${name}: ${template.line}`) : "schedul
|
|
|
14115
14116
|
}, "./packages/loot-core/src/server/importers/ynab5.ts": (__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
14116
14117
|
"use strict";
|
|
14117
14118
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, { doImport: () => doImport, getBudgetName: () => getBudgetName, parseFile: () => parseFile });
|
|
14118
|
-
var _actual_app_api_methods__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./packages/api/methods.ts"), uuid__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./node_modules/uuid/dist/esm
|
|
14119
|
+
var _actual_app_api_methods__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./packages/api/methods.ts"), uuid__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./node_modules/uuid/dist/esm/v4.js"), _shared_months__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./packages/loot-core/src/shared/months.ts"), _shared_util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./packages/loot-core/src/shared/util.ts");
|
|
14119
14120
|
function amountFromYnab(amount) { return Math.round(amount / 10); }
|
|
14120
14121
|
async function importCategories(data1, entityIdMap) { let incomeCatId = findIdByName(await _actual_app_api_methods__WEBPACK_IMPORTED_MODULE_0__.getCategories(), "Income"), ynabIncomeCategories = ["To be Budgeted", "Inflow: Ready to Assign"]; for (let group of data1.category_groups)
|
|
14121
14122
|
if (!group.deleted) {
|
|
@@ -14457,7 +14458,7 @@ Response: ` + JSON.stringify(res, null, 2)), new _errors__WEBPACK_IMPORTED_MODUL
|
|
|
14457
14458
|
}, "./packages/loot-core/src/server/reports/app.ts": (__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
14458
14459
|
"use strict";
|
|
14459
14460
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, { app: () => app, reportModel: () => reportModel });
|
|
14460
|
-
var uuid__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("./node_modules/uuid/dist/esm
|
|
14461
|
+
var uuid__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("./node_modules/uuid/dist/esm/v4.js"), _app__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./packages/loot-core/src/server/app.ts"), _db__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./packages/loot-core/src/server/db/index.ts"), _errors__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./packages/loot-core/src/server/errors.ts"), _models__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./packages/loot-core/src/server/models.ts"), _mutators__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("./packages/loot-core/src/server/mutators.ts"), _undo__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("./packages/loot-core/src/server/undo.ts");
|
|
14461
14462
|
let reportModel = { validate(report, { update } = {}) { if ((0, _models__WEBPACK_IMPORTED_MODULE_3__.requiredFields)("Report", report, ["conditionsOp"], update), (!update || "conditionsOp" in report) && !["and", "or"].includes(report.conditionsOp))
|
|
14462
14463
|
throw new _errors__WEBPACK_IMPORTED_MODULE_2__.ValidationError("Invalid filter conditionsOp: " + report.conditionsOp); return report; }, toJS: row => ({ id: row.id, name: row.name, startDate: row.start_date, endDate: row.end_date, isDateStatic: 1 === row.date_static, dateRange: row.date_range, mode: row.mode, groupBy: row.group_by, sortBy: row.sort_by, interval: row.interval, balanceType: row.balance_type, showEmpty: 1 === row.show_empty, showOffBudget: 1 === row.show_offbudget, showHiddenCategories: 1 === row.show_hidden, showUncategorized: 1 === row.show_uncategorized, includeCurrentInterval: 1 === row.include_current, graphType: row.graph_type, conditions: row.conditions, conditionsOp: row.conditions_op }), fromJS: report => ({ id: report.id, name: report.name, start_date: report.startDate, end_date: report.endDate, date_static: +!!report.isDateStatic, date_range: report.dateRange, mode: report.mode, group_by: report.groupBy, sort_by: report.sortBy, interval: report.interval, balance_type: report.balanceType, show_empty: +!!report.showEmpty, show_offbudget: +!!report.showOffBudget, show_hidden: +!!report.showHiddenCategories, show_uncategorized: +!!report.showUncategorized, include_current: +!!report.includeCurrentInterval, graph_type: report.graphType, conditions: report.conditions, conditions_op: report.conditionsOp }) };
|
|
14463
14464
|
async function reportNameExists(name, reportId, newItem) { let idForName = await _db__WEBPACK_IMPORTED_MODULE_1__.first("SELECT id from custom_reports WHERE tombstone = 0 AND name = ?", [name]); return null !== idForName && (!!newItem || idForName.id !== reportId); }
|
|
@@ -14773,7 +14774,7 @@ Response: ` + JSON.stringify(res, null, 2)), new _errors__WEBPACK_IMPORTED_MODUL
|
|
|
14773
14774
|
}, "./packages/loot-core/src/server/schedules/app.ts": (__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
14774
14775
|
"use strict";
|
|
14775
14776
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, { app: () => app, createSchedule: () => createSchedule, deleteSchedule: () => deleteSchedule, getRuleForSchedule: () => getRuleForSchedule, setNextDate: () => setNextDate, updateConditions: () => updateConditions, updateSchedule: () => updateSchedule });
|
|
14776
|
-
var date_fns__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__("./node_modules/date-fns/addDays.js"), date_fns__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__("./node_modules/date-fns/startOfDay.js"), deep_equal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./node_modules/deep-equal/index.js"), deep_equal__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(deep_equal__WEBPACK_IMPORTED_MODULE_0__), uuid__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__("./node_modules/uuid/dist/esm
|
|
14777
|
+
var date_fns__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__("./node_modules/date-fns/addDays.js"), date_fns__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__("./node_modules/date-fns/startOfDay.js"), deep_equal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./node_modules/deep-equal/index.js"), deep_equal__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(deep_equal__WEBPACK_IMPORTED_MODULE_0__), uuid__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__("./node_modules/uuid/dist/esm/v4.js"), _platform_exceptions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./packages/loot-core/src/platform/exceptions/index.ts"), _platform_server_connection__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./packages/loot-core/src/platform/server/connection/index.api.ts"), _shared_months__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./packages/loot-core/src/shared/months.ts"), _shared_query__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("./packages/loot-core/src/shared/query.ts"), _shared_schedules__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("./packages/loot-core/src/shared/schedules.ts"), _accounts_sync__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("./packages/loot-core/src/server/accounts/sync.ts"), _app__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("./packages/loot-core/src/server/app.ts"), _aql__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("./packages/loot-core/src/server/aql/index.ts"), _db__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__("./packages/loot-core/src/server/db/index.ts"), _models__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__("./packages/loot-core/src/server/models.ts"), _mutators__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__("./packages/loot-core/src/server/mutators.ts"), _prefs__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__("./packages/loot-core/src/server/prefs.ts"), _rules__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__("./packages/loot-core/src/server/rules/index.ts"), _sync__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__("./packages/loot-core/src/server/sync/index.ts"), _transactions_transaction_rules__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__("./packages/loot-core/src/server/transactions/transaction-rules.ts"), _undo__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__("./packages/loot-core/src/server/undo.ts"), _util_rschedule__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__("./packages/loot-core/src/server/util/rschedule.ts"), _find_schedules__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__("./packages/loot-core/src/server/schedules/find-schedules.ts");
|
|
14777
14778
|
function updateConditions(conditions, newConditions) { let scheduleConds = (0, _shared_schedules__WEBPACK_IMPORTED_MODULE_5__.extractScheduleConds)(conditions), newScheduleConds = (0, _shared_schedules__WEBPACK_IMPORTED_MODULE_5__.extractScheduleConds)(newConditions), replacements = function (arr1, arr2) { let result = []; for (let i1 = 0; i1 < arr1.length; i1++)
|
|
14778
14779
|
result.push([arr1[i1], arr2[i1]]); return result; }(Object.values(scheduleConds), Object.values(newScheduleConds)), updated = conditions.map(cond => { let r = replacements.find(r => cond === r[0]); return r && r[1] ? r[1] : cond; }), added = replacements.filter(x => null == x[0] && null != x[1]).map(x => x[1]); return updated.concat(added); }
|
|
14779
14780
|
async function getRuleForSchedule(id) { if (null == id)
|
|
@@ -14854,7 +14855,7 @@ Response: ` + JSON.stringify(res, null, 2)), new _errors__WEBPACK_IMPORTED_MODUL
|
|
|
14854
14855
|
}, "./packages/loot-core/src/server/schedules/find-schedules.ts": (__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
14855
14856
|
"use strict";
|
|
14856
14857
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, { findSchedules: () => findSchedules });
|
|
14857
|
-
var date_fns__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__("./node_modules/date-fns/subDays.js"), date_fns__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__("./node_modules/date-fns/addDays.js"), date_fns__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__("./node_modules/date-fns/differenceInDays.js"), date_fns__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__("./node_modules/date-fns/subWeeks.js"), date_fns__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__("./node_modules/date-fns/subMonths.js"), date_fns__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__("./node_modules/date-fns/getDate.js"), date_fns__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__("./node_modules/date-fns/format.js"), date_fns__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__("./node_modules/date-fns/subYears.js"), uuid__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__("./node_modules/uuid/dist/esm
|
|
14858
|
+
var date_fns__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__("./node_modules/date-fns/subDays.js"), date_fns__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__("./node_modules/date-fns/addDays.js"), date_fns__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__("./node_modules/date-fns/differenceInDays.js"), date_fns__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__("./node_modules/date-fns/subWeeks.js"), date_fns__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__("./node_modules/date-fns/subMonths.js"), date_fns__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__("./node_modules/date-fns/getDate.js"), date_fns__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__("./node_modules/date-fns/format.js"), date_fns__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__("./node_modules/date-fns/subYears.js"), uuid__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__("./node_modules/uuid/dist/esm/v4.js"), _shared_months__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./packages/loot-core/src/shared/months.ts"), _shared_query__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./packages/loot-core/src/shared/query.ts"), _shared_rules__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./packages/loot-core/src/shared/rules.ts"), _shared_schedules__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./packages/loot-core/src/shared/schedules.ts"), _shared_util__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("./packages/loot-core/src/shared/util.ts"), _aql__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("./packages/loot-core/src/server/aql/index.ts"), _db__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("./packages/loot-core/src/server/db/index.ts"), _models__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("./packages/loot-core/src/server/models.ts"), _transactions_transaction_rules__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("./packages/loot-core/src/server/transactions/transaction-rules.ts"), _util_rschedule__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__("./packages/loot-core/src/server/util/rschedule.ts");
|
|
14858
14859
|
async function getTransactions(date, account) { let { data: data1 } = await (0, _aql__WEBPACK_IMPORTED_MODULE_5__.aqlQuery)((0, _shared_query__WEBPACK_IMPORTED_MODULE_1__.q)("transactions").filter({ account, schedule: null, "payee.transfer_acct": null, $and: [{ date: { $gte: date_fns__WEBPACK_IMPORTED_MODULE_10__.subDays(date, 2) } }, { date: { $lte: date_fns__WEBPACK_IMPORTED_MODULE_11__.addDays(date, 2) } }] }).select("*").options({ splits: "none" })); return data1; }
|
|
14859
14860
|
function getRank(day1, day2) { return 1 / (Math.abs(date_fns__WEBPACK_IMPORTED_MODULE_12__.differenceInDays((0, _shared_months__WEBPACK_IMPORTED_MODULE_0__.parseDate)(day1), (0, _shared_months__WEBPACK_IMPORTED_MODULE_0__.parseDate)(day2))) + 1); }
|
|
14860
14861
|
async function schedulesForPattern(baseStart, numDays, baseConfig, accountId) { let schedules = []; for (let i1 = 0; i1 < numDays; i1++) {
|
|
@@ -15942,7 +15943,7 @@ Response: ` + JSON.stringify(res, null, 2)), new _errors__WEBPACK_IMPORTED_MODUL
|
|
|
15942
15943
|
}, "./packages/loot-core/src/server/util/budget-name.ts": (__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
15943
15944
|
"use strict";
|
|
15944
15945
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, { idFromBudgetName: () => idFromBudgetName, uniqueBudgetName: () => uniqueBudgetName, validateBudgetName: () => validateBudgetName });
|
|
15945
|
-
var uuid__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./node_modules/uuid/dist/esm
|
|
15946
|
+
var uuid__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./node_modules/uuid/dist/esm/v4.js"), _platform_server_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./packages/loot-core/src/platform/server/fs/index.electron.ts"), _main__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./packages/loot-core/src/server/main.ts");
|
|
15946
15947
|
async function uniqueBudgetName(initialName = "My Finances") { let budgets = await _main__WEBPACK_IMPORTED_MODULE_1__.handlers["get-budgets"](), idx = 1, newName = initialName; for (; budgets.find(file => file.name === newName);)
|
|
15947
15948
|
newName = `${initialName} ${idx}`, idx++; return newName; }
|
|
15948
15949
|
async function validateBudgetName(name) { let trimmedName = name.trim(), uniqueName = await uniqueBudgetName(trimmedName), message = null; return "" === trimmedName && (message = "Budget name cannot be blank"), trimmedName.length > 100 && (message = "Budget name is too long (max length 100)"), uniqueName !== trimmedName && (message = `“${name}” already exists, try “${uniqueName}” instead`), message ? { valid: !1, message } : { valid: !0 }; }
|
|
@@ -16393,7 +16394,7 @@ Response: ` + JSON.stringify(res, null, 2)), new _errors__WEBPACK_IMPORTED_MODUL
|
|
|
16393
16394
|
}, "./packages/loot-core/src/shared/transactions.ts": (__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
16394
16395
|
"use strict";
|
|
16395
16396
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, { addSplitTransaction: () => addSplitTransaction, applyTransactionDiff: () => applyTransactionDiff, deleteTransaction: () => deleteTransaction, groupTransaction: () => groupTransaction, isPreviewId: () => isPreviewId, isTemporaryId: () => isTemporaryId, makeAsNonChildTransactions: () => makeAsNonChildTransactions, makeChild: () => makeChild, realizeTempTransactions: () => realizeTempTransactions, recalculateSplit: () => recalculateSplit, splitTransaction: () => splitTransaction, ungroupTransaction: () => ungroupTransaction, ungroupTransactions: () => ungroupTransactions, updateTransaction: () => updateTransaction });
|
|
16396
|
-
var uuid__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./node_modules/uuid/dist/esm
|
|
16397
|
+
var uuid__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./node_modules/uuid/dist/esm/v4.js"), _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./packages/loot-core/src/shared/util.ts");
|
|
16397
16398
|
function isTemporaryId(id) { return -1 !== id.indexOf("temp"); }
|
|
16398
16399
|
function isPreviewId(id) { return -1 !== id.indexOf("preview/"); }
|
|
16399
16400
|
function num(n) { return "number" == typeof n ? n : 0; }
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@actual-app/api",
|
|
3
|
-
"version": "25.
|
|
3
|
+
"version": "25.7.0-nightly.20250611",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "An API for Actual",
|
|
6
6
|
"engines": {
|
|
@@ -27,10 +27,9 @@
|
|
|
27
27
|
"better-sqlite3": "^11.10.0",
|
|
28
28
|
"compare-versions": "^6.1.1",
|
|
29
29
|
"node-fetch": "^3.3.2",
|
|
30
|
-
"uuid": "^
|
|
30
|
+
"uuid": "^11.1.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@types/uuid": "^9.0.8",
|
|
34
33
|
"tsc-alias": "^1.8.16",
|
|
35
34
|
"typescript": "^5.8.3",
|
|
36
35
|
"vitest": "^3.1.3"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@actual-app/api",
|
|
3
|
-
"version": "25.
|
|
3
|
+
"version": "25.7.0-nightly.20250611",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "An API for Actual",
|
|
6
6
|
"engines": {
|
|
@@ -27,10 +27,9 @@
|
|
|
27
27
|
"better-sqlite3": "^11.10.0",
|
|
28
28
|
"compare-versions": "^6.1.1",
|
|
29
29
|
"node-fetch": "^3.3.2",
|
|
30
|
-
"uuid": "^
|
|
30
|
+
"uuid": "^11.1.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@types/uuid": "^9.0.8",
|
|
34
33
|
"tsc-alias": "^1.8.16",
|
|
35
34
|
"typescript": "^5.8.3",
|
|
36
35
|
"vitest": "^3.1.3"
|