@actual-app/api 26.1.0-nightly.20251217 → 26.1.0-nightly.20251219

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.
@@ -16,6 +16,7 @@ const fs$1 = require("fs");
16
16
  const path = require("path");
17
17
  const SQL = require("better-sqlite3");
18
18
  const node_crypto = require("node:crypto");
19
+ const os = require("os");
19
20
  const crypto = require("crypto");
20
21
  const require$$0 = require("zlib");
21
22
  const require$$0$1 = require("util");
@@ -5840,7 +5841,7 @@ function startOfISOWeekYear(date, options) {
5840
5841
  function addWeeks$1(date, amount, options) {
5841
5842
  return addDays$1(date, amount * 7, options);
5842
5843
  }
5843
- function addYears$1(date, amount, options) {
5844
+ function addYears(date, amount, options) {
5844
5845
  return addMonths$1(date, amount * 12, options);
5845
5846
  }
5846
5847
  function max$1(dates, options) {
@@ -9176,7 +9177,7 @@ function subWeeks$1(date, amount, options) {
9176
9177
  return addWeeks$1(date, -amount, options);
9177
9178
  }
9178
9179
  function subYears(date, amount, options) {
9179
- return addYears$1(date, -amount, options);
9180
+ return addYears(date, -amount, options);
9180
9181
  }
9181
9182
  function last$1(arr) {
9182
9183
  return arr[arr.length - 1];
@@ -11822,7 +11823,6 @@ function isDevelopmentEnvironment() {
11822
11823
  function isNonProductionEnvironment() {
11823
11824
  return isPreviewEnvironment() || isDevelopmentEnvironment();
11824
11825
  }
11825
- const os = require("os");
11826
11826
  os.platform() === "win32";
11827
11827
  os.platform() === "darwin";
11828
11828
  os.platform() === "linux";
@@ -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
  }
@@ -59611,7 +59608,7 @@ async function upload() {
59611
59608
  ...uploadMeta ? { "X-ACTUAL-ENCRYPT-META": JSON.stringify(uploadMeta) } : null,
59612
59609
  ...groupId ? { "X-ACTUAL-GROUP-ID": groupId } : null
59613
59610
  // TODO: fix me
59614
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
59611
+ // oxlint-disable-next-line typescript/no-explicit-any
59615
59612
  },
59616
59613
  body: uploadContent
59617
59614
  });
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@actual-app/api",
3
- "version": "26.1.0-nightly.20251217",
3
+ "version": "26.1.0-nightly.20251219",
4
4
  "license": "MIT",
5
5
  "description": "An API for Actual",
6
6
  "engines": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@actual-app/api",
3
- "version": "26.1.0-nightly.20251217",
3
+ "version": "26.1.0-nightly.20251219",
4
4
  "license": "MIT",
5
5
  "description": "An API for Actual",
6
6
  "engines": {