@fuzzle/opencode-accountant 0.11.0-next.1 → 0.12.0-next.1

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.
Files changed (2) hide show
  1. package/dist/index.js +3 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -25915,9 +25915,9 @@ function parseExchangeRows(csvPath) {
25915
25915
  if (fields.length < 9)
25916
25916
  continue;
25917
25917
  const [type2, , startedDate, , description, amountStr, , currency] = fields;
25918
- if (type2 !== "EXCHANGE")
25918
+ if (type2?.toUpperCase() !== "EXCHANGE")
25919
25919
  continue;
25920
- if (!description?.startsWith("Exchanged to"))
25920
+ if (!/^Exchanged to [A-Z]{3}$/.test(description ?? ""))
25921
25921
  continue;
25922
25922
  const rawAmount = parseFloat(amountStr);
25923
25923
  const date5 = parseRevolutDatetime(startedDate);
@@ -25979,11 +25979,9 @@ function formatExchangeEntry(match2) {
25979
25979
  const targetCurrency = target.currency;
25980
25980
  const sourceAmount = formatAmount3(source.amount);
25981
25981
  const targetAmount = formatAmount3(target.amount);
25982
- const rate = target.amount / source.amount;
25983
- const rateStr = formatRate(rate);
25984
25982
  return [
25985
25983
  `${date5} ${description}`,
25986
- ` assets:bank:revolut:${sourceCurrency.toLowerCase()} -${sourceAmount} ${sourceCurrency} @ ${rateStr} ${targetCurrency}`,
25984
+ ` assets:bank:revolut:${sourceCurrency.toLowerCase()} -${sourceAmount} ${sourceCurrency}`,
25987
25985
  ` equity:currency:conversion ${sourceAmount} ${sourceCurrency}`,
25988
25986
  ` equity:currency:conversion -${targetAmount} ${targetCurrency}`,
25989
25987
  ` assets:bank:revolut:${targetCurrency.toLowerCase()} ${targetAmount} ${targetCurrency}`
@@ -25993,9 +25991,6 @@ function formatExchangeEntry(match2) {
25993
25991
  function formatAmount3(amount) {
25994
25992
  return amount.toFixed(2);
25995
25993
  }
25996
- function formatRate(rate) {
25997
- return rate.toFixed(4);
25998
- }
25999
25994
  function isDuplicate2(match2, journalContent) {
26000
25995
  const date5 = match2.source.dateStr;
26001
25996
  const description = match2.source.description;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fuzzle/opencode-accountant",
3
- "version": "0.11.0-next.1",
3
+ "version": "0.12.0-next.1",
4
4
  "description": "An OpenCode accounting agent, specialized in double-entry-bookkepping with hledger",
5
5
  "author": {
6
6
  "name": "ali bengali",