@fuzzle/opencode-accountant 0.13.11 → 0.13.12-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 +8 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -17015,8 +17015,9 @@ function moveCsvToDone(csvFile, pendingDir, doneDir) {
17015
17015
  const destPath = path2.join(doneDir, relativePath);
17016
17016
  ensureDirectory(path2.dirname(destPath));
17017
17017
  fs3.renameSync(csvFile, destPath);
17018
- if (csvFile.endsWith("-filtered.csv")) {
17019
- const originalCsv = csvFile.replace(/-filtered\.csv$/, ".csv");
17018
+ const suffix = csvFile.endsWith("-filtered.csv") ? "-filtered.csv" : csvFile.endsWith("-simple.csv") ? "-simple.csv" : null;
17019
+ if (suffix) {
17020
+ const originalCsv = csvFile.replace(new RegExp(`${suffix.replace(".", "\\.")}$`), ".csv");
17020
17021
  if (fs3.existsSync(originalCsv)) {
17021
17022
  const originalRelative = path2.relative(pendingDir, originalCsv);
17022
17023
  const originalDest = path2.join(doneDir, originalRelative);
@@ -24730,7 +24731,10 @@ function formatJournalEntry(match2) {
24730
24731
  if (hasFees) {
24731
24732
  const feeAmount = formatAmount(btcRow.fees.amount);
24732
24733
  const feeCurrency = btcRow.fees.currency;
24733
- postings.push({ account: "expenses:fees:btc", amount: `${feeAmount} ${feeCurrency}` });
24734
+ postings.push({
24735
+ account: `expenses:fees:revolut:${feeCurrency.toLowerCase()}`,
24736
+ amount: `${feeAmount} ${feeCurrency}`
24737
+ });
24734
24738
  }
24735
24739
  postings.push({ account: equityFiat, amount: `${netFiat} ${fiatCurrency}` }, { account: equityBtc, amount: `-${btcQuantity} BTC` }, { account: "assets:bank:revolut:btc", amount: `${btcQuantity} BTC${costAnnotation}` });
24736
24740
  return `${date5} Bitcoin purchase
@@ -24797,7 +24801,7 @@ function generateBtcPurchaseJournal(fiatCsvPaths, btcCsvPath, yearJournalPath, l
24797
24801
  accountsUsed.add(`equity:conversion:${pair}:btc`);
24798
24802
  accountsUsed.add("assets:bank:revolut:btc");
24799
24803
  if (match2.btcRow.fees.amount > 0) {
24800
- accountsUsed.add("expenses:fees:btc");
24804
+ accountsUsed.add(`expenses:fees:revolut:${match2.btcRow.fees.currency.toLowerCase()}`);
24801
24805
  }
24802
24806
  if (isDuplicate(match2, journalContent)) {
24803
24807
  skippedDuplicates++;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fuzzle/opencode-accountant",
3
- "version": "0.13.11",
3
+ "version": "0.13.12-next.1",
4
4
  "description": "An OpenCode accounting agent, specialized in double-entry-bookkepping with hledger",
5
5
  "author": {
6
6
  "name": "ali bengali",