diff options
42 files changed, 362 insertions, 384 deletions
diff --git a/packages/idb-bridge/src/backend-interface.ts b/packages/idb-bridge/src/backend-interface.ts index 5ca70c8a4..ae43c9df7 100644 --- a/packages/idb-bridge/src/backend-interface.ts +++ b/packages/idb-bridge/src/backend-interface.ts @@ -220,5 +220,5 @@ export interface Backend { clearObjectStore( btx: DatabaseTransaction, objectStoreName: string, - ): Promise<void> + ): Promise<void>; } diff --git a/packages/idb-bridge/src/idb-wpt-ported/README b/packages/idb-bridge/src/idb-wpt-ported/README index 1947074d1..8efc8569a 100644 --- a/packages/idb-bridge/src/idb-wpt-ported/README +++ b/packages/idb-bridge/src/idb-wpt-ported/README @@ -3,11 +3,12 @@ This directory contains test cases from the W3C Web Platform Tests suite for Ind The original code for these tests can be found here: https://github.com/web-platform-tests/wpt/tree/master/IndexedDB The following tests are intentionally not included: -* error-attributes.html (assumes we have a DOM) -* file_support.sub.html (assumes we have a DOM) -* fire-error-event-exception.html (ava can't test unhandled rejections) -* fire-success-event-exception.html (ava can't test unhandled rejections) -* fire-upgradeneeded-event-exception.html (ava can't test unhandled rejections) + +- error-attributes.html (assumes we have a DOM) +- file_support.sub.html (assumes we have a DOM) +- fire-error-event-exception.html (ava can't test unhandled rejections) +- fire-success-event-exception.html (ava can't test unhandled rejections) +- fire-upgradeneeded-event-exception.html (ava can't test unhandled rejections) Test todo: diff --git a/packages/idb-bridge/src/idb-wpt-ported/cursor-overloads.test.ts b/packages/idb-bridge/src/idb-wpt-ported/cursor-overloads.test.ts index 0f0713d1d..c4bce8743 100644 --- a/packages/idb-bridge/src/idb-wpt-ported/cursor-overloads.test.ts +++ b/packages/idb-bridge/src/idb-wpt-ported/cursor-overloads.test.ts @@ -28,76 +28,85 @@ test.cb("WPT test cursor-overloads.htm", (t) => { await checkCursorDirection(store.openCursor(), "next"); await checkCursorDirection(store.openCursor(0), "next"); - await checkCursorDirection(store.openCursor(0, 'next'), "next"); - await checkCursorDirection(store.openCursor(0, 'nextunique'), "nextunique"); - await checkCursorDirection(store.openCursor(0, 'prev'), "prev"); - await checkCursorDirection(store.openCursor(0, 'prevunique'), "prevunique"); + await checkCursorDirection(store.openCursor(0, "next"), "next"); + await checkCursorDirection(store.openCursor(0, "nextunique"), "nextunique"); + await checkCursorDirection(store.openCursor(0, "prev"), "prev"); + await checkCursorDirection(store.openCursor(0, "prevunique"), "prevunique"); await checkCursorDirection(store.openCursor(IDBKeyRange.only(0)), "next"); await checkCursorDirection( - store.openCursor(BridgeIDBKeyRange.only(0), 'next'), + store.openCursor(BridgeIDBKeyRange.only(0), "next"), "next", ); await checkCursorDirection( - store.openCursor(IDBKeyRange.only(0), 'nextunique'), + store.openCursor(IDBKeyRange.only(0), "nextunique"), "nextunique", ); await checkCursorDirection( - store.openCursor(IDBKeyRange.only(0), 'prev'), + store.openCursor(IDBKeyRange.only(0), "prev"), "prev", ); await checkCursorDirection( - store.openCursor(IDBKeyRange.only(0), 'prevunique'), + store.openCursor(IDBKeyRange.only(0), "prevunique"), "prevunique", ); await checkCursorDirection(index.openCursor(), "next"); await checkCursorDirection(index.openCursor(0), "next"); - await checkCursorDirection(index.openCursor(0, 'next'), "next"); - await checkCursorDirection(index.openCursor(0, 'nextunique'), "nextunique"); - await checkCursorDirection(index.openCursor(0, 'prev'), "prev"); - await checkCursorDirection(index.openCursor(0, 'prevunique'), "prevunique"); + await checkCursorDirection(index.openCursor(0, "next"), "next"); + await checkCursorDirection(index.openCursor(0, "nextunique"), "nextunique"); + await checkCursorDirection(index.openCursor(0, "prev"), "prev"); + await checkCursorDirection(index.openCursor(0, "prevunique"), "prevunique"); await checkCursorDirection(index.openCursor(IDBKeyRange.only(0)), "next"); await checkCursorDirection( - index.openCursor(IDBKeyRange.only(0), 'next'), + index.openCursor(IDBKeyRange.only(0), "next"), "next", ); await checkCursorDirection( - index.openCursor(IDBKeyRange.only(0), 'nextunique'), + index.openCursor(IDBKeyRange.only(0), "nextunique"), "nextunique", ); await checkCursorDirection( - index.openCursor(IDBKeyRange.only(0), 'prev'), + index.openCursor(IDBKeyRange.only(0), "prev"), "prev", ); await checkCursorDirection( - index.openCursor(IDBKeyRange.only(0), 'prevunique'), + index.openCursor(IDBKeyRange.only(0), "prevunique"), "prevunique", ); await checkCursorDirection(index.openKeyCursor(), "next"); await checkCursorDirection(index.openKeyCursor(0), "next"); - await checkCursorDirection(index.openKeyCursor(0, 'next'), "next"); - await checkCursorDirection(index.openKeyCursor(0, 'nextunique'), "nextunique"); - await checkCursorDirection(index.openKeyCursor(0, 'prev'), "prev"); - await checkCursorDirection(index.openKeyCursor(0, 'prevunique'), "prevunique"); + await checkCursorDirection(index.openKeyCursor(0, "next"), "next"); + await checkCursorDirection( + index.openKeyCursor(0, "nextunique"), + "nextunique", + ); + await checkCursorDirection(index.openKeyCursor(0, "prev"), "prev"); + await checkCursorDirection( + index.openKeyCursor(0, "prevunique"), + "prevunique", + ); - await checkCursorDirection(index.openKeyCursor(IDBKeyRange.only(0)), "next"); await checkCursorDirection( - index.openKeyCursor(IDBKeyRange.only(0), 'next'), + index.openKeyCursor(IDBKeyRange.only(0)), "next", ); await checkCursorDirection( - index.openKeyCursor(IDBKeyRange.only(0), 'nextunique'), + index.openKeyCursor(IDBKeyRange.only(0), "next"), + "next", + ); + await checkCursorDirection( + index.openKeyCursor(IDBKeyRange.only(0), "nextunique"), "nextunique", ); await checkCursorDirection( - index.openKeyCursor(IDBKeyRange.only(0), 'prev'), + index.openKeyCursor(IDBKeyRange.only(0), "prev"), "prev", ); await checkCursorDirection( - index.openKeyCursor(IDBKeyRange.only(0), 'prevunique'), + index.openKeyCursor(IDBKeyRange.only(0), "prevunique"), "prevunique", ); @@ -110,7 +119,11 @@ test.cb("WPT test cursor-overloads.htm", (t) => { ): Promise<void> { return new Promise<void>((resolve, reject) => { request.onsuccess = function (event: any) { - t.notDeepEqual(event.target.result, null, "Check the result is not null"); + t.notDeepEqual( + event.target.result, + null, + "Check the result is not null", + ); t.deepEqual( event.target.result.direction, direction, diff --git a/packages/idb-bridge/src/idb-wpt-ported/value.test.ts b/packages/idb-bridge/src/idb-wpt-ported/value.test.ts index b1c2b3bee..acae2fe63 100644 --- a/packages/idb-bridge/src/idb-wpt-ported/value.test.ts +++ b/packages/idb-bridge/src/idb-wpt-ported/value.test.ts @@ -37,8 +37,8 @@ test.cb("WPT test value.htm, date", (t) => { .transaction("store") .objectStore("store") .get(1).onsuccess = (e: any) => { - console.log("target", e.target); - console.log("result", e.target.result); + console.log("target", e.target); + console.log("result", e.target.result); t.assert(e.target.result instanceof _instanceof, "instanceof"); t.end(); }; diff --git a/packages/idb-bridge/src/index.ts b/packages/idb-bridge/src/index.ts index a0bd8b86d..fa9edaea6 100644 --- a/packages/idb-bridge/src/index.ts +++ b/packages/idb-bridge/src/index.ts @@ -116,4 +116,4 @@ export function shimIndexedDB(factory: BridgeIDBFactory): void { export * from "./idbtypes"; -export * from "./util/structuredClone";
\ No newline at end of file +export * from "./util/structuredClone"; diff --git a/packages/taler-util/src/ReserveTransaction.ts b/packages/taler-util/src/ReserveTransaction.ts index f477106b2..b282ef189 100644 --- a/packages/taler-util/src/ReserveTransaction.ts +++ b/packages/taler-util/src/ReserveTransaction.ts @@ -182,9 +182,7 @@ export type ReserveTransaction = | ReserveClosingTransaction | ReserveRecoupTransaction; -export const codecForReserveWithdrawTransaction = (): Codec< - ReserveWithdrawTransaction -> => +export const codecForReserveWithdrawTransaction = (): Codec<ReserveWithdrawTransaction> => buildCodecForObject<ReserveWithdrawTransaction>() .property("amount", codecForString()) .property("h_coin_envelope", codecForString()) @@ -194,9 +192,7 @@ export const codecForReserveWithdrawTransaction = (): Codec< .property("withdraw_fee", codecForString()) .build("ReserveWithdrawTransaction"); -export const codecForReserveCreditTransaction = (): Codec< - ReserveCreditTransaction -> => +export const codecForReserveCreditTransaction = (): Codec<ReserveCreditTransaction> => buildCodecForObject<ReserveCreditTransaction>() .property("amount", codecForString()) .property("sender_account_url", codecForString()) @@ -205,9 +201,7 @@ export const codecForReserveCreditTransaction = (): Codec< .property("type", codecForConstString(ReserveTransactionType.Credit)) .build("ReserveCreditTransaction"); -export const codecForReserveClosingTransaction = (): Codec< - ReserveClosingTransaction -> => +export const codecForReserveClosingTransaction = (): Codec<ReserveClosingTransaction> => buildCodecForObject<ReserveClosingTransaction>() .property("amount", codecForString()) .property("closing_fee", codecForString()) @@ -219,9 +213,7 @@ export const codecForReserveClosingTransaction = (): Codec< .property("wtid", codecForString()) .build("ReserveClosingTransaction"); -export const codecForReserveRecoupTransaction = (): Codec< - ReserveRecoupTransaction -> => +export const codecForReserveRecoupTransaction = (): Codec<ReserveRecoupTransaction> => buildCodecForObject<ReserveRecoupTransaction>() .property("amount", codecForString()) .property("coin_pub", codecForString()) diff --git a/packages/taler-util/src/helpers.test.js b/packages/taler-util/src/helpers.test.js index ed3198c85..b311f8a11 100644 --- a/packages/taler-util/src/helpers.test.js +++ b/packages/taler-util/src/helpers.test.js @@ -16,14 +16,26 @@ import test from "ava"; import * as helpers from "./helpers"; test("URL canonicalization", (t) => { - // converts to relative, adds https - t.is("https://alice.example.com/exchange/", helpers.canonicalizeBaseUrl("alice.example.com/exchange")); - // keeps http, adds trailing slash - t.is("http://alice.example.com/exchange/", helpers.canonicalizeBaseUrl("http://alice.example.com/exchange")); - // keeps http, adds trailing slash - t.is("http://alice.example.com/exchange/", helpers.canonicalizeBaseUrl("http://alice.example.com/exchange#foobar")); - // Remove search component - t.is("http://alice.example.com/exchange/", helpers.canonicalizeBaseUrl("http://alice.example.com/exchange?foo=bar")); - t.pass(); + // converts to relative, adds https + t.is( + "https://alice.example.com/exchange/", + helpers.canonicalizeBaseUrl("alice.example.com/exchange"), + ); + // keeps http, adds trailing slash + t.is( + "http://alice.example.com/exchange/", + helpers.canonicalizeBaseUrl("http://alice.example.com/exchange"), + ); + // keeps http, adds trailing slash + t.is( + "http://alice.example.com/exchange/", + helpers.canonicalizeBaseUrl("http://alice.example.com/exchange#foobar"), + ); + // Remove search component + t.is( + "http://alice.example.com/exchange/", + helpers.canonicalizeBaseUrl("http://alice.example.com/exchange?foo=bar"), + ); + t.pass(); }); -//# sourceMappingURL=helpers.test.js.map
\ No newline at end of file +//# sourceMappingURL=helpers.test.js.map diff --git a/packages/taler-util/src/helpers.ts b/packages/taler-util/src/helpers.ts index fb0cd8a2b..53a9a43d4 100644 --- a/packages/taler-util/src/helpers.ts +++ b/packages/taler-util/src/helpers.ts @@ -68,11 +68,7 @@ export function canonicalJson(obj: any): string { return "\\u" + ("0000" + chr.charCodeAt(0).toString(16)).substr(-4); }); } - if ( - typeof obj === "number" || - typeof obj === "boolean" || - obj === null - ) { + if (typeof obj === "number" || typeof obj === "boolean" || obj === null) { return JSON.stringify(obj); } if (Array.isArray(obj)) { diff --git a/packages/taler-util/src/i18n.ts b/packages/taler-util/src/i18n.ts index 4253eb227..a4b0bf81f 100644 --- a/packages/taler-util/src/i18n.ts +++ b/packages/taler-util/src/i18n.ts @@ -17,7 +17,7 @@ export function setupI18n(lang: string, strings: { [s: string]: any }): any { lang = "en-US"; logger.warn(`language ${lang} not found, defaulting to english`); } - debugger + debugger; jed = new jedLib.Jed(strings[lang]); } @@ -58,11 +58,14 @@ export function str(stringSeq: TemplateStringsArray, ...values: any[]): string { /** * Internationalize a string template without serializing */ -export function translate(stringSeq: TemplateStringsArray, ...values: any[]): any[] { +export function translate( + stringSeq: TemplateStringsArray, + ...values: any[] +): any[] { const s = toI18nString(stringSeq); - if (!s) return [] + if (!s) return []; const translation: string = jed.ngettext(s, s, 1); - return replacePlaceholderWithValues(translation, values) + return replacePlaceholderWithValues(translation, values); } /** @@ -71,9 +74,9 @@ export function translate(stringSeq: TemplateStringsArray, ...values: any[]): an export function Translate({ children, ...rest }: { children: any }): any { const c = [].concat(children); const s = stringifyArray(c); - if (!s) return [] + if (!s) return []; const translation: string = jed.ngettext(s, s, 1); - return replacePlaceholderWithValues(translation, c) + return replacePlaceholderWithValues(translation, c); } /** @@ -94,7 +97,6 @@ export function getTranslatedArray(array: Array<any>) { return replacePlaceholderWithValues(translation, array); } - function replacePlaceholderWithValues( translation: string, childArray: Array<any>, @@ -142,6 +144,5 @@ function stringifyArray(children: Array<any>): string { export const i18n = { str, Translate, - translate -} - + translate, +}; diff --git a/packages/taler-util/src/index.ts b/packages/taler-util/src/index.ts index 25a24fa18..2e1c68765 100644 --- a/packages/taler-util/src/index.ts +++ b/packages/taler-util/src/index.ts @@ -18,4 +18,4 @@ export * from "./time.js"; export * from "./transactionsTypes.js"; export * from "./walletTypes.js"; export * from "./i18n.js"; -export * from "./logging.js";
\ No newline at end of file +export * from "./logging.js"; diff --git a/packages/taler-util/src/logging.ts b/packages/taler-util/src/logging.ts index 4f48e24da..532174fd6 100644 --- a/packages/taler-util/src/logging.ts +++ b/packages/taler-util/src/logging.ts @@ -19,7 +19,9 @@ */ const isNode = - typeof process !== "undefined" && typeof process.release !== "undefined" && process.release.name === "node"; + typeof process !== "undefined" && + typeof process.release !== "undefined" && + process.release.name === "node"; function writeNodeLog( message: any, diff --git a/packages/taler-util/src/taler-error-codes.ts b/packages/taler-util/src/taler-error-codes.ts index 2d8e31b2e..fec2cf0ff 100644 --- a/packages/taler-util/src/taler-error-codes.ts +++ b/packages/taler-util/src/taler-error-codes.ts @@ -22,8 +22,6 @@ */ export enum TalerErrorCode { - - /** * Special code to indicate success (no error). * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -2319,5 +2317,4 @@ export enum TalerErrorCode { * (A value of 0 indicates that the error is generated client-side). */ END = 9999, - } diff --git a/packages/taler-util/src/talerTypes.ts b/packages/taler-util/src/talerTypes.ts index db20234cf..4b9ad96ee 100644 --- a/packages/taler-util/src/talerTypes.ts +++ b/packages/taler-util/src/talerTypes.ts @@ -989,9 +989,7 @@ export interface BankWithdrawalOperationPostResponse { transfer_done: boolean; } -export const codecForBankWithdrawalOperationPostResponse = (): Codec< - BankWithdrawalOperationPostResponse -> => +export const codecForBankWithdrawalOperationPostResponse = (): Codec<BankWithdrawalOperationPostResponse> => buildCodecForObject<BankWithdrawalOperationPostResponse>() .property("transfer_done", codecForBoolean()) .build("BankWithdrawalOperationPostResponse"); @@ -1070,9 +1068,8 @@ export const codecForTax = (): Codec<Tax> => .property("tax", codecForString()) .build("Tax"); -export const codecForInternationalizedString = (): Codec< - InternationalizedString -> => codecForMap(codecForString()); +export const codecForInternationalizedString = (): Codec<InternationalizedString> => + codecForMap(codecForString()); export const codecForProduct = (): Codec<Product> => buildCodecForObject<Product>() @@ -1120,9 +1117,7 @@ export const codecForContractTerms = (): Codec<ContractTerms> => .property("extra", codecForAny()) .build("ContractTerms"); -export const codecForMerchantRefundPermission = (): Codec< - MerchantAbortPayRefundDetails -> => +export const codecForMerchantRefundPermission = (): Codec<MerchantAbortPayRefundDetails> => buildCodecForObject<MerchantAbortPayRefundDetails>() .property("refund_amount", codecForAmountString()) .property("refund_fee", codecForAmountString()) @@ -1135,9 +1130,7 @@ export const codecForMerchantRefundPermission = (): Codec< .property("exchange_pub", codecOptional(codecForString())) .build("MerchantRefundPermission"); -export const codecForMerchantRefundResponse = (): Codec< - MerchantRefundResponse -> => +export const codecForMerchantRefundResponse = (): Codec<MerchantRefundResponse> => buildCodecForObject<MerchantRefundResponse>() .property("merchant_pub", codecForString()) .property("h_contract_terms", codecForString()) @@ -1217,9 +1210,7 @@ export const codecForCheckPaymentResponse = (): Codec<CheckPaymentResponse> => .property("contract_url", codecOptional(codecForString())) .build("CheckPaymentResponse"); -export const codecForWithdrawOperationStatusResponse = (): Codec< - WithdrawOperationStatusResponse -> => +export const codecForWithdrawOperationStatusResponse = (): Codec<WithdrawOperationStatusResponse> => buildCodecForObject<WithdrawOperationStatusResponse>() .property("selection_done", codecForBoolean()) .property("transfer_done", codecForBoolean()) @@ -1267,16 +1258,12 @@ export const codecForExchangeRevealItem = (): Codec<ExchangeRevealItem> => .property("ev_sig", codecForString()) .build("ExchangeRevealItem"); -export const codecForExchangeRevealResponse = (): Codec< - ExchangeRevealResponse -> => +export const codecForExchangeRevealResponse = (): Codec<ExchangeRevealResponse> => buildCodecForObject<ExchangeRevealResponse>() .property("ev_sigs", codecForList(codecForExchangeRevealItem())) .build("ExchangeRevealResponse"); -export const codecForMerchantCoinRefundSuccessStatus = (): Codec< - MerchantCoinRefundSuccessStatus -> => +export const codecForMerchantCoinRefundSuccessStatus = (): Codec<MerchantCoinRefundSuccessStatus> => buildCodecForObject<MerchantCoinRefundSuccessStatus>() .property("type", codecForConstString("success")) .property("coin_pub", codecForString()) @@ -1288,9 +1275,7 @@ export const codecForMerchantCoinRefundSuccessStatus = (): Codec< .property("execution_time", codecForTimestamp) .build("MerchantCoinRefundSuccessStatus"); -export const codecForMerchantCoinRefundFailureStatus = (): Codec< - MerchantCoinRefundFailureStatus -> => +export const codecForMerchantCoinRefundFailureStatus = (): Codec<MerchantCoinRefundFailureStatus> => buildCodecForObject<MerchantCoinRefundFailureStatus>() .property("type", codecForConstString("failure")) .property("coin_pub", codecForString()) @@ -1302,35 +1287,27 @@ export const codecForMerchantCoinRefundFailureStatus = (): Codec< .property("execution_time", codecForTimestamp) .build("MerchantCoinRefundFailureStatus"); -export const codecForMerchantCoinRefundStatus = (): Codec< - MerchantCoinRefundStatus -> => +export const codecForMerchantCoinRefundStatus = (): Codec<MerchantCoinRefundStatus> => buildCodecForUnion<MerchantCoinRefundStatus>() .discriminateOn("type") .alternative("success", codecForMerchantCoinRefundSuccessStatus()) .alternative("failure", codecForMerchantCoinRefundFailureStatus()) .build("MerchantCoinRefundStatus"); -export const codecForMerchantOrderStatusPaid = (): Codec< - MerchantOrderStatusPaid -> => +export const codecForMerchantOrderStatusPaid = (): Codec<MerchantOrderStatusPaid> => buildCodecForObject<MerchantOrderStatusPaid>() .property("refund_amount", codecForString()) .property("refunded", codecForBoolean()) .build("MerchantOrderStatusPaid"); -export const codecForMerchantOrderRefundPickupResponse = (): Codec< - MerchantOrderRefundResponse -> => +export const codecForMerchantOrderRefundPickupResponse = (): Codec<MerchantOrderRefundResponse> => buildCodecForObject<MerchantOrderRefundResponse>() .property("merchant_pub", codecForString()) .property("refund_amount", codecForString()) .property("refunds", codecForList(codecForMerchantCoinRefundStatus())) .build("MerchantOrderRefundPickupResponse"); -export const codecForMerchantOrderStatusUnpaid = (): Codec< - MerchantOrderStatusUnpaid -> => +export const codecForMerchantOrderStatusUnpaid = (): Codec<MerchantOrderStatusUnpaid> => buildCodecForObject<MerchantOrderStatusUnpaid>() .property("taler_pay_uri", codecForString()) .property("already_paid_order_id", codecOptional(codecForString())) @@ -1412,9 +1389,7 @@ export interface MerchantAbortPayRefundSuccessStatus { exchange_pub: string; } -export const codecForMerchantAbortPayRefundSuccessStatus = (): Codec< - MerchantAbortPayRefundSuccessStatus -> => +export const codecForMerchantAbortPayRefundSuccessStatus = (): Codec<MerchantAbortPayRefundSuccessStatus> => buildCodecForObject<MerchantAbortPayRefundSuccessStatus>() .property("exchange_pub", codecForString()) .property("exchange_sig", codecForString()) @@ -1422,9 +1397,7 @@ export const codecForMerchantAbortPayRefundSuccessStatus = (): Codec< .property("type", codecForConstString("success")) .build("MerchantAbortPayRefundSuccessStatus"); -export const codecForMerchantAbortPayRefundFailureStatus = (): Codec< - MerchantAbortPayRefundFailureStatus -> => +export const codecForMerchantAbortPayRefundFailureStatus = (): Codec<MerchantAbortPayRefundFailureStatus> => buildCodecForObject<MerchantAbortPayRefundFailureStatus>() .property("exchange_code", codecForNumber()) .property("exchange_reply", codecForAny()) @@ -1432,9 +1405,7 @@ export const codecForMerchantAbortPayRefundFailureStatus = (): Codec< .property("type", codecForConstString("failure")) .build("MerchantAbortPayRefundFailureStatus"); -export const codecForMerchantAbortPayRefundStatus = (): Codec< - MerchantAbortPayRefundStatus -> => +export const codecForMerchantAbortPayRefundStatus = (): Codec<MerchantAbortPayRefundStatus> => buildCodecForUnion<MerchantAbortPayRefundStatus>() .discriminateOn("type") .alternative("success", codecForMerchantAbortPayRefundSuccessStatus()) diff --git a/packages/taler-util/src/talerconfig.ts b/packages/taler-util/src/talerconfig.ts index f3c1220e2..7704e2614 100644 --- a/packages/taler-util/src/talerconfig.ts +++ b/packages/taler-util/src/talerconfig.ts @@ -28,18 +28,18 @@ import { Amounts } from "./amounts.js"; const nodejs_fs = (function () { let fs: typeof import("fs"); - return function() { + return function () { if (!fs) { /** * need to use an expression when doing a require if we want * webpack not to find out about the requirement */ - const _r = "require" - fs = module[_r]("fs") + const _r = "require"; + fs = module[_r]("fs"); } - return fs - } -})() + return fs; + }; +})(); export class ConfigError extends Error { constructor(message: string) { diff --git a/packages/taler-wallet-cli/src/assets.ts b/packages/taler-wallet-cli/src/assets.ts index 7d6b8f33e..72fc9fe04 100644 --- a/packages/taler-wallet-cli/src/assets.ts +++ b/packages/taler-wallet-cli/src/assets.ts @@ -22,7 +22,7 @@ import fs from "fs"; /** * Resolve an asset name into an absolute filename. - * + * * The asset file should be placed in the "assets" directory * at the top level of the package (i.e. next to package.json). */ diff --git a/packages/taler-wallet-cli/src/integrationtests/libeufin.ts b/packages/taler-wallet-cli/src/integrationtests/libeufin.ts index ddc19b6ed..4b14cc02e 100644 --- a/packages/taler-wallet-cli/src/integrationtests/libeufin.ts +++ b/packages/taler-wallet-cli/src/integrationtests/libeufin.ts @@ -82,7 +82,7 @@ interface LibeufinNexusMoneyMovement { }; endToEndId: string; unstructuredRemittanceInformation: string; - } + }; } interface LibeufinNexusBatches { @@ -668,7 +668,10 @@ export class LibeufinCli { console.log(stdout); } - async submitPayment(details: LibeufinPreparedPaymentDetails, paymentUuid: string): Promise<void> { + async submitPayment( + details: LibeufinPreparedPaymentDetails, + paymentUuid: string, + ): Promise<void> { const stdout = await sh( this.globalTestState, "libeufin-cli-submitpayment", @@ -820,7 +823,7 @@ export interface NexusAuth { auth: { username: string; password: string; - } + }; } export interface CreateNexusUserRequest { @@ -832,10 +835,12 @@ export interface PostNexusTaskRequest { name: string; cronspec: string; type: string; // fetch | submit - params: { - level: string; // report | statement | all - rangeType: string; // all | since-last | previous-days | latest - } | {} + params: + | { + level: string; // report | statement | all + rangeType: string; // all | since-last | previous-days | latest + } + | {}; } export interface PostNexusPermissionRequest { @@ -850,20 +855,16 @@ export interface PostNexusPermissionRequest { } export namespace LibeufinNexusApi { - export async function getAllConnections( nexus: LibeufinNexusServiceInterface, ): Promise<any> { let url = new URL("bank-connections", nexus.baseUrl); - const res = await axios.get( - url.href, - { - auth: { - username: "admin", - password: "test", - }, + const res = await axios.get(url.href, { + auth: { + username: "admin", + password: "test", }, - ); + }); return res; } @@ -873,16 +874,12 @@ export namespace LibeufinNexusApi { ): Promise<any> { const baseUrl = libeufinNexusService.baseUrl; let url = new URL("bank-connections/delete-connection", baseUrl); - return await axios.post( - url.href, - req, - { - auth: { - username: "admin", - password: "test", - } - } - ); + return await axios.post(url.href, req, { + auth: { + username: "admin", + password: "test", + }, + }); } export async function createEbicsBankConnection( @@ -1012,31 +1009,26 @@ export namespace LibeufinNexusApi { `/bank-accounts/${accountName}/payment-initiations`, baseUrl, ); - let response = await axios.get( - url.href, - { - auth: { - username: username, - password: password, - }, + let response = await axios.get(url.href, { + auth: { + username: username, + password: password, }, + }); + console.log( + `Payment initiations of: ${accountName}`, + JSON.stringify(response.data, null, 2), ); - console.log(`Payment initiations of: ${accountName}`, - JSON.stringify(response.data, null, 2)); } export async function getConfig( libeufinNexusService: LibeufinNexusService, ): Promise<void> { const baseUrl = libeufinNexusService.baseUrl; - let url = new URL( - `/config`, - baseUrl, - ); + let url = new URL(`/config`, baseUrl); let response = await axios.get(url.href); } - // FIXME: this function should return some structured // object that represents a history. export async function getAccountTransactions( @@ -1046,19 +1038,13 @@ export namespace LibeufinNexusApi { password: string = "test", ): Promise<any> { const baseUrl = libeufinNexusService.baseUrl; - let url = new URL( - `/bank-accounts/${accountName}/transactions`, - baseUrl, - ); - let response = await axios.get( - url.href, - { - auth: { - username: username, - password: password, - }, + let url = new URL(`/bank-accounts/${accountName}/transactions`, baseUrl); + let response = await axios.get(url.href, { + auth: { + username: username, + password: password, }, - ); + }); return response; } @@ -1174,7 +1160,10 @@ export namespace LibeufinNexusApi { taskName: string, ) { const baseUrl = libeufinNexusService.baseUrl; - let url = new URL(`/bank-accounts/${bankAccountName}/schedule/${taskName}`, baseUrl); + let url = new URL( + `/bank-accounts/${bankAccountName}/schedule/${taskName}`, + baseUrl, + ); await axios.delete(url.href, { auth: { username: "admin", @@ -1204,15 +1193,12 @@ export namespace LibeufinNexusApi { ): Promise<any> { const baseUrl = libeufinNexusService.baseUrl; let url = new URL(`facades/${facadeName}`, baseUrl); - return await axios.delete( - url.href, - { - auth: { - username: "admin", - password: "test", - }, - } - ); + return await axios.delete(url.href, { + auth: { + username: "admin", + password: "test", + }, + }); } export async function getAllFacades( @@ -1220,15 +1206,12 @@ export namespace LibeufinNexusApi { ): Promise<any> { const baseUrl = libeufinNexusService.baseUrl; let url = new URL("facades", baseUrl); - return await axios.get( - url.href, - { - auth: { - username: "admin", - password: "test", - }, - } - ); + return await axios.get(url.href, { + auth: { + username: "admin", + password: "test", + }, + }); } export async function createTwgFacade( @@ -1368,16 +1351,12 @@ export function findNexusPayment( key: string, payments: LibeufinNexusTransactions, ): LibeufinNexusMoneyMovement | void { - let transactions = payments["transactions"]; for (let i = 0; i < transactions.length; i++) { - let batches = transactions[i]["batches"]; for (let y = 0; y < batches.length; y++) { - let movements = batches[y]["batchTransactions"]; for (let z = 0; z < movements.length; z++) { - let movement = movements[z]; if (movement["details"]["unstructuredRemittanceInformation"] == key) return movement; diff --git a/packages/taler-wallet-cli/src/integrationtests/test-exchange-management.ts b/packages/taler-wallet-cli/src/integrationtests/test-exchange-management.ts index 0d0253d71..c2494be93 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-exchange-management.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-exchange-management.ts @@ -27,9 +27,7 @@ import { BankApi, BankAccessApi, } from "./harness"; -import { - URL, -} from "@gnu-taler/taler-wallet-core"; +import { URL } from "@gnu-taler/taler-wallet-core"; import { ExchangesListRespose, TalerErrorCode } from "@gnu-taler/taler-util"; import { FaultInjectedExchangeService, diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-bankaccount.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-bankaccount.ts index dd9a99a4a..3c3912254 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-bankaccount.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-bankaccount.ts @@ -38,13 +38,10 @@ export async function runLibeufinApiBankaccountTest(t: GlobalTestState) { await nexus.start(); await nexus.pingUntilAvailable(); - await LibeufinNexusApi.createUser( - nexus, - { - username: "one", - password: "testing-the-bankaccount-api", - } - ); + await LibeufinNexusApi.createUser(nexus, { + username: "one", + password: "testing-the-bankaccount-api", + }); const sandbox = await LibeufinSandboxService.create(t, { httpPort: 5012, databaseJdbcUri: `jdbc:sqlite:${t.testDir}/libeufin-sandbox.sqlite3`, @@ -52,43 +49,38 @@ export async function runLibeufinApiBankaccountTest(t: GlobalTestState) { await sandbox.start(); await sandbox.pingUntilAvailable(); await LibeufinSandboxApi.createEbicsHost(sandbox, "mock"); - await LibeufinSandboxApi.createEbicsSubscriber( - sandbox, - { - hostID: "mock", - userID: "mock", - partnerID: "mock", - } - ); - await LibeufinSandboxApi.createEbicsBankAccount( - sandbox, - { - subscriber: { - hostID: "mock", - partnerID: "mock", - userID: "mock", - }, - iban: "DE71500105179674997361", - bic: "BELADEBEXXX", - name: "mock", - currency: "mock", - label: "mock", - }, - ); - await LibeufinNexusApi.createEbicsBankConnection( - nexus, - { - name: "bankaccount-api-test-connection", - ebicsURL: "http://localhost:5012/ebicsweb", + await LibeufinSandboxApi.createEbicsSubscriber(sandbox, { + hostID: "mock", + userID: "mock", + partnerID: "mock", + }); + await LibeufinSandboxApi.createEbicsBankAccount(sandbox, { + subscriber: { hostID: "mock", - userID: "mock", partnerID: "mock", - } - ); + userID: "mock", + }, + iban: "DE71500105179674997361", + bic: "BELADEBEXXX", + name: "mock", + currency: "mock", + label: "mock", + }); + await LibeufinNexusApi.createEbicsBankConnection(nexus, { + name: "bankaccount-api-test-connection", + ebicsURL: "http://localhost:5012/ebicsweb", + hostID: "mock", + userID: "mock", + partnerID: "mock", + }); await LibeufinNexusApi.connectBankConnection( - nexus, "bankaccount-api-test-connection" + nexus, + "bankaccount-api-test-connection", + ); + await LibeufinNexusApi.fetchAccounts( + nexus, + "bankaccount-api-test-connection", ); - await LibeufinNexusApi.fetchAccounts(nexus, "bankaccount-api-test-connection"); await LibeufinNexusApi.importConnectionAccount( nexus, @@ -96,30 +88,24 @@ export async function runLibeufinApiBankaccountTest(t: GlobalTestState) { "mock", "local-mock", ); - - await LibeufinSandboxApi.bookPayment2( - sandbox, - { - creditorIban: "DE71500105179674997361", - creditorBic: "BELADEBEXXX", - creditorName: "mock", - debitorIban: "DE84500105176881385584", - debitorBic: "BELADEBEXXX", - debitorName: "mock2", - subject: "mock subject", - currency: "EUR", - amount: "1", - uid: "mock", - direction: "CRDT", - } - ); - await LibeufinNexusApi.fetchAllTransactions( - nexus, - "local-mock" - ); + + await LibeufinSandboxApi.bookPayment2(sandbox, { + creditorIban: "DE71500105179674997361", + creditorBic: "BELADEBEXXX", + creditorName: "mock", + debitorIban: "DE84500105176881385584", + debitorBic: "BELADEBEXXX", + debitorName: "mock2", + subject: "mock subject", + currency: "EUR", + amount: "1", + uid: "mock", + direction: "CRDT", + }); + await LibeufinNexusApi.fetchAllTransactions(nexus, "local-mock"); let transactions = await LibeufinNexusApi.getAccountTransactions( nexus, - "local-mock" + "local-mock", ); let el = findNexusPayment("mock subject", transactions.data); t.assertTrue(el instanceof Object); diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-bankconnection.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-bankconnection.ts index 9e6e11664..f8bee7f16 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-bankconnection.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-bankconnection.ts @@ -38,34 +38,25 @@ export async function runLibeufinApiBankconnectionTest(t: GlobalTestState) { await nexus.start(); await nexus.pingUntilAvailable(); - await LibeufinNexusApi.createUser( - nexus, - { - username: "one", - password: "testing-the-bankconnection-api", - } - ); + await LibeufinNexusApi.createUser(nexus, { + username: "one", + password: "testing-the-bankconnection-api", + }); - await LibeufinNexusApi.createEbicsBankConnection( - nexus, - { - name: "bankconnection-api-test-connection", - ebicsURL: "http://localhost:5012/ebicsweb", - hostID: "mock", - userID: "mock", - partnerID: "mock", - } - ); + await LibeufinNexusApi.createEbicsBankConnection(nexus, { + name: "bankconnection-api-test-connection", + ebicsURL: "http://localhost:5012/ebicsweb", + hostID: "mock", + userID: "mock", + partnerID: "mock", + }); let connections = await LibeufinNexusApi.getAllConnections(nexus); t.assertTrue(connections.data["bankConnections"].length == 1); - await LibeufinNexusApi.deleteBankConnection( - nexus, - { - bankConnectionId: "bankconnection-api-test-connection", - } - ); + await LibeufinNexusApi.deleteBankConnection(nexus, { + bankConnectionId: "bankconnection-api-test-connection", + }); connections = await LibeufinNexusApi.getAllConnections(nexus); t.assertTrue(connections.data["bankConnections"].length == 0); } diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-facade.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-facade.ts index 85a6b7bd0..edbbbca00 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-facade.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-facade.ts @@ -43,15 +43,19 @@ export async function runLibeufinApiFacadeTest(t: GlobalTestState) { * Launch Sandbox and Nexus. */ const libeufinServices = await launchLibeufinServices( - t, [user01nexus], [user01sandbox], + t, + [user01nexus], + [user01sandbox], + ); + let resp = await LibeufinNexusApi.getAllFacades( + libeufinServices.libeufinNexus, ); - let resp = await LibeufinNexusApi.getAllFacades(libeufinServices.libeufinNexus); // check that original facade shows up. t.assertTrue(resp.data["facades"][0]["name"] == user01nexus.twgReq["name"]); // delete it. resp = await LibeufinNexusApi.deleteFacade( libeufinServices.libeufinNexus, - user01nexus.twgReq["name"] + user01nexus.twgReq["name"], ); // check that no facades show up. t.assertTrue(!resp.data.hasOwnProperty("facades")); diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-permissions.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-permissions.ts index 85385b75c..0090819e3 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-permissions.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-permissions.ts @@ -51,8 +51,8 @@ export async function runLibeufinApiPermissionsTest(t: GlobalTestState) { let transferPermission = await LibeufinNexusApi.getAllPermissions(nexus); let element = transferPermission.data["permissions"].pop(); t.assertTrue( - element["permissionName"] == "facade.talerWireGateway.transfer" - && element["subjectId"] == "username-01" + element["permissionName"] == "facade.talerWireGateway.transfer" && + element["subjectId"] == "username-01", ); let denyTransfer = user01nexus.twgTransferPermission; diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-scheduling.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-scheduling.ts index 13c9e92a8..d543bc4ab 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-scheduling.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-scheduling.ts @@ -40,7 +40,6 @@ export async function runLibeufinApiSchedulingTest(t: GlobalTestState) { await nexus.start(); await nexus.pingUntilAvailable(); - const user01nexus = new NexusUserBundle( "01", "http://localhost:5010/ebicsweb", @@ -54,13 +53,25 @@ export async function runLibeufinApiSchedulingTest(t: GlobalTestState) { params: { level: "all", rangeType: "all", - } + }, }); - let resp = await LibeufinNexusApi.getTasks(nexus, user01nexus.localAccountName, "test-task"); + let resp = await LibeufinNexusApi.getTasks( + nexus, + user01nexus.localAccountName, + "test-task", + ); t.assertTrue(resp.data["taskName"] == "test-task"); - await LibeufinNexusApi.deleteTask(nexus, user01nexus.localAccountName, "test-task"); + await LibeufinNexusApi.deleteTask( + nexus, + user01nexus.localAccountName, + "test-task", + ); try { - await LibeufinNexusApi.getTasks(nexus, user01nexus.localAccountName, "test-task"); + await LibeufinNexusApi.getTasks( + nexus, + user01nexus.localAccountName, + "test-task", + ); } catch (err) { t.assertTrue(err.response.status == 404); } @@ -72,11 +83,23 @@ export async function runLibeufinApiSchedulingTest(t: GlobalTestState) { type: "submit", params: {}, }); - resp = await LibeufinNexusApi.getTasks(nexus, user01nexus.localAccountName, "test-task"); + resp = await LibeufinNexusApi.getTasks( + nexus, + user01nexus.localAccountName, + "test-task", + ); t.assertTrue(resp.data["taskName"] == "test-task"); - await LibeufinNexusApi.deleteTask(nexus, user01nexus.localAccountName, "test-task"); + await LibeufinNexusApi.deleteTask( + nexus, + user01nexus.localAccountName, + "test-task", + ); try { - await LibeufinNexusApi.getTasks(nexus, user01nexus.localAccountName, "test-task"); + await LibeufinNexusApi.getTasks( + nexus, + user01nexus.localAccountName, + "test-task", + ); } catch (err) { t.assertTrue(err.response.status == 404); } diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-users.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-users.ts index eb41bfe72..d4d451ed7 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-users.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-users.ts @@ -35,13 +35,10 @@ export async function runLibeufinApiUsersTest(t: GlobalTestState) { await nexus.start(); await nexus.pingUntilAvailable(); - await LibeufinNexusApi.createUser( - nexus, - { - username: "one", - password: "will-be-changed", - } - ); + await LibeufinNexusApi.createUser(nexus, { + username: "one", + password: "will-be-changed", + }); await LibeufinNexusApi.changePassword( nexus, @@ -52,19 +49,16 @@ export async function runLibeufinApiUsersTest(t: GlobalTestState) { auth: { username: "one", password: "will-be-changed", - } + }, }, ); - let resp = await LibeufinNexusApi.getUser( - nexus, - { - auth: { - username: "one", - password: "got-changed", - } - } - ); + let resp = await LibeufinNexusApi.getUser(nexus, { + auth: { + username: "one", + password: "got-changed", + }, + }); console.log(resp.data); t.assertTrue(resp.data["username"] == "one" && !resp.data["superuser"]); } diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund-multiple-users.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund-multiple-users.ts index 9946e02d4..3a2288664 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund-multiple-users.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund-multiple-users.ts @@ -90,15 +90,15 @@ export async function runLibeufinRefundMultipleUsersTest(t: GlobalTestState) { libeufinServices.libeufinNexus, user02nexus.localAccountName, "1", // so far the only one that can exist. - ); + ); // Counterpart checks whether the reimbursement shows up. let history = await LibeufinSandboxApi.getAccountTransactions( libeufinServices.libeufinSandbox, - user01sandbox.ebicsBankAccount["label"] + user01sandbox.ebicsBankAccount["label"], ); - t.assertTrue(history["payments"].length == 1) + t.assertTrue(history["payments"].length == 1); } runLibeufinRefundMultipleUsersTest.suites = ["libeufin"]; diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund.ts index f4288cb5e..4cd943f5d 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund.ts @@ -80,14 +80,14 @@ export async function runLibeufinRefundTest(t: GlobalTestState) { libeufinServices.libeufinNexus, user02nexus.localAccountName, "1", // so far the only one that can exist. - ); + ); // Counterpart checks whether the reimbursement shows up. let history = await LibeufinSandboxApi.getAccountTransactions( libeufinServices.libeufinSandbox, - user01sandbox.ebicsBankAccount["label"] + user01sandbox.ebicsBankAccount["label"], ); - t.assertTrue(history["payments"].length == 1) + t.assertTrue(history["payments"].length == 1); } runLibeufinRefundTest.suites = ["libeufin"]; diff --git a/packages/taler-wallet-cli/src/integrationtests/test-merchant-exchange-confusion.ts b/packages/taler-wallet-cli/src/integrationtests/test-merchant-exchange-confusion.ts index deb0026fc..3336f0c5e 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-merchant-exchange-confusion.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-merchant-exchange-confusion.ts @@ -109,7 +109,6 @@ export async function createConfusedMerchantTestkudosEnvironment( paytoUris: [`payto://x-taler-bank/merchant-default`], }); - await merchant.addInstance({ id: "minst1", name: "minst1", diff --git a/packages/taler-wallet-cli/src/integrationtests/test-merchant-refund-api.ts b/packages/taler-wallet-cli/src/integrationtests/test-merchant-refund-api.ts index 25c2ea365..32bc310d7 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-merchant-refund-api.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-merchant-refund-api.ts @@ -30,10 +30,7 @@ import { withdrawViaBank, SimpleTestEnvironment, } from "./helpers"; -import { - durationFromSpec, - PreparePayResultType, -} from "@gnu-taler/taler-util"; +import { durationFromSpec, PreparePayResultType } from "@gnu-taler/taler-util"; import axios from "axios"; import { URL } from "@gnu-taler/taler-wallet-core"; diff --git a/packages/taler-wallet-cli/src/integrationtests/test-pay-abort.ts b/packages/taler-wallet-cli/src/integrationtests/test-pay-abort.ts index 4d0ea489d..10f9904f1 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-pay-abort.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-pay-abort.ts @@ -23,9 +23,7 @@ * Imports. */ import { PreparePayResultType, TalerErrorCode } from "@gnu-taler/taler-util"; -import { - URL, -} from "@gnu-taler/taler-wallet-core"; +import { URL } from "@gnu-taler/taler-wallet-core"; import { FaultInjectionRequestContext, FaultInjectionResponseContext, @@ -152,4 +150,4 @@ export async function runPayAbortTest(t: GlobalTestState) { t.assertDeepEqual(txTypes, ["withdrawal", "payment", "refund"]); } -runPayAbortTest.suites = ["wallet"];
\ No newline at end of file +runPayAbortTest.suites = ["wallet"]; diff --git a/packages/taler-wallet-cli/src/integrationtests/test-paywall-flow.ts b/packages/taler-wallet-cli/src/integrationtests/test-paywall-flow.ts index ba4ef2910..865fd77d1 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-paywall-flow.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-paywall-flow.ts @@ -232,4 +232,4 @@ export async function runPaywallFlowTest(t: GlobalTestState) { t.assertTrue(pubUnpaidStatus.already_paid_order_id === firstOrderId); } -runPaywallFlowTest.suites = ["wallet"];
\ No newline at end of file +runPaywallFlowTest.suites = ["wallet"]; diff --git a/packages/taler-wallet-cli/src/integrationtests/test-refund-auto.ts b/packages/taler-wallet-cli/src/integrationtests/test-refund-auto.ts index 36bdfac2c..a78b0ecca 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-refund-auto.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-refund-auto.ts @@ -99,4 +99,4 @@ export async function runRefundAutoTest(t: GlobalTestState) { await t.shutdown(); } -runRefundAutoTest.suites = ["wallet"];
\ No newline at end of file +runRefundAutoTest.suites = ["wallet"]; diff --git a/packages/taler-wallet-cli/src/integrationtests/test-refund-gone.ts b/packages/taler-wallet-cli/src/integrationtests/test-refund-gone.ts index abaa10f71..c2640bb22 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-refund-gone.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-refund-gone.ts @@ -126,4 +126,4 @@ export async function runRefundGoneTest(t: GlobalTestState) { await t.shutdown(); } -runRefundGoneTest.suites = ["wallet"];
\ No newline at end of file +runRefundGoneTest.suites = ["wallet"]; diff --git a/packages/taler-wallet-cli/src/integrationtests/test-refund-incremental.ts b/packages/taler-wallet-cli/src/integrationtests/test-refund-incremental.ts index 4c046cbe7..55f8ad6cd 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-refund-incremental.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-refund-incremental.ts @@ -189,4 +189,4 @@ export async function runRefundIncrementalTest(t: GlobalTestState) { await t.shutdown(); } -runRefundIncrementalTest.suites = ["wallet"];
\ No newline at end of file +runRefundIncrementalTest.suites = ["wallet"]; diff --git a/packages/taler-wallet-cli/src/integrationtests/testrunner.ts b/packages/taler-wallet-cli/src/integrationtests/testrunner.ts index 4898a9eff..c50838f0f 100644 --- a/packages/taler-wallet-cli/src/integrationtests/testrunner.ts +++ b/packages/taler-wallet-cli/src/integrationtests/testrunner.ts @@ -135,7 +135,7 @@ const allTests: TestMainFunction[] = [ export interface TestRunSpec { includePattern?: string; suiteSpec?: string; - dryRun?: boolean, + dryRun?: boolean; } export interface TestInfo { diff --git a/packages/taler-wallet-core/src/crypto/workers/cryptoImplementation.ts b/packages/taler-wallet-core/src/crypto/workers/cryptoImplementation.ts index d8c02cb1b..1969dee95 100644 --- a/packages/taler-wallet-core/src/crypto/workers/cryptoImplementation.ts +++ b/packages/taler-wallet-core/src/crypto/workers/cryptoImplementation.ts @@ -222,7 +222,7 @@ export class CryptoImplementation { .put(decodeCrock(req.merchantPub)) .put(decodeCrock(req.coinPub)) .build(); - return encodeCrock(eddsaSign(p, decodeCrock(req.merchantPriv))); + return encodeCrock(eddsaSign(p, decodeCrock(req.merchantPriv))); } /** diff --git a/packages/taler-wallet-core/src/crypto/workers/nodeThreadWorker.ts b/packages/taler-wallet-core/src/crypto/workers/nodeThreadWorker.ts index 37b93abe4..453a46945 100644 --- a/packages/taler-wallet-core/src/crypto/workers/nodeThreadWorker.ts +++ b/packages/taler-wallet-core/src/crypto/workers/nodeThreadWorker.ts @@ -92,8 +92,10 @@ export function handleWorkerMessage(msg: any): void { try { const result = (impl as any)[operation](...args); // eslint-disable-next-line @typescript-eslint/no-var-requires - const _r = "require" - const worker_threads: typeof import("worker_threads") = module[_r]("worker_threads"); + const _r = "require"; + const worker_threads: typeof import("worker_threads") = module[_r]( + "worker_threads", + ); // const worker_threads = require("worker_threads"); const p = worker_threads.parentPort; @@ -149,7 +151,7 @@ class NodeThreadCryptoWorker implements CryptoWorker { constructor() { // eslint-disable-next-line @typescript-eslint/no-var-requires - const _r = "require" + const _r = "require"; const worker_threads = module[_r]("worker_threads"); logger.trace("starting node crypto worker"); diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts index 584379aa4..2754fd342 100644 --- a/packages/taler-wallet-core/src/db.ts +++ b/packages/taler-wallet-core/src/db.ts @@ -169,7 +169,6 @@ export async function openTalerDatabase( return new DbAccess(mainDbHandle, WalletStoresV1); } - export function deleteTalerDatabase(idbFactory: IDBFactory): void { idbFactory.deleteDatabase(TALER_DB_NAME); } diff --git a/packages/taler-wallet-core/src/headless/helpers.ts b/packages/taler-wallet-core/src/headless/helpers.ts index 73196492c..7b918d5d9 100644 --- a/packages/taler-wallet-core/src/headless/helpers.ts +++ b/packages/taler-wallet-core/src/headless/helpers.ts @@ -41,18 +41,18 @@ const logger = new Logger("headless/helpers.ts"); const nodejs_fs = (function () { let fs: typeof import("fs"); - return function() { + return function () { if (!fs) { /** * need to use an expression when doing a require if we want * webpack not to find out about the requirement */ - const _r = "require" - fs = module[_r]("fs") + const _r = "require"; + fs = module[_r]("fs"); } - return fs - } -})() + return fs; + }; +})(); export interface DefaultNodeWalletArgs { /** @@ -123,9 +123,13 @@ export async function getDefaultNodeWallet( } const tmpPath = `${args.persistentStoragePath}-${makeId(5)}.tmp`; const dbContent = myBackend.exportDump(); - nodejs_fs().writeFileSync(tmpPath, JSON.stringify(dbContent, undefined, 2), { - encoding: "utf-8", - }); + nodejs_fs().writeFileSync( + tmpPath, + JSON.stringify(dbContent, undefined, 2), + { + encoding: "utf-8", + }, + ); // Atomically move the temporary file onto the DB path. nodejs_fs().renameSync(tmpPath, args.persistentStoragePath); }; @@ -157,7 +161,7 @@ export async function getDefaultNodeWallet( let workerFactory; try { // Try if we have worker threads available, fails in older node versions. - const _r = "require" + const _r = "require"; const worker_threads = module[_r]("worker_threads"); // require("worker_threads"); workerFactory = new NodeThreadCryptoWorkerFactory(); diff --git a/packages/taler-wallet-core/src/operations/balance.ts b/packages/taler-wallet-core/src/operations/balance.ts index 7273f0b42..4dba6beb7 100644 --- a/packages/taler-wallet-core/src/operations/balance.ts +++ b/packages/taler-wallet-core/src/operations/balance.ts @@ -17,7 +17,12 @@ /** * Imports. */ -import { AmountJson, BalancesResponse, Amounts, Logger } from "@gnu-taler/taler-util"; +import { + AmountJson, + BalancesResponse, + Amounts, + Logger, +} from "@gnu-taler/taler-util"; import { CoinStatus, WalletStoresV1 } from "../db.js"; import { GetReadOnlyAccess } from "../util/query.js"; diff --git a/packages/taler-wallet-core/src/operations/pay.ts b/packages/taler-wallet-core/src/operations/pay.ts index c57243b59..86b66e6f6 100644 --- a/packages/taler-wallet-core/src/operations/pay.ts +++ b/packages/taler-wallet-core/src/operations/pay.ts @@ -1649,8 +1649,9 @@ export async function refuseProposal( ws: InternalWalletState, proposalId: string, ): Promise<void> { - const success = await ws.db.mktx((x) => ({proposals: x.proposals})).runReadWrite( - async (tx) => { + const success = await ws.db + .mktx((x) => ({ proposals: x.proposals })) + .runReadWrite(async (tx) => { const proposal = await tx.proposals.get(proposalId); if (!proposal) { logger.trace(`proposal ${proposalId} not found, won't refuse proposal`); @@ -1662,8 +1663,7 @@ export async function refuseProposal( proposal.proposalStatus = ProposalStatus.REFUSED; await tx.proposals.put(proposal); return true; - }, - ); + }); if (success) { ws.notify({ type: NotificationType.ProposalRefused, diff --git a/packages/taler-wallet-core/src/operations/pending.ts b/packages/taler-wallet-core/src/operations/pending.ts index d3904c426..4eee85278 100644 --- a/packages/taler-wallet-core/src/operations/pending.ts +++ b/packages/taler-wallet-core/src/operations/pending.ts @@ -239,7 +239,7 @@ async function gatherRefreshPending( async function gatherWithdrawalPending( tx: GetReadOnlyAccess<{ withdrawalGroups: typeof WalletStoresV1.withdrawalGroups; - planchets: typeof WalletStoresV1.planchets, + planchets: typeof WalletStoresV1.planchets; }>, now: Timestamp, resp: PendingOperationsResponse, @@ -464,21 +464,22 @@ export async function getPendingOperations( { onlyDue = false } = {}, ): Promise<PendingOperationsResponse> { const now = getTimestampNow(); - return await ws.db.mktx((x) => ({ - exchanges: x.exchanges, - exchangeDetails: x.exchangeDetails, - reserves: x.reserves, - refreshGroups: x.refreshGroups, - coins: x.coins, - withdrawalGroups: x.withdrawalGroups, - proposals: x.proposals, - tips: x.tips, - purchases: x.purchases, - planchets: x.planchets, - depositGroups: x.depositGroups, - recoupGroups: x.recoupGroups, - })).runReadWrite( - async (tx) => { + return await ws.db + .mktx((x) => ({ + exchanges: x.exchanges, + exchangeDetails: x.exchangeDetails, + reserves: x.reserves, + refreshGroups: x.refreshGroups, + coins: x.coins, + withdrawalGroups: x.withdrawalGroups, + proposals: x.proposals, + tips: x.tips, + purchases: x.purchases, + planchets: x.planchets, + depositGroups: x.depositGroups, + recoupGroups: x.recoupGroups, + })) + .runReadWrite(async (tx) => { const walletBalance = await getBalancesInsideTransaction(ws, tx); const resp: PendingOperationsResponse = { nextRetryDelay: { d_ms: Number.MAX_SAFE_INTEGER }, @@ -496,6 +497,5 @@ export async function getPendingOperations( await gatherRecoupPending(tx, now, resp, onlyDue); await gatherDepositPending(tx, now, resp, onlyDue); return resp; - }, - ); + }); } diff --git a/packages/taler-wallet-core/src/operations/testing.ts b/packages/taler-wallet-core/src/operations/testing.ts index 6875a308f..c9d99bf04 100644 --- a/packages/taler-wallet-core/src/operations/testing.ts +++ b/packages/taler-wallet-core/src/operations/testing.ts @@ -23,7 +23,16 @@ import { readSuccessResponseJsonOrThrow, checkSuccessResponseOrThrow, } from "../util/http"; -import { AmountString, codecForAny, CheckPaymentResponse, codecForCheckPaymentResponse, IntegrationTestArgs, Amounts, TestPayArgs, PreparePayResultType } from "@gnu-taler/taler-util"; +import { + AmountString, + codecForAny, + CheckPaymentResponse, + codecForCheckPaymentResponse, + IntegrationTestArgs, + Amounts, + TestPayArgs, + PreparePayResultType, +} from "@gnu-taler/taler-util"; import { URL } from "../index.js"; import { Wallet } from "../wallet.js"; import { createTalerWithdrawReserve } from "./reserves.js"; @@ -102,8 +111,8 @@ export async function withdrawTestBalance( function getMerchantAuthHeader(m: MerchantBackendInfo): Record<string, string> { if (m.authToken) { return { - "Authorization": `Bearer ${m.authToken}`, - } + Authorization: `Bearer ${m.authToken}`, + }; } return {}; } diff --git a/packages/taler-wallet-core/src/pending-types.ts b/packages/taler-wallet-core/src/pending-types.ts index c16f729bc..78e01416c 100644 --- a/packages/taler-wallet-core/src/pending-types.ts +++ b/packages/taler-wallet-core/src/pending-types.ts @@ -24,7 +24,12 @@ /** * Imports. */ -import { TalerErrorDetails, BalancesResponse, Duration, Timestamp } from "@gnu-taler/taler-util"; +import { + TalerErrorDetails, + BalancesResponse, + Duration, + Timestamp, +} from "@gnu-taler/taler-util"; import { ReserveRecordStatus } from "./db.js"; import { RetryInfo } from "./util/retries.js"; |