From f180d0580457e1e9bd502293df327dfe138dd422 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 12 Aug 2020 12:41:00 +0530 Subject: remove excessive namespacing, format --- packages/taler-wallet-core/package.json | 2 +- .../src/crypto/workers/cryptoApi.ts | 1 - .../src/crypto/workers/nodeThreadWorker.ts | 2 +- packages/taler-wallet-core/src/index.ts | 39 ++++++++++------------ .../taler-wallet-core/src/operations/refund.ts | 3 +- .../taler-wallet-core/src/types/walletTypes.ts | 9 ++--- .../taler-wallet-core/src/util/talerconfig-test.ts | 2 +- packages/taler-wallet-core/src/util/talerconfig.ts | 10 ++++-- packages/taler-wallet-core/src/util/timer.ts | 6 ++-- 9 files changed, 35 insertions(+), 39 deletions(-) (limited to 'packages/taler-wallet-core') diff --git a/packages/taler-wallet-core/package.json b/packages/taler-wallet-core/package.json index 981504e4c..73bb530bc 100644 --- a/packages/taler-wallet-core/package.json +++ b/packages/taler-wallet-core/package.json @@ -13,7 +13,7 @@ "license": "GPL-3.0", "scripts": { "compile": "tsc && rollup -c", - "pretty": "prettier --config ../../.prettierrc --write src", + "pretty": "prettier --write src", "test": "tsc && ava", "coverage": "tsc && nyc ava", "clean": "rimraf dist lib" diff --git a/packages/taler-wallet-core/src/crypto/workers/cryptoApi.ts b/packages/taler-wallet-core/src/crypto/workers/cryptoApi.ts index 20d13a3f2..802a153ff 100644 --- a/packages/taler-wallet-core/src/crypto/workers/cryptoApi.ts +++ b/packages/taler-wallet-core/src/crypto/workers/cryptoApi.ts @@ -46,7 +46,6 @@ import { import * as timer from "../../util/timer"; import { Logger } from "../../util/logging"; -import { walletCoreApi } from "../.."; const logger = new Logger("cryptoApi.ts"); diff --git a/packages/taler-wallet-core/src/crypto/workers/nodeThreadWorker.ts b/packages/taler-wallet-core/src/crypto/workers/nodeThreadWorker.ts index d4d858330..48efdbce6 100644 --- a/packages/taler-wallet-core/src/crypto/workers/nodeThreadWorker.ts +++ b/packages/taler-wallet-core/src/crypto/workers/nodeThreadWorker.ts @@ -149,7 +149,7 @@ class NodeThreadCryptoWorker implements CryptoWorker { const worker_threads = require("worker_threads"); logger.trace("starting node crypto worker"); - + this.nodeWorker = new worker_threads.Worker(workerCode, { eval: true }); this.nodeWorker.on("error", (err: Error) => { console.error("error in node worker:", err); diff --git a/packages/taler-wallet-core/src/index.ts b/packages/taler-wallet-core/src/index.ts index 5c4961bd7..954798e46 100644 --- a/packages/taler-wallet-core/src/index.ts +++ b/packages/taler-wallet-core/src/index.ts @@ -26,57 +26,52 @@ export { export { Amounts, AmountJson } from "./util/amounts"; export { Logger } from "./util/logging"; -export * as talerCrypto from "./crypto/talerCrypto"; +export * from "./crypto/talerCrypto"; export { OperationFailedAndReportedError, OperationFailedError, makeErrorDetails, } from "./operations/errors"; -export * as walletTypes from "./types/walletTypes"; +export * from "./types/walletTypes"; -export * as talerTypes from "./types/talerTypes"; +export * from "./types/talerTypes"; -export * as walletCoreApi from "./walletCoreApiHandler"; +export * from "./walletCoreApiHandler"; -export * as taleruri from "./util/taleruri"; +export * from "./util/taleruri"; -export * as time from "./util/time"; +export * from "./util/time"; -export * as codec from "./util/codec"; +export * from "./util/codec"; export { NodeHttpLib } from "./headless/NodeHttpLib"; -export * as payto from "./util/payto"; +export * from "./util/payto"; -export * as testvectors from "./util/testvectors"; +export * from "./util/testvectors"; -export * as versions from "./operations/versions"; +export * from "./operations/versions"; export type { CryptoWorker } from "./crypto/workers/cryptoWorker"; export type { CryptoWorkerFactory } from "./crypto/workers/cryptoApi"; -export * as httpLib from "./util/http"; +export * from "./util/http"; export { TalerErrorCode } from "./TalerErrorCode"; -export * as queryLib from "./util/query"; +export * from "./util/query"; export { CryptoImplementation } from "./crypto/workers/cryptoImplementation"; -export * as db from "./db"; +export * from "./db"; -export * as promiseUtil from "./util/promiseUtils"; +export * from "./util/promiseUtils"; -export * as i18n from "./i18n"; +export * from "./i18n"; -export * as nodeThreadWorker from "./crypto/workers/nodeThreadWorker"; +export * from "./crypto/workers/nodeThreadWorker"; -export * as walletNotifications from "./types/notifications"; +export * from "./types/notifications"; export { Configuration } from "./util/talerconfig"; - -export { - handleWorkerMessage, - handleWorkerError, -} from "./crypto/workers/nodeThreadWorker"; diff --git a/packages/taler-wallet-core/src/operations/refund.ts b/packages/taler-wallet-core/src/operations/refund.ts index d7aaf7272..1462600f4 100644 --- a/packages/taler-wallet-core/src/operations/refund.ts +++ b/packages/taler-wallet-core/src/operations/refund.ts @@ -413,7 +413,8 @@ export async function applyRefund( ).amount, ).amount; } else { - amountRefundGone = Amounts.add(amountRefundGone, refund.refundAmount).amount; + amountRefundGone = Amounts.add(amountRefundGone, refund.refundAmount) + .amount; } }); diff --git a/packages/taler-wallet-core/src/types/walletTypes.ts b/packages/taler-wallet-core/src/types/walletTypes.ts index 26d7e8e0c..8faace033 100644 --- a/packages/taler-wallet-core/src/types/walletTypes.ts +++ b/packages/taler-wallet-core/src/types/walletTypes.ts @@ -44,7 +44,6 @@ import { codecForBoolean, } from "../util/codec"; import { AmountString } from "./talerTypes"; -import { codec } from ".."; import { TransactionError } from "./transactions"; /** @@ -202,20 +201,18 @@ export const enum ConfirmPayResultType { * Result for confirmPay */ export interface ConfirmPayResultDone { - type: ConfirmPayResultType.Done, + type: ConfirmPayResultType.Done; nextUrl: string; } export interface ConfirmPayResultPending { - type: ConfirmPayResultType.Pending, + type: ConfirmPayResultType.Pending; lastError: TransactionError; } -export type ConfirmPayResult = - | ConfirmPayResultDone - | ConfirmPayResultPending +export type ConfirmPayResult = ConfirmPayResultDone | ConfirmPayResultPending; /** * Information about all sender wire details known to the wallet, diff --git a/packages/taler-wallet-core/src/util/talerconfig-test.ts b/packages/taler-wallet-core/src/util/talerconfig-test.ts index 71359fd38..2f920fccf 100644 --- a/packages/taler-wallet-core/src/util/talerconfig-test.ts +++ b/packages/taler-wallet-core/src/util/talerconfig-test.ts @@ -29,7 +29,7 @@ test("pathsub", (t) => { w: "world", f: "foo", "1foo": "x", - "foo_bar": "quux", + foo_bar: "quux", }; t.is( diff --git a/packages/taler-wallet-core/src/util/talerconfig.ts b/packages/taler-wallet-core/src/util/talerconfig.ts index e9a67287c..d121601c5 100644 --- a/packages/taler-wallet-core/src/util/talerconfig.ts +++ b/packages/taler-wallet-core/src/util/talerconfig.ts @@ -79,7 +79,7 @@ export class ConfigValue { /** * Shell-style path substitution. - * + * * Supported patterns: * "$x" (look up "x") * "${x}" (look up "x") @@ -240,7 +240,9 @@ export class Configuration { } else if (x === "no") { return false; } - throw Error(`invalid config value for [${secNorm}]/${optNorm}, expected yes/no`); + throw Error( + `invalid config value for [${secNorm}]/${optNorm}, expected yes/no`, + ); }; return new ConfigValue(secNorm, optNorm, val, convert); } @@ -253,7 +255,9 @@ export class Configuration { try { return Number.parseInt(x, 10); } catch (e) { - throw Error(`invalid config value for [${secNorm}]/${optNorm}, expected number`); + throw Error( + `invalid config value for [${secNorm}]/${optNorm}, expected number`, + ); } }; return new ConfigValue(secNorm, optNorm, val, convert); diff --git a/packages/taler-wallet-core/src/util/timer.ts b/packages/taler-wallet-core/src/util/timer.ts index d652fdcda..75fb5c9c0 100644 --- a/packages/taler-wallet-core/src/util/timer.ts +++ b/packages/taler-wallet-core/src/util/timer.ts @@ -121,7 +121,7 @@ const nullTimerHandle = { unref() { // do nothing return; - } + }, }; /** @@ -173,7 +173,7 @@ export class TimerGroup { }, unref() { h.unref(); - } + }, }; } @@ -195,7 +195,7 @@ export class TimerGroup { }, unref() { h.unref(); - } + }, }; } } -- cgit v1.2.3