@actual-app/api 26.1.0-nightly.20251207 → 26.1.0-nightly.20251209

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.
@@ -50,27 +50,30 @@ export declare function holdForNextMonth({ month, amount, }: {
50
50
  export declare function resetHold({ month }: {
51
51
  month: string;
52
52
  }): Promise<void>;
53
- export declare function coverOverspending({ month, to, from, amount, }: {
53
+ export declare function coverOverspending({ month, to, from, amount, currencyCode, }: {
54
54
  month: string;
55
55
  to: CategoryEntity['id'] | 'to-budget';
56
56
  from: CategoryEntity['id'] | 'to-budget' | 'overbudgeted';
57
57
  amount?: IntegerAmount;
58
+ currencyCode: string;
58
59
  }): Promise<void>;
59
60
  export declare function transferAvailable({ month, amount, category, }: {
60
61
  month: string;
61
62
  amount: number;
62
63
  category: string;
63
64
  }): Promise<void>;
64
- export declare function coverOverbudgeted({ month, category, amount, }: {
65
+ export declare function coverOverbudgeted({ month, category, amount, currencyCode, }: {
65
66
  month: string;
66
67
  category: string;
67
68
  amount?: IntegerAmount;
69
+ currencyCode: string;
68
70
  }): Promise<void>;
69
- export declare function transferCategory({ month, amount, from, to, }: {
71
+ export declare function transferCategory({ month, amount, from, to, currencyCode, }: {
70
72
  month: string;
71
73
  amount: number;
72
74
  to: CategoryEntity['id'] | 'to-budget';
73
75
  from: CategoryEntity['id'] | 'to-budget';
76
+ currencyCode: string;
74
77
  }): Promise<void>;
75
78
  export declare function setCategoryCarryover({ startMonth, category, flag, }: {
76
79
  startMonth: string;
@@ -0,0 +1,6 @@
1
+ import { FunctionPlugin } from 'hyperformula';
2
+ import { InterpreterState } from 'hyperformula/typings/interpreter/InterpreterState';
3
+ import { ProcedureAst } from 'hyperformula/typings/parser';
4
+ export declare class CustomFunctionsPlugin extends FunctionPlugin {
5
+ integerToAmount(ast: ProcedureAst, state: InterpreterState): import("hyperformula/typings/interpreter/InterpreterValue").RawInterpreterValue;
6
+ }
@@ -12680,7 +12680,7 @@ function diff(trie1, trie2) {
12680
12680
  let node1 = trie1;
12681
12681
  let node2 = trie2;
12682
12682
  let k = "";
12683
- while (1) {
12683
+ while (true) {
12684
12684
  const keyset = /* @__PURE__ */ new Set([...getKeys(node1), ...getKeys(node2)]);
12685
12685
  const keys2 = [...keyset.values()];
12686
12686
  keys2.sort();
@@ -15476,6 +15476,49 @@ function waitOnSpreadsheet() {
15476
15476
  }
15477
15477
  });
15478
15478
  }
15479
+ const currencies = [
15480
+ { code: "", name: "None", symbol: "", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: true },
15481
+ { code: "AED", name: "UAE Dirham", symbol: "د.إ", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: false },
15482
+ { code: "ARS", name: "Argentinian Peso", symbol: "Arg$", decimalPlaces: 2, numberFormat: "dot-comma", symbolFirst: true },
15483
+ { code: "AUD", name: "Australian Dollar", symbol: "A$", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: true },
15484
+ { code: "BRL", name: "Brazilian Real", symbol: "R$", decimalPlaces: 2, numberFormat: "dot-comma", symbolFirst: true },
15485
+ { code: "BYN", name: "Belarusian Ruble", symbol: "Br", decimalPlaces: 2, numberFormat: "space-comma", symbolFirst: false },
15486
+ { code: "CAD", name: "Canadian Dollar", symbol: "CA$", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: true },
15487
+ { code: "CHF", name: "Swiss Franc", symbol: "Fr.", decimalPlaces: 2, numberFormat: "apostrophe-dot", symbolFirst: true },
15488
+ { code: "CNY", name: "Yuan Renminbi", symbol: "¥", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: true },
15489
+ { code: "COP", name: "Colombian Peso", symbol: "Col$", decimalPlaces: 2, numberFormat: "dot-comma", symbolFirst: true },
15490
+ { code: "CRC", name: "Costa Rican Colón", symbol: "₡", decimalPlaces: 2, numberFormat: "space-comma", symbolFirst: true },
15491
+ { code: "DKK", name: "Danish Krone", symbol: "kr", decimalPlaces: 2, numberFormat: "dot-comma", symbolFirst: false },
15492
+ { code: "EGP", name: "Egyptian Pound", symbol: "ج.م", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: false },
15493
+ { code: "EUR", name: "Euro", symbol: "€", decimalPlaces: 2, numberFormat: "dot-comma", symbolFirst: false },
15494
+ { code: "GBP", name: "Pound Sterling", symbol: "£", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: true },
15495
+ { code: "GTQ", name: "Guatemalan Quetzal", symbol: "Q", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: true },
15496
+ { code: "HKD", name: "Hong Kong Dollar", symbol: "HK$", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: true },
15497
+ { code: "IDR", name: "Indonesian Rupiah", symbol: "Rp", decimalPlaces: 2, numberFormat: "dot-comma", symbolFirst: true },
15498
+ { code: "INR", name: "Indian Rupee", symbol: "₹", decimalPlaces: 2, numberFormat: "comma-dot-in", symbolFirst: true },
15499
+ { code: "JMD", name: "Jamaican Dollar", symbol: "J$", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: true },
15500
+ { code: "JPY", name: "Japanese Yen", symbol: "¥", decimalPlaces: 0, numberFormat: "comma-dot", symbolFirst: true },
15501
+ { code: "LKR", name: "Sri Lankan Rupee", symbol: "Rs.", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: true },
15502
+ { code: "MDL", name: "Moldovan Leu", symbol: "L", decimalPlaces: 2, numberFormat: "dot-comma", symbolFirst: false },
15503
+ { code: "MYR", name: "Malaysian Ringgit", symbol: "RM", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: true },
15504
+ { code: "PHP", name: "Philippine Peso", symbol: "₱", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: true },
15505
+ { code: "PLN", name: "Polish Złoty", symbol: "zł", decimalPlaces: 2, numberFormat: "space-comma", symbolFirst: false },
15506
+ { code: "QAR", name: "Qatari Riyal", symbol: "ر.ق", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: false },
15507
+ { code: "RON", name: "Romanian Leu", symbol: "lei", decimalPlaces: 2, numberFormat: "dot-comma", symbolFirst: false },
15508
+ { code: "RSD", name: "Serbian Dinar", symbol: "дин", decimalPlaces: 2, numberFormat: "dot-comma", symbolFirst: false },
15509
+ { code: "RUB", name: "Russian Ruble", symbol: "₽", decimalPlaces: 2, numberFormat: "space-comma", symbolFirst: false },
15510
+ { code: "SAR", name: "Saudi Riyal", symbol: "ر.س", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: false },
15511
+ { code: "SEK", name: "Swedish Krona", symbol: "kr", decimalPlaces: 2, numberFormat: "space-comma", symbolFirst: false },
15512
+ { code: "SGD", name: "Singapore Dollar", symbol: "S$", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: true },
15513
+ { code: "THB", name: "Thai Baht", symbol: "฿", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: true },
15514
+ { code: "TRY", name: "Turkish Lira", symbol: "₺", decimalPlaces: 2, numberFormat: "dot-comma", symbolFirst: true },
15515
+ { code: "UAH", name: "Ukrainian Hryvnia", symbol: "₴", decimalPlaces: 2, numberFormat: "space-comma", symbolFirst: false },
15516
+ { code: "USD", name: "US Dollar", symbol: "$", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: true },
15517
+ { code: "UZS", name: "Uzbek Soum", symbol: "UZS", decimalPlaces: 2, numberFormat: "space-comma", symbolFirst: false }
15518
+ ];
15519
+ function getCurrency(code) {
15520
+ return currencies.find((c) => c.code === code) || currencies[0];
15521
+ }
15479
15522
  const formatDistanceLocale$1i = {
15480
15523
  lessThanXSeconds: {
15481
15524
  one: "minder as 'n sekonde",
@@ -55005,7 +55048,7 @@ async function holdForNextMonth({ month, amount }) {
55005
55048
  async function resetHold({ month }) {
55006
55049
  await setBuffer(month, 0);
55007
55050
  }
55008
- async function coverOverspending({ month, to, from, amount }) {
55051
+ async function coverOverspending({ month, to, from, amount, currencyCode }) {
55009
55052
  const sheetName = sheetForMonth(month);
55010
55053
  const toBudgeted = await getSheetValue(sheetName, "budget-" + to);
55011
55054
  const leftoverFrom = await getSheetValue(sheetName, from === "to-budget" ? "to-budget" : "leftover-" + from);
@@ -55034,7 +55077,8 @@ async function coverOverspending({ month, to, from, amount }) {
55034
55077
  month,
55035
55078
  amount: coverableAmount,
55036
55079
  to,
55037
- from
55080
+ from,
55081
+ currencyCode
55038
55082
  });
55039
55083
  });
55040
55084
  }
@@ -55045,7 +55089,7 @@ async function transferAvailable({ month, amount, category }) {
55045
55089
  const budgeted = await getSheetValue(sheetName, "budget-" + category);
55046
55090
  await setBudget({ category, month, amount: budgeted + amount });
55047
55091
  }
55048
- async function coverOverbudgeted({ month, category, amount }) {
55092
+ async function coverOverbudgeted({ month, category, amount, currencyCode }) {
55049
55093
  const sheetName = sheetForMonth(month);
55050
55094
  const categoryBudget = await getSheetValue(sheetName, "budget-" + category);
55051
55095
  const amountToCover = amount ? (
@@ -55065,11 +55109,12 @@ async function coverOverbudgeted({ month, category, amount }) {
55065
55109
  month,
55066
55110
  amount: coverableAmount,
55067
55111
  from: category,
55068
- to: "overbudgeted"
55112
+ to: "overbudgeted",
55113
+ currencyCode
55069
55114
  });
55070
55115
  });
55071
55116
  }
55072
- async function transferCategory({ month, amount, from, to }) {
55117
+ async function transferCategory({ month, amount, from, to, currencyCode }) {
55073
55118
  const sheetName = sheetForMonth(month);
55074
55119
  const fromBudgeted = await getSheetValue(sheetName, "budget-" + from);
55075
55120
  await batchMessages(async () => {
@@ -55082,7 +55127,8 @@ async function transferCategory({ month, amount, from, to }) {
55082
55127
  month,
55083
55128
  amount,
55084
55129
  to,
55085
- from
55130
+ from,
55131
+ currencyCode
55086
55132
  });
55087
55133
  });
55088
55134
  }
@@ -55098,8 +55144,9 @@ async function setCategoryCarryover({ startMonth, category, flag }) {
55098
55144
  function addNewLine(notes) {
55099
55145
  return !notes ? "" : `${notes}${notes && "\n"}`;
55100
55146
  }
55101
- async function addMovementNotes({ month, amount, to, from }) {
55102
- const displayAmount = integerToCurrency(amount);
55147
+ async function addMovementNotes({ month, amount, to, from, currencyCode }) {
55148
+ const currency = getCurrency(currencyCode);
55149
+ const displayAmount = integerToCurrency(amount, void 0, currency.decimalPlaces);
55103
55150
  const monthBudgetNotesId = `budget-${month}`;
55104
55151
  const existingMonthBudgetNotes = addNewLine(firstSync(`SELECT n.note FROM notes n WHERE n.id = ?`, [monthBudgetNotesId])?.note);
55105
55152
  const locale = getLocale(await getItem("language"));
@@ -101880,6 +101927,26 @@ for (const pluginName of Object.getOwnPropertyNames(plugins)) {
101880
101927
  HyperFormula.registerFunctionPlugin(plugins[pluginName]);
101881
101928
  }
101882
101929
  }
101930
+ class CustomFunctionsPlugin extends FunctionPlugin {
101931
+ integerToAmount(ast, state) {
101932
+ return this.runFunction(ast.args, state, this.metadata("INTEGER_TO_AMOUNT"), (integerAmount, decimalPlaces = 2) => {
101933
+ return integerToAmount(integerAmount, decimalPlaces);
101934
+ });
101935
+ }
101936
+ }
101937
+ CustomFunctionsPlugin.implementedFunctions = {
101938
+ INTEGER_TO_AMOUNT: {
101939
+ method: "integerToAmount",
101940
+ parameters: [
101941
+ { argumentType: FunctionArgumentType.NUMBER },
101942
+ {
101943
+ argumentType: FunctionArgumentType.NUMBER,
101944
+ optionalArg: true,
101945
+ defaultValue: 2
101946
+ }
101947
+ ]
101948
+ }
101949
+ };
101883
101950
  function getStatus(nextDate, completed, hasTrans, upcomingLength = "7") {
101884
101951
  const upcomingDays = getUpcomingDays(upcomingLength);
101885
101952
  const today = currentDay();
@@ -106050,6 +106117,7 @@ class Action {
106050
106117
  throw new Error("Formula must start with =");
106051
106118
  }
106052
106119
  try {
106120
+ HyperFormula.registerFunctionPlugin(CustomFunctionsPlugin);
106053
106121
  hfInstance = HyperFormula.buildEmpty({
106054
106122
  licenseKey: "gpl-v3"
106055
106123
  });
@@ -106064,38 +106132,19 @@ class Action {
106064
106132
  account_name: transaction2._account_name || "",
106065
106133
  category_name: transaction2._category_name || ""
106066
106134
  };
106067
- let row = 1;
106068
106135
  for (const key of Object.keys(fieldValues)) {
106069
- hfInstance.setCellContents({ sheet: sheetId, col: 0, row }, [[""]]);
106070
- hfInstance.addNamedExpression(key, `=Sheet1!$A$${row + 1}`);
106071
- row++;
106072
- }
106073
- hfInstance.setCellContents({ sheet: sheetId, col: 0, row: 0 }, [
106074
- [formula]
106075
- ]);
106076
- const parserCache = hfInstance._parser.cache.cache;
106077
- const cacheEntry = parserCache.get(formula);
106078
- const usedVariables = /* @__PURE__ */ new Set();
106079
- if (cacheEntry && cacheEntry.ast) {
106080
- const extractedVars = this.extractVariablesFromAST(cacheEntry.ast);
106081
- for (const variable of extractedVars) {
106082
- usedVariables.add(variable);
106083
- }
106084
- }
106085
- row = 1;
106086
- for (const [, value] of Object.entries(fieldValues)) {
106087
106136
  let cellValue2;
106088
- if (value === void 0 || value === null || typeof value === "object") {
106137
+ if (fieldValues[key] === void 0 || fieldValues[key] === null || typeof fieldValues[key] === "object") {
106089
106138
  cellValue2 = "";
106090
106139
  }
106091
106140
  else {
106092
- cellValue2 = value;
106141
+ cellValue2 = fieldValues[key];
106093
106142
  }
106094
- hfInstance.setCellContents({ sheet: sheetId, col: 0, row }, [
106095
- [cellValue2]
106096
- ]);
106097
- row++;
106143
+ hfInstance.addNamedExpression(key, cellValue2);
106098
106144
  }
106145
+ hfInstance.setCellContents({ sheet: sheetId, col: 0, row: 0 }, [
106146
+ [formula]
106147
+ ]);
106099
106148
  const cellAddress = { sheet: sheetId, col: 0, row: 0 };
106100
106149
  const cellValue = hfInstance.getCellValue(cellAddress);
106101
106150
  if (cellValue && typeof cellValue === "object" && "type" in cellValue) {
@@ -111290,49 +111339,6 @@ async function getCategoryTemplates() {
111290
111339
  }
111291
111340
  return templates;
111292
111341
  }
111293
- const currencies = [
111294
- { code: "", name: "None", symbol: "", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: true },
111295
- { code: "AED", name: "UAE Dirham", symbol: "د.إ", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: false },
111296
- { code: "ARS", name: "Argentinian Peso", symbol: "Arg$", decimalPlaces: 2, numberFormat: "dot-comma", symbolFirst: true },
111297
- { code: "AUD", name: "Australian Dollar", symbol: "A$", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: true },
111298
- { code: "BRL", name: "Brazilian Real", symbol: "R$", decimalPlaces: 2, numberFormat: "dot-comma", symbolFirst: true },
111299
- { code: "BYN", name: "Belarusian Ruble", symbol: "Br", decimalPlaces: 2, numberFormat: "space-comma", symbolFirst: false },
111300
- { code: "CAD", name: "Canadian Dollar", symbol: "CA$", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: true },
111301
- { code: "CHF", name: "Swiss Franc", symbol: "Fr.", decimalPlaces: 2, numberFormat: "apostrophe-dot", symbolFirst: true },
111302
- { code: "CNY", name: "Yuan Renminbi", symbol: "¥", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: true },
111303
- { code: "COP", name: "Colombian Peso", symbol: "Col$", decimalPlaces: 2, numberFormat: "dot-comma", symbolFirst: true },
111304
- { code: "CRC", name: "Costa Rican Colón", symbol: "₡", decimalPlaces: 2, numberFormat: "space-comma", symbolFirst: true },
111305
- { code: "DKK", name: "Danish Krone", symbol: "kr", decimalPlaces: 2, numberFormat: "dot-comma", symbolFirst: false },
111306
- { code: "EGP", name: "Egyptian Pound", symbol: "ج.م", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: false },
111307
- { code: "EUR", name: "Euro", symbol: "€", decimalPlaces: 2, numberFormat: "dot-comma", symbolFirst: false },
111308
- { code: "GBP", name: "Pound Sterling", symbol: "£", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: true },
111309
- { code: "GTQ", name: "Guatemalan Quetzal", symbol: "Q", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: true },
111310
- { code: "HKD", name: "Hong Kong Dollar", symbol: "HK$", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: true },
111311
- { code: "IDR", name: "Indonesian Rupiah", symbol: "Rp", decimalPlaces: 2, numberFormat: "dot-comma", symbolFirst: true },
111312
- { code: "INR", name: "Indian Rupee", symbol: "₹", decimalPlaces: 2, numberFormat: "comma-dot-in", symbolFirst: true },
111313
- { code: "JMD", name: "Jamaican Dollar", symbol: "J$", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: true },
111314
- { code: "JPY", name: "Japanese Yen", symbol: "¥", decimalPlaces: 0, numberFormat: "comma-dot", symbolFirst: true },
111315
- { code: "LKR", name: "Sri Lankan Rupee", symbol: "Rs.", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: true },
111316
- { code: "MDL", name: "Moldovan Leu", symbol: "L", decimalPlaces: 2, numberFormat: "dot-comma", symbolFirst: false },
111317
- { code: "MYR", name: "Malaysian Ringgit", symbol: "RM", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: true },
111318
- { code: "PHP", name: "Philippine Peso", symbol: "₱", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: true },
111319
- { code: "PLN", name: "Polish Złoty", symbol: "zł", decimalPlaces: 2, numberFormat: "space-comma", symbolFirst: false },
111320
- { code: "QAR", name: "Qatari Riyal", symbol: "ر.ق", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: false },
111321
- { code: "RON", name: "Romanian Leu", symbol: "lei", decimalPlaces: 2, numberFormat: "dot-comma", symbolFirst: false },
111322
- { code: "RSD", name: "Serbian Dinar", symbol: "дин", decimalPlaces: 2, numberFormat: "dot-comma", symbolFirst: false },
111323
- { code: "RUB", name: "Russian Ruble", symbol: "₽", decimalPlaces: 2, numberFormat: "space-comma", symbolFirst: false },
111324
- { code: "SAR", name: "Saudi Riyal", symbol: "ر.س", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: false },
111325
- { code: "SEK", name: "Swedish Krona", symbol: "kr", decimalPlaces: 2, numberFormat: "space-comma", symbolFirst: false },
111326
- { code: "SGD", name: "Singapore Dollar", symbol: "S$", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: true },
111327
- { code: "THB", name: "Thai Baht", symbol: "฿", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: true },
111328
- { code: "TRY", name: "Turkish Lira", symbol: "₺", decimalPlaces: 2, numberFormat: "dot-comma", symbolFirst: true },
111329
- { code: "UAH", name: "Ukrainian Hryvnia", symbol: "₴", decimalPlaces: 2, numberFormat: "space-comma", symbolFirst: false },
111330
- { code: "USD", name: "US Dollar", symbol: "$", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: true },
111331
- { code: "UZS", name: "Uzbek Soum", symbol: "UZS", decimalPlaces: 2, numberFormat: "space-comma", symbolFirst: false }
111332
- ];
111333
- function getCurrency(code) {
111334
- return currencies.find((c) => c.code === code) || currencies[0];
111335
- }
111336
111342
  var isArguments$1;
111337
111343
  var hasRequiredIsArguments$2;
111338
111344
  function requireIsArguments$2() {
@@ -115393,7 +115399,7 @@ async function findStartDate(schedule) {
115393
115399
  const conditions = schedule._conditions;
115394
115400
  const dateCond = conditions.find((c) => c.field === "date");
115395
115401
  let currentConfig = dateCond.value;
115396
- while (1) {
115402
+ while (true) {
115397
115403
  const prevConfig = currentConfig;
115398
115404
  currentConfig = { ...prevConfig };
115399
115405
  switch (currentConfig.frequency) {
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@actual-app/api",
3
- "version": "26.1.0-nightly.20251207",
3
+ "version": "26.1.0-nightly.20251209",
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.20251207",
3
+ "version": "26.1.0-nightly.20251209",
4
4
  "license": "MIT",
5
5
  "description": "An API for Actual",
6
6
  "engines": {