From 8b18eb19c0900df69eaf0e35e1cc1f09e4c875e1 Mon Sep 17 00:00:00 2001 From: Nisan Date: Sun, 8 Sep 2024 22:06:35 +0300 Subject: [PATCH] Buxfer version bump, abandon the attempt to update transaction status changes from moneyman (#344) * Bump buxfer minor, abandon the effort to update pending transactions --------- Co-authored-by: Daniel Hauser <36034483+daniel-hauser@users.noreply.github.com> Co-authored-by: Daniel Hauser --- package-lock.json | 15 ++++++++------- package.json | 2 +- src/storage/buxfer.ts | 11 +++++++++-- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3241c48..3383168 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "dependencies": { "azure-kusto-data": "^6.0.2", "azure-kusto-ingest": "^6.0.2", - "buxfer-ts-client": "^1.0.4", + "buxfer-ts-client": "^1.1.0", "date-fns": "^3.6.0", "debug": "^4.3.6", "dotenv": "^16.4.5", @@ -2305,9 +2305,10 @@ "integrity": "sha512-HpGFw18DgFWlncDfjTa2rcQ4W88O1mC8e8yZ2AvQY5KDaktSTwo+KRf6nHK6FRI5FyRyb/5T6+TSxfP7QyGsmQ==" }, "node_modules/buxfer-ts-client": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/buxfer-ts-client/-/buxfer-ts-client-1.0.4.tgz", - "integrity": "sha512-PuvNPWWcPNCxnUb/qFhccy0yEfQZop7c/gyDVwgrA7JcsARtxzoU0BAYBs1wwXXv8YBhHCV6Il7T0cDFfvosSw==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/buxfer-ts-client/-/buxfer-ts-client-1.1.0.tgz", + "integrity": "sha512-/ntRCoFDgmevmjqpEguglHUpHd92Ew2Oe5Wr41UZtfll7z2yOMaw/u6r7/BS9564SIm71Nbxcbip7bAjJfhZ9g==", + "license": "MIT", "dependencies": { "axios": "^1.6.8", "date-fns": "^3.6.0", @@ -8492,9 +8493,9 @@ "integrity": "sha512-HpGFw18DgFWlncDfjTa2rcQ4W88O1mC8e8yZ2AvQY5KDaktSTwo+KRf6nHK6FRI5FyRyb/5T6+TSxfP7QyGsmQ==" }, "buxfer-ts-client": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/buxfer-ts-client/-/buxfer-ts-client-1.0.4.tgz", - "integrity": "sha512-PuvNPWWcPNCxnUb/qFhccy0yEfQZop7c/gyDVwgrA7JcsARtxzoU0BAYBs1wwXXv8YBhHCV6Il7T0cDFfvosSw==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/buxfer-ts-client/-/buxfer-ts-client-1.1.0.tgz", + "integrity": "sha512-/ntRCoFDgmevmjqpEguglHUpHd92Ew2Oe5Wr41UZtfll7z2yOMaw/u6r7/BS9564SIm71Nbxcbip7bAjJfhZ9g==", "requires": { "axios": "^1.6.8", "date-fns": "^3.6.0", diff --git a/package.json b/package.json index 532fed5..e14f70e 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "dependencies": { "azure-kusto-data": "^6.0.2", "azure-kusto-ingest": "^6.0.2", - "buxfer-ts-client": "^1.0.4", + "buxfer-ts-client": "^1.1.0", "date-fns": "^3.6.0", "debug": "^4.3.6", "dotenv": "^16.4.5", diff --git a/src/storage/buxfer.ts b/src/storage/buxfer.ts index 3a00f60..8ccd9a8 100644 --- a/src/storage/buxfer.ts +++ b/src/storage/buxfer.ts @@ -45,6 +45,13 @@ export class BuxferStorage implements TransactionStorage { const missingAccounts = new Set(); for (const tx of txns) { + const isPending = tx.status === TransactionStatuses.Pending; + // Ignore pending and only upload completed transactions + if (isPending) { + stats.skipped++; + continue; + } + const accountId = this.accountToBuxferAccount.get(tx.account); if (!accountId) { missingAccounts.add(tx.account); @@ -68,10 +75,10 @@ export class BuxferStorage implements TransactionStorage { `sending to Buxfer accounts: "${this.accountToBuxferAccount.keys()}"`, ); const resp: AddTransactionsResponse = - await this.buxferClient.addTransactions(txToSend, true); + await this.buxferClient.addTransactions(txToSend, false); logger("transactions sent to Buxfer successfully!"); stats.added = resp.addedTransactionIds.length; - stats.existing = resp.duplicatedTransactionIds.length; + stats.existing = resp.existingTransactionIds.length; stats.skipped += stats.existing; }