@actual-app/api 25.12.0-nightly.20251106 → 25.12.0-nightly.20251108

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.
@@ -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;
@@ -41,11 +41,21 @@ export type SpendingWidget = AbstractWidget<'spending-card', {
41
41
  export type CustomReportWidget = AbstractWidget<'custom-report', {
42
42
  id: string;
43
43
  }>;
44
+ export type CrossoverWidget = AbstractWidget<'crossover-card', {
45
+ name?: string;
46
+ expenseCategoryIds?: string[];
47
+ incomeAccountIds?: string[];
48
+ timeFrame?: TimeFrame;
49
+ safeWithdrawalRate?: number;
50
+ estimatedReturn?: number | null;
51
+ projectionType?: 'trend' | 'hampel';
52
+ showHiddenCategories?: boolean;
53
+ } | null>;
44
54
  export type MarkdownWidget = AbstractWidget<'markdown-card', {
45
55
  content: string;
46
56
  text_align?: 'left' | 'right' | 'center';
47
57
  }>;
48
- type SpecializedWidget = NetWorthWidget | CashFlowWidget | SpendingWidget | MarkdownWidget | SummaryWidget | CalendarWidget | FormulaWidget;
58
+ type SpecializedWidget = NetWorthWidget | CashFlowWidget | SpendingWidget | CrossoverWidget | MarkdownWidget | SummaryWidget | CalendarWidget | FormulaWidget;
49
59
  export type Widget = SpecializedWidget | CustomReportWidget;
50
60
  export type NewWidget = Omit<Widget, 'id' | 'tombstone'>;
51
61
  export type ExportImportCustomReportWidget = Omit<CustomReportWidget, 'id' | 'meta' | 'tombstone'> & {
@@ -1,4 +1,4 @@
1
- export type FeatureFlag = 'goalTemplatesEnabled' | 'goalTemplatesUIEnabled' | 'actionTemplating' | 'formulaMode' | 'currency' | 'plugins';
1
+ export type FeatureFlag = 'goalTemplatesEnabled' | 'goalTemplatesUIEnabled' | 'actionTemplating' | 'formulaMode' | 'currency' | 'crossoverReport' | 'plugins';
2
2
  /**
3
3
  * Cross-device preferences. These sync across devices when they are changed.
4
4
  */
@@ -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
- if (leftover >= 0 || leftoverFrom <= 0) {
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 amountCovered = Math.min(-leftover, leftoverFrom);
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 + amountCovered
55028
+ amount: toBudgeted + coverableAmount
55027
55029
  });
55028
55030
  await addMovementNotes({
55029
55031
  month,
55030
- amount: amountCovered,
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({ category, month, amount: categoryBudget + toBudget });
55056
+ await setBudget({
55057
+ category,
55058
+ month,
55059
+ amount: categoryBudget - coverableAmount
55060
+ });
55049
55061
  await addMovementNotes({
55050
55062
  month,
55051
- amount: -toBudget,
55063
+ amount: coverableAmount,
55052
55064
  from: category,
55053
55065
  to: "overbudgeted"
55054
55066
  });
@@ -125202,6 +125214,7 @@ const exportModel = {
125202
125214
  "net-worth-card",
125203
125215
  "cash-flow-card",
125204
125216
  "spending-card",
125217
+ "crossover-card",
125205
125218
  "custom-report",
125206
125219
  "markdown-card",
125207
125220
  "summary-card",
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@actual-app/api",
3
- "version": "25.12.0-nightly.20251106",
3
+ "version": "25.12.0-nightly.20251108",
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": "25.12.0-nightly.20251106",
3
+ "version": "25.12.0-nightly.20251108",
4
4
  "license": "MIT",
5
5
  "description": "An API for Actual",
6
6
  "engines": {