@actual-app/api 25.12.0-nightly.20251105 → 25.12.0-nightly.20251107
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/src/server/budget/actions.d.ts +5 -2
- package/@types/loot-core/src/server/transactions/import/parse-file.d.ts +2 -1
- package/@types/loot-core/src/types/prefs.d.ts +1 -1
- package/@types/vitest.config.d.ts +1 -6
- package/dist/app/bundle.api.js +52 -23
- package/dist/migrations/1762178745667_rename_csv_skip_lines_pref.sql +8 -0
- package/dist/package.json +2 -2
- package/dist/vitest.config.js +1 -6
- package/package.json +2 -2
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IntegerAmount } from '../../shared/util';
|
|
1
2
|
import { CategoryEntity } from '../../types/models';
|
|
2
3
|
export declare function getSheetValue(sheetName: string, cell: string): Promise<number>;
|
|
3
4
|
export declare function getSheetBoolean(sheetName: string, cell: string): Promise<boolean>;
|
|
@@ -49,19 +50,21 @@ export declare function holdForNextMonth({ month, amount, }: {
|
|
|
49
50
|
export declare function resetHold({ month }: {
|
|
50
51
|
month: string;
|
|
51
52
|
}): Promise<void>;
|
|
52
|
-
export declare function coverOverspending({ month, to, from, }: {
|
|
53
|
+
export declare function coverOverspending({ month, to, from, amount, }: {
|
|
53
54
|
month: string;
|
|
54
55
|
to: CategoryEntity['id'] | 'to-budget';
|
|
55
56
|
from: CategoryEntity['id'] | 'to-budget' | 'overbudgeted';
|
|
57
|
+
amount?: IntegerAmount;
|
|
56
58
|
}): Promise<void>;
|
|
57
59
|
export declare function transferAvailable({ month, amount, category, }: {
|
|
58
60
|
month: string;
|
|
59
61
|
amount: number;
|
|
60
62
|
category: string;
|
|
61
63
|
}): Promise<void>;
|
|
62
|
-
export declare function coverOverbudgeted({ month, category, }: {
|
|
64
|
+
export declare function coverOverbudgeted({ month, category, amount, }: {
|
|
63
65
|
month: string;
|
|
64
66
|
category: string;
|
|
67
|
+
amount?: IntegerAmount;
|
|
65
68
|
}): Promise<void>;
|
|
66
69
|
export declare function transferCategory({ month, amount, from, to, }: {
|
|
67
70
|
month: string;
|
|
@@ -19,7 +19,8 @@ export type ParseFileOptions = {
|
|
|
19
19
|
hasHeaderRow?: boolean;
|
|
20
20
|
delimiter?: string;
|
|
21
21
|
fallbackMissingPayeeToMemo?: boolean;
|
|
22
|
-
|
|
22
|
+
skipStartLines?: number;
|
|
23
|
+
skipEndLines?: number;
|
|
23
24
|
importNotes?: boolean;
|
|
24
25
|
};
|
|
25
26
|
export declare function parseFile(filepath: string, options?: ParseFileOptions): Promise<ParseFileResult>;
|
|
@@ -2,7 +2,7 @@ export type FeatureFlag = 'goalTemplatesEnabled' | 'goalTemplatesUIEnabled' | 'a
|
|
|
2
2
|
/**
|
|
3
3
|
* Cross-device preferences. These sync across devices when they are changed.
|
|
4
4
|
*/
|
|
5
|
-
export type SyncedPrefs = Partial<Record<'budgetType' | 'upcomingScheduledTransactionLength' | 'firstDayOfWeekIdx' | 'dateFormat' | 'numberFormat' | 'hideFraction' | 'isPrivacyEnabled' | 'currencySymbolPosition' | 'currencySpaceBetweenAmountAndSymbol' | 'defaultCurrencyCode' | 'plugins' | `show-account-${string}-net-worth-chart` | `side-nav.show-balance-history-${string}` | `show-balances-${string}` | `show-extra-balances-${string}` | `hide-cleared-${string}` | `hide-reconciled-${string}` | `parse-date-${string}-${'csv' | 'qif'}` | `csv-mappings-${string}` | `csv-delimiter-${string}` | `csv-skip-lines-${string}` | `csv-in-out-mode-${string}` | `csv-out-value-${string}` | `csv-has-header-${string}` | `custom-sync-mappings-${string}` | `sync-import-pending-${string}` | `sync-reimport-deleted-${string}` | `sync-import-notes-${string}` | `sync-import-transactions-${string}` | `ofx-fallback-missing-payee-${string}` | `flip-amount-${string}-${'csv' | 'qif'}` | `flags.${FeatureFlag}` | `learn-categories`, string>>;
|
|
5
|
+
export type SyncedPrefs = Partial<Record<'budgetType' | 'upcomingScheduledTransactionLength' | 'firstDayOfWeekIdx' | 'dateFormat' | 'numberFormat' | 'hideFraction' | 'isPrivacyEnabled' | 'currencySymbolPosition' | 'currencySpaceBetweenAmountAndSymbol' | 'defaultCurrencyCode' | 'plugins' | `show-account-${string}-net-worth-chart` | `side-nav.show-balance-history-${string}` | `show-balances-${string}` | `show-extra-balances-${string}` | `hide-cleared-${string}` | `hide-reconciled-${string}` | `parse-date-${string}-${'csv' | 'qif'}` | `csv-mappings-${string}` | `csv-delimiter-${string}` | `csv-skip-start-lines-${string}` | `csv-skip-end-lines-${string}` | `csv-in-out-mode-${string}` | `csv-out-value-${string}` | `csv-has-header-${string}` | `custom-sync-mappings-${string}` | `sync-import-pending-${string}` | `sync-reimport-deleted-${string}` | `sync-import-notes-${string}` | `sync-import-transactions-${string}` | `ofx-fallback-missing-payee-${string}` | `flip-amount-${string}-${'csv' | 'qif'}` | `flags.${FeatureFlag}` | `learn-categories`, string>>;
|
|
6
6
|
/**
|
|
7
7
|
* Preferences that are stored in the `metadata.json` file along with the
|
|
8
8
|
* core database.
|
|
@@ -2,12 +2,7 @@ declare const _default: {
|
|
|
2
2
|
test: {
|
|
3
3
|
globals: boolean;
|
|
4
4
|
onConsoleLog(log: string, type: "stdout" | "stderr"): boolean | void;
|
|
5
|
-
|
|
6
|
-
threads: {
|
|
7
|
-
maxThreads: number;
|
|
8
|
-
minThreads: number;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
5
|
+
maxWorkers: number;
|
|
11
6
|
};
|
|
12
7
|
};
|
|
13
8
|
export default _default;
|
package/dist/app/bundle.api.js
CHANGED
|
@@ -55002,32 +55002,34 @@ async function holdForNextMonth({ month, amount }) {
|
|
|
55002
55002
|
async function resetHold({ month }) {
|
|
55003
55003
|
await setBuffer(month, 0);
|
|
55004
55004
|
}
|
|
55005
|
-
async function coverOverspending({ month, to, from }) {
|
|
55005
|
+
async function coverOverspending({ month, to, from, amount }) {
|
|
55006
55006
|
const sheetName = sheetForMonth(month);
|
|
55007
55007
|
const toBudgeted = await getSheetValue(sheetName, "budget-" + to);
|
|
55008
|
-
const leftover = await getSheetValue(sheetName, "leftover-" + to);
|
|
55009
55008
|
const leftoverFrom = await getSheetValue(sheetName, from === "to-budget" ? "to-budget" : "leftover-" + from);
|
|
55010
|
-
|
|
55009
|
+
const amountToCover = amount ? (
|
|
55010
|
+
// Covering in the app provides a positive amount to cover so we invert it here
|
|
55011
|
+
-amount) : await getSheetValue(sheetName, "leftover-" + to);
|
|
55012
|
+
if (amountToCover >= 0 || leftoverFrom <= 0) {
|
|
55011
55013
|
return;
|
|
55012
55014
|
}
|
|
55013
|
-
const
|
|
55014
|
-
if (from !== "to-budget") {
|
|
55015
|
-
const fromBudgeted = await getSheetValue(sheetName, "budget-" + from);
|
|
55016
|
-
await setBudget({
|
|
55017
|
-
category: from,
|
|
55018
|
-
month,
|
|
55019
|
-
amount: fromBudgeted - amountCovered
|
|
55020
|
-
});
|
|
55021
|
-
}
|
|
55015
|
+
const coverableAmount = Math.min(Math.abs(amountToCover), leftoverFrom);
|
|
55022
55016
|
await batchMessages(async () => {
|
|
55017
|
+
if (from !== "to-budget") {
|
|
55018
|
+
const fromBudgeted = await getSheetValue(sheetName, "budget-" + from);
|
|
55019
|
+
await setBudget({
|
|
55020
|
+
category: from,
|
|
55021
|
+
month,
|
|
55022
|
+
amount: fromBudgeted - coverableAmount
|
|
55023
|
+
});
|
|
55024
|
+
}
|
|
55023
55025
|
await setBudget({
|
|
55024
55026
|
category: to,
|
|
55025
55027
|
month,
|
|
55026
|
-
amount: toBudgeted +
|
|
55028
|
+
amount: toBudgeted + coverableAmount
|
|
55027
55029
|
});
|
|
55028
55030
|
await addMovementNotes({
|
|
55029
55031
|
month,
|
|
55030
|
-
amount:
|
|
55032
|
+
amount: coverableAmount,
|
|
55031
55033
|
to,
|
|
55032
55034
|
from
|
|
55033
55035
|
});
|
|
@@ -55040,15 +55042,25 @@ async function transferAvailable({ month, amount, category }) {
|
|
|
55040
55042
|
const budgeted = await getSheetValue(sheetName, "budget-" + category);
|
|
55041
55043
|
await setBudget({ category, month, amount: budgeted + amount });
|
|
55042
55044
|
}
|
|
55043
|
-
async function coverOverbudgeted({ month, category }) {
|
|
55045
|
+
async function coverOverbudgeted({ month, category, amount }) {
|
|
55044
55046
|
const sheetName = sheetForMonth(month);
|
|
55045
|
-
const toBudget = await getSheetValue(sheetName, "to-budget");
|
|
55046
55047
|
const categoryBudget = await getSheetValue(sheetName, "budget-" + category);
|
|
55048
|
+
const amountToCover = amount ? (
|
|
55049
|
+
// Covering in the app provides a positive amount to cover so we invert it here
|
|
55050
|
+
-amount) : await getSheetValue(sheetName, "to-budget");
|
|
55051
|
+
if (amountToCover >= 0 || categoryBudget <= 0) {
|
|
55052
|
+
return;
|
|
55053
|
+
}
|
|
55054
|
+
const coverableAmount = Math.min(Math.abs(amountToCover), categoryBudget);
|
|
55047
55055
|
await batchMessages(async () => {
|
|
55048
|
-
await setBudget({
|
|
55056
|
+
await setBudget({
|
|
55057
|
+
category,
|
|
55058
|
+
month,
|
|
55059
|
+
amount: categoryBudget - coverableAmount
|
|
55060
|
+
});
|
|
55049
55061
|
await addMovementNotes({
|
|
55050
55062
|
month,
|
|
55051
|
-
amount:
|
|
55063
|
+
amount: coverableAmount,
|
|
55052
55064
|
from: category,
|
|
55053
55065
|
to: "overbudgeted"
|
|
55054
55066
|
});
|
|
@@ -108249,13 +108261,19 @@ async function addTransfer(transaction2, transferredAccount) {
|
|
|
108249
108261
|
schedule: transaction2.schedule,
|
|
108250
108262
|
cleared: false
|
|
108251
108263
|
};
|
|
108252
|
-
const { notes, cleared } = await runRules$1(transferTransaction);
|
|
108264
|
+
const { notes, cleared, schedule } = await runRules$1(transferTransaction);
|
|
108265
|
+
const matchedSchedule = schedule ?? transaction2.schedule;
|
|
108253
108266
|
const id2 = await insertTransaction({
|
|
108254
108267
|
...transferTransaction,
|
|
108255
108268
|
notes,
|
|
108256
|
-
cleared
|
|
108269
|
+
cleared,
|
|
108270
|
+
schedule: matchedSchedule
|
|
108271
|
+
});
|
|
108272
|
+
await updateTransaction$2({
|
|
108273
|
+
id: transaction2.id,
|
|
108274
|
+
transfer_id: id2,
|
|
108275
|
+
...matchedSchedule ? { schedule: matchedSchedule } : {}
|
|
108257
108276
|
});
|
|
108258
|
-
await updateTransaction$2({ id: transaction2.id, transfer_id: id2 });
|
|
108259
108277
|
const categoryCleared = await clearCategory(transaction2, transferredAccount);
|
|
108260
108278
|
return {
|
|
108261
108279
|
id: transaction2.id,
|
|
@@ -134541,9 +134559,20 @@ async function parseFile(filepath, options = {}) {
|
|
|
134541
134559
|
async function parseCSV(filepath, options) {
|
|
134542
134560
|
const errors2 = Array();
|
|
134543
134561
|
let contents = await readFile(filepath);
|
|
134544
|
-
|
|
134562
|
+
const skipStart = Math.max(0, options.skipStartLines || 0);
|
|
134563
|
+
const skipEnd = Math.max(0, options.skipEndLines || 0);
|
|
134564
|
+
if (skipStart > 0 || skipEnd > 0) {
|
|
134545
134565
|
const lines = contents.split(/\r?\n/);
|
|
134546
|
-
|
|
134566
|
+
if (skipStart + skipEnd >= lines.length) {
|
|
134567
|
+
errors2.push({
|
|
134568
|
+
message: "Cannot skip more lines than exist in the file",
|
|
134569
|
+
internal: `Attempted to skip ${skipStart} start + ${skipEnd} end lines from ${lines.length} total lines`
|
|
134570
|
+
});
|
|
134571
|
+
return { errors: errors2, transactions: [] };
|
|
134572
|
+
}
|
|
134573
|
+
const startLine = skipStart;
|
|
134574
|
+
const endLine = skipEnd > 0 ? lines.length - skipEnd : lines.length;
|
|
134575
|
+
contents = lines.slice(startLine, endLine).join("\r\n");
|
|
134547
134576
|
}
|
|
134548
134577
|
let data;
|
|
134549
134578
|
try {
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@actual-app/api",
|
|
3
|
-
"version": "25.12.0-nightly.
|
|
3
|
+
"version": "25.12.0-nightly.20251107",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "An API for Actual",
|
|
6
6
|
"engines": {
|
|
@@ -32,6 +32,6 @@
|
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"tsc-alias": "^1.8.16",
|
|
34
34
|
"typescript": "^5.9.3",
|
|
35
|
-
"vitest": "^
|
|
35
|
+
"vitest": "^4.0.6"
|
|
36
36
|
}
|
|
37
37
|
}
|
package/dist/vitest.config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@actual-app/api",
|
|
3
|
-
"version": "25.12.0-nightly.
|
|
3
|
+
"version": "25.12.0-nightly.20251107",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "An API for Actual",
|
|
6
6
|
"engines": {
|
|
@@ -32,6 +32,6 @@
|
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"tsc-alias": "^1.8.16",
|
|
34
34
|
"typescript": "^5.9.3",
|
|
35
|
-
"vitest": "^
|
|
35
|
+
"vitest": "^4.0.6"
|
|
36
36
|
}
|
|
37
37
|
}
|