summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2024-03-08 15:36:50 -0300
committerSebastian <sebasjm@gmail.com>2024-03-08 15:39:59 -0300
commite92440e257b4df4a232a28701143a4f9db730458 (patch)
tree85c8bc084cf0089de9b7034de6f9db82d58e308e /packages/taler-wallet-core
parent8dea5ac8f41e1d17163a08ba203f15ec372cd442 (diff)
downloadwallet-core-e92440e257b4df4a232a28701143a4f9db730458.tar.gz
wallet-core-e92440e257b4df4a232a28701143a4f9db730458.tar.bz2
wallet-core-e92440e257b4df4a232a28701143a4f9db730458.zip
fix #8489
Diffstat (limited to 'packages/taler-wallet-core')
-rw-r--r--packages/taler-wallet-core/src/observable-wrappers.ts46
-rw-r--r--packages/taler-wallet-core/src/wallet.ts10
2 files changed, 9 insertions, 47 deletions
diff --git a/packages/taler-wallet-core/src/observable-wrappers.ts b/packages/taler-wallet-core/src/observable-wrappers.ts
index 5653f185e..5a8be9cf6 100644
--- a/packages/taler-wallet-core/src/observable-wrappers.ts
+++ b/packages/taler-wallet-core/src/observable-wrappers.ts
@@ -25,14 +25,8 @@ import { IDBDatabase } from "@gnu-taler/idb-bridge";
import {
ObservabilityContext,
ObservabilityEventType,
- RetryLoopOpts,
- getErrorDetailFromException,
+ RetryLoopOpts
} from "@gnu-taler/taler-util";
-import {
- HttpRequestLibrary,
- HttpRequestOptions,
- HttpResponse,
-} from "@gnu-taler/taler-util/http";
import { TaskIdStr } from "./common.js";
import { TalerCryptoInterface } from "./index.js";
import {
@@ -50,7 +44,7 @@ export class ObservableTaskScheduler implements TaskScheduler {
constructor(
private impl: TaskScheduler,
private oc: ObservabilityContext,
- ) {}
+ ) { }
private taskDepCache = new Set<string>();
@@ -70,7 +64,7 @@ export class ObservableTaskScheduler implements TaskScheduler {
getActiveTasks(): TaskIdStr[] {
return this.impl.getActiveTasks();
}
-
+
ensureRunning(): void {
return this.impl.ensureRunning();
}
@@ -110,38 +104,6 @@ export class ObservableTaskScheduler implements TaskScheduler {
}
}
-export class ObservableHttpClientLibrary implements HttpRequestLibrary {
- constructor(
- private impl: HttpRequestLibrary,
- private oc: ObservabilityContext,
- ) {}
- async fetch(
- url: string,
- opt?: HttpRequestOptions | undefined,
- ): Promise<HttpResponse> {
- this.oc.observe({
- type: ObservabilityEventType.HttpFetchStart,
- url: url,
- });
- try {
- const res = await this.impl.fetch(url, opt);
- this.oc.observe({
- type: ObservabilityEventType.HttpFetchFinishSuccess,
- url,
- status: res.status,
- });
- return res;
- } catch (e) {
- this.oc.observe({
- type: ObservabilityEventType.HttpFetchFinishError,
- url,
- error: getErrorDetailFromException(e),
- });
- throw e;
- }
- }
-}
-
const locRegex = /\s*at\s*([a-zA-Z0-9_.!]*)\s*/;
export function getCallerInfo(up: number = 2): string {
@@ -160,7 +122,7 @@ export class ObservableDbAccess<StoreMap> implements DbAccess<StoreMap> {
constructor(
private impl: DbAccess<StoreMap>,
private oc: ObservabilityContext,
- ) {}
+ ) { }
idbHandle(): IDBDatabase {
return this.impl.idbHandle();
}
diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts
index 46f58ec81..1602eb158 100644
--- a/packages/taler-wallet-core/src/wallet.ts
+++ b/packages/taler-wallet-core/src/wallet.ts
@@ -144,6 +144,7 @@ import {
parseTalerUri,
sampleWalletCoreTransactions,
setDangerousTimetravel,
+ ObservableHttpClientLibrary,
validateIban,
} from "@gnu-taler/taler-util";
import type { HttpRequestLibrary } from "@gnu-taler/taler-util/http";
@@ -211,7 +212,6 @@ import {
} from "./instructedAmountConversion.js";
import {
ObservableDbAccess,
- ObservableHttpClientLibrary,
ObservableTaskScheduler,
observeTalerCrypto,
} from "./observable-wrappers.js";
@@ -521,9 +521,9 @@ async function dumpCoins(wex: WalletExecutionContext): Promise<CoinDumpJson> {
ageCommitmentProof: c.ageCommitmentProof,
spend_allocation: c.spendAllocation
? {
- amount: c.spendAllocation.amount,
- id: c.spendAllocation.id,
- }
+ amount: c.spendAllocation.amount,
+ id: c.spendAllocation.id,
+ }
: undefined,
});
}
@@ -1526,7 +1526,7 @@ async function handleCoreApiRequest(
wex = getObservedWalletExecutionContext(ws, CancellationToken.CONTINUE, oc);
} else {
oc = {
- observe(evt) {},
+ observe(evt) { },
};
wex = getNormalWalletExecutionContext(ws, CancellationToken.CONTINUE, oc);
}