aboutsummaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2023-01-09 08:33:41 -0300
committerSebastian <sebasjm@gmail.com>2023-01-09 08:33:41 -0300
commit14f3d1e06dda003d457f2b3531e197011a284244 (patch)
treeede108e65dba6188b1a7af8d16bd95b957a4c858 /packages
parent417c07f3f4866918e1aaa6d42b7d5ec0ca59dd51 (diff)
wallet-core pretty
Diffstat (limited to 'packages')
-rw-r--r--packages/taler-wallet-core/src/crypto/workers/crypto-dispatcher.test.ts22
-rw-r--r--packages/taler-wallet-core/src/crypto/workers/crypto-dispatcher.ts10
-rw-r--r--packages/taler-wallet-core/src/crypto/workers/nodeThreadWorker.ts4
-rw-r--r--packages/taler-wallet-core/src/db.ts6
-rw-r--r--packages/taler-wallet-core/src/operations/backup/import.ts4
-rw-r--r--packages/taler-wallet-core/src/operations/common.ts2
6 files changed, 24 insertions, 24 deletions
diff --git a/packages/taler-wallet-core/src/crypto/workers/crypto-dispatcher.test.ts b/packages/taler-wallet-core/src/crypto/workers/crypto-dispatcher.test.ts
index b63c9bf11..df2e645a7 100644
--- a/packages/taler-wallet-core/src/crypto/workers/crypto-dispatcher.test.ts
+++ b/packages/taler-wallet-core/src/crypto/workers/crypto-dispatcher.test.ts
@@ -16,11 +16,13 @@
import test from "ava";
import { CryptoDispatcher, CryptoWorkerFactory } from "./crypto-dispatcher.js";
-import { CryptoWorker, CryptoWorkerResponseMessage } from "./cryptoWorkerInterface.js";
+import {
+ CryptoWorker,
+ CryptoWorkerResponseMessage,
+} from "./cryptoWorkerInterface.js";
import { SynchronousCryptoWorkerFactoryNode } from "./synchronousWorkerFactoryNode.js";
import { processRequestWithImpl } from "./worker-common.js";
-
export class MyCryptoWorker implements CryptoWorker {
/**
* Function to be called when we receive a message from the worker thread.
@@ -64,8 +66,8 @@ export class MyCryptoWorker implements CryptoWorker {
type: "success",
result: {
testResult: 42,
- }
- }
+ },
+ };
} else if (msg.operation === "testError") {
responseMsg = {
id: msg.id,
@@ -73,8 +75,8 @@ export class MyCryptoWorker implements CryptoWorker {
error: {
code: 42,
hint: "bla",
- }
- }
+ },
+ };
} else if (msg.operation === "testTimeout") {
// Don't respond
return;
@@ -98,8 +100,6 @@ export class MyCryptoWorker implements CryptoWorker {
}
}
-
-
export class MyCryptoWorkerFactory implements CryptoWorkerFactory {
startWorker(): CryptoWorker {
return new MyCryptoWorker();
@@ -111,12 +111,10 @@ export class MyCryptoWorkerFactory implements CryptoWorkerFactory {
}
test("continues after error", async (t) => {
- const cryptoDisp = new CryptoDispatcher(
- new MyCryptoWorkerFactory(),
- );
+ const cryptoDisp = new CryptoDispatcher(new MyCryptoWorkerFactory());
const resp1 = await cryptoDisp.doRpc("testSuccess", 0, {});
t.assert((resp1 as any).testResult === 42);
- const exc = await t.throwsAsync(async() => {
+ const exc = await t.throwsAsync(async () => {
const resp2 = await cryptoDisp.doRpc("testError", 0, {});
});
diff --git a/packages/taler-wallet-core/src/crypto/workers/crypto-dispatcher.ts b/packages/taler-wallet-core/src/crypto/workers/crypto-dispatcher.ts
index 940078ea6..f086691e5 100644
--- a/packages/taler-wallet-core/src/crypto/workers/crypto-dispatcher.ts
+++ b/packages/taler-wallet-core/src/crypto/workers/crypto-dispatcher.ts
@@ -308,11 +308,7 @@ export class CryptoDispatcher {
}
}
- doRpc<T>(
- operation: string,
- priority: number,
- req: unknown,
- ): Promise<T> {
+ doRpc<T>(operation: string, priority: number, req: unknown): Promise<T> {
if (this.stopped) {
throw new CryptoApiStoppedError();
}
@@ -364,7 +360,9 @@ export class CryptoDispatcher {
const onTimeout = () => {
// FIXME: Maybe destroy and re-init worker if request is in processing
// state and really taking too long?
- logger.warn(`crypto RPC call ('${operation}') has been queued for a long time`);
+ logger.warn(
+ `crypto RPC call ('${operation}') has been queued for a long time`,
+ );
timeoutHandle = timer.after(timeoutMs, onTimeout);
};
myProm.promise
diff --git a/packages/taler-wallet-core/src/crypto/workers/nodeThreadWorker.ts b/packages/taler-wallet-core/src/crypto/workers/nodeThreadWorker.ts
index db8bb4737..d9b4399d6 100644
--- a/packages/taler-wallet-core/src/crypto/workers/nodeThreadWorker.ts
+++ b/packages/taler-wallet-core/src/crypto/workers/nodeThreadWorker.ts
@@ -27,7 +27,9 @@ import { processRequestWithImpl } from "./worker-common.js";
const logger = new Logger("nodeThreadWorker.ts");
-const f = import.meta.url ? url.fileURLToPath(import.meta.url) : '__not_available__';
+const f = import.meta.url
+ ? url.fileURLToPath(import.meta.url)
+ : "__not_available__";
const workerCode = `
// Try loading the glue library for embedded
diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts
index 299c7a36c..04fee9495 100644
--- a/packages/taler-wallet-core/src/db.ts
+++ b/packages/taler-wallet-core/src/db.ts
@@ -839,8 +839,8 @@ export enum RefreshOperationStatus {
* Group of refresh operations. The refreshed coins do not
* have to belong to the same exchange, but must have the same
* currency.
- *
- * FIXME: Should include the currency as a top-level field,
+ *
+ * FIXME: Should include the currency as a top-level field,
* but we need to write a migration for that.
*/
export interface RefreshGroupRecord {
@@ -857,7 +857,7 @@ export interface RefreshGroupRecord {
/**
* Currency of this refresh group.
- *
+ *
* FIXME: Write a migration to add this to earlier DB versions.
*/
currency: string;
diff --git a/packages/taler-wallet-core/src/operations/backup/import.ts b/packages/taler-wallet-core/src/operations/backup/import.ts
index 805b0c6d3..c7afaea8e 100644
--- a/packages/taler-wallet-core/src/operations/backup/import.ts
+++ b/packages/taler-wallet-core/src/operations/backup/import.ts
@@ -778,7 +778,9 @@ export async function importBackup(
timestampFinished: backupRefreshGroup.timestamp_finish,
timestampCreated: backupRefreshGroup.timestamp_created,
refreshGroupId: backupRefreshGroup.refresh_group_id,
- currency: Amounts.currencyOf(backupRefreshGroup.old_coins[0].input_amount),
+ currency: Amounts.currencyOf(
+ backupRefreshGroup.old_coins[0].input_amount,
+ ),
reason,
lastErrorPerCoin: {},
oldCoinPubs: backupRefreshGroup.old_coins.map((x) => x.coin_pub),
diff --git a/packages/taler-wallet-core/src/operations/common.ts b/packages/taler-wallet-core/src/operations/common.ts
index cb22105e1..96009eb0b 100644
--- a/packages/taler-wallet-core/src/operations/common.ts
+++ b/packages/taler-wallet-core/src/operations/common.ts
@@ -175,7 +175,7 @@ export async function spendCoins(
await tx.coins.put(coin);
await tx.coinAvailability.put(coinAvailability);
}
-
+
await ws.refreshOps.createRefreshGroup(
ws,
tx,