@actual-app/api 26.1.0-nightly.20251216 → 26.1.0-nightly.20251218

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.
@@ -5840,7 +5840,7 @@ function startOfISOWeekYear(date, options) {
5840
5840
  function addWeeks$1(date, amount, options) {
5841
5841
  return addDays$1(date, amount * 7, options);
5842
5842
  }
5843
- function addYears$1(date, amount, options) {
5843
+ function addYears(date, amount, options) {
5844
5844
  return addMonths$1(date, amount * 12, options);
5845
5845
  }
5846
5846
  function max$1(dates, options) {
@@ -9176,7 +9176,7 @@ function subWeeks$1(date, amount, options) {
9176
9176
  return addWeeks$1(date, -amount, options);
9177
9177
  }
9178
9178
  function subYears(date, amount, options) {
9179
- return addYears$1(date, -amount, options);
9179
+ return addYears(date, -amount, options);
9180
9180
  }
9181
9181
  function last$1(arr) {
9182
9182
  return arr[arr.length - 1];
@@ -11884,9 +11884,6 @@ function nextMonth(month) {
11884
11884
  function prevMonth(month) {
11885
11885
  return format$2(subMonths$1(_parse(month), 1), "yyyy-MM");
11886
11886
  }
11887
- function addYears(year, n) {
11888
- return format$2(addYears$1(_parse(year), n), "yyyy");
11889
- }
11890
11887
  function addMonths(month, n) {
11891
11888
  return format$2(addMonths$1(_parse(month), n), "yyyy-MM");
11892
11889
  }
@@ -102105,7 +102102,7 @@ function getUpcomingDays(upcomingLength = "7", today = currentDay()) {
102105
102102
  const future = addMonths(today, value);
102106
102103
  return differenceInCalendarDays(future, month) + 1;
102107
102104
  case "year":
102108
- const futureYear = addYears(today, value);
102105
+ const futureYear = addMonths(today, value * 12);
102109
102106
  return differenceInCalendarDays(futureYear, month) + 1;
102110
102107
  default:
102111
102108
  return 7;
@@ -106539,7 +106536,7 @@ function registerHandlebarsHelpers() {
106539
106536
  addYears: (date, years) => {
106540
106537
  if (!date || !years)
106541
106538
  return date;
106542
- return format$1(addYears$1(parseDate$1(date), years), "yyyy-MM-dd");
106539
+ return format$1(addYears(parseDate$1(date), years), "yyyy-MM-dd");
106543
106540
  },
106544
106541
  subYears: (date, years) => {
106545
106542
  if (!date || !years)
@@ -121805,7 +121802,15 @@ const DEFAULT_DASHBOARD_STATE = [
121805
121802
  start: "2024-01-01",
121806
121803
  end: "2024-03-31",
121807
121804
  mode: "sliding-window"
121808
- }
121805
+ },
121806
+ conditions: [
121807
+ {
121808
+ field: "transfer",
121809
+ op: "is",
121810
+ value: false
121811
+ }
121812
+ ],
121813
+ conditionsOp: "and"
121809
121814
  }
121810
121815
  },
121811
121816
  {
@@ -133932,17 +133937,60 @@ async function mergeTransactions(transactions) {
133932
133937
  throw new Error("Transaction amounts must match for merge");
133933
133938
  }
133934
133939
  const { keep, drop: drop2 } = determineKeepDrop(a, b);
133935
- await Promise.all([
133936
- updateTransaction$2({
133940
+ const keepSubtransactions = [];
133941
+ const dropSubtransactions = [];
133942
+ const parents = [];
133943
+ if (keep.is_parent)
133944
+ parents.push(keep.id);
133945
+ if (drop2.is_parent)
133946
+ parents.push(drop2.id);
133947
+ let rows = [];
133948
+ if (parents.length === 2) {
133949
+ rows = await all("SELECT * FROM v_transactions WHERE parent_id IN (?, ?)", parents);
133950
+ }
133951
+ else if (parents.length === 1) {
133952
+ rows = await all("SELECT * FROM v_transactions WHERE parent_id = ?", parents);
133953
+ }
133954
+ for (const row of rows) {
133955
+ if (row.parent_id === keep.id)
133956
+ keepSubtransactions.push(row);
133957
+ else if (row.parent_id === drop2.id)
133958
+ dropSubtransactions.push(row);
133959
+ }
133960
+ const keepHasSubtransactions = keepSubtransactions.length > 0;
133961
+ const dropHasSubtransactions = dropSubtransactions.length > 0;
133962
+ if (!keepHasSubtransactions && dropHasSubtransactions) {
133963
+ await Promise.all(dropSubtransactions.map((sub2) => updateTransaction$2({
133964
+ id: sub2.id,
133965
+ parent_id: keep.id
133966
+ })));
133967
+ await updateTransaction$2({
133968
+ id: keep.id,
133969
+ is_parent: true,
133970
+ category: null,
133971
+ // Parent transactions with splits shouldn't have a category
133972
+ payee: keep.payee || drop2.payee,
133973
+ notes: keep.notes || drop2.notes,
133974
+ cleared: keep.cleared || drop2.cleared,
133975
+ reconciled: keep.reconciled || drop2.reconciled
133976
+ });
133977
+ }
133978
+ else {
133979
+ await updateTransaction$2({
133937
133980
  id: keep.id,
133938
133981
  payee: keep.payee || drop2.payee,
133939
133982
  category: keep.category || drop2.category,
133940
133983
  notes: keep.notes || drop2.notes,
133941
133984
  cleared: keep.cleared || drop2.cleared,
133942
133985
  reconciled: keep.reconciled || drop2.reconciled
133943
- }),
133944
- deleteTransaction$2(drop2)
133945
- ]);
133986
+ });
133987
+ }
133988
+ const { data: transactionsToDelete } = await aqlQuery(q("transactions").filter({ id: drop2.id }).select("*").options({ splits: "grouped" }));
133989
+ const ungroupedTransactions = ungroupTransactions(transactionsToDelete);
133990
+ if (ungroupedTransactions.length > 0) {
133991
+ const { diff: diff2 } = deleteTransaction$1(ungroupedTransactions, drop2.id);
133992
+ await batchUpdateTransactions(diff2);
133993
+ }
133946
133994
  return keep.id;
133947
133995
  }
133948
133996
  function determineKeepDrop(a, b) {
package/dist/index.js CHANGED
@@ -40,7 +40,6 @@ exports.utils = exports.internal = void 0;
40
40
  exports.init = init;
41
41
  exports.shutdown = shutdown;
42
42
  // @ts-ignore: bundle not available until we build it
43
- // eslint-disable-next-line import/extensions
44
43
  const bundle = __importStar(require("./app/bundle.api.js"));
45
44
  const injected = __importStar(require("./injected"));
46
45
  const validateNodeVersion_1 = require("./validateNodeVersion");
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@actual-app/api",
3
- "version": "26.1.0-nightly.20251216",
3
+ "version": "26.1.0-nightly.20251218",
4
4
  "license": "MIT",
5
5
  "description": "An API for Actual",
6
6
  "engines": {
package/dist/utils.js CHANGED
@@ -35,7 +35,6 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.integerToAmount = exports.amountToInteger = void 0;
37
37
  // @ts-ignore: bundle not available until we build it
38
- // eslint-disable-next-line import/extensions
39
38
  const bundle = __importStar(require("./app/bundle.api.js"));
40
39
  exports.amountToInteger = bundle.lib.amountToInteger;
41
40
  exports.integerToAmount = bundle.lib.integerToAmount;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@actual-app/api",
3
- "version": "26.1.0-nightly.20251216",
3
+ "version": "26.1.0-nightly.20251218",
4
4
  "license": "MIT",
5
5
  "description": "An API for Actual",
6
6
  "engines": {