From 1cde390c23f2668a3777752632c48febd10a28ee Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 14 Jun 2021 16:08:58 +0200 Subject: fix up imports, no more esm in tests --- packages/taler-wallet-core/package.json | 19 ++------ .../taler-wallet-core/src/crypto/primitives/kdf.ts | 4 +- .../src/crypto/talerCrypto-test.ts | 6 +-- .../taler-wallet-core/src/crypto/talerCrypto.ts | 4 +- .../src/crypto/workers/cryptoApi.ts | 6 +-- packages/taler-wallet-core/src/db.ts | 2 +- .../src/operations/backup/export.ts | 9 ++-- .../src/operations/backup/import.ts | 6 +-- .../src/operations/backup/index.ts | 26 +++++----- .../src/operations/backup/state.ts | 6 +-- .../taler-wallet-core/src/operations/deposits.ts | 14 +++--- .../taler-wallet-core/src/operations/exchanges.ts | 13 ++--- packages/taler-wallet-core/src/operations/pay.ts | 56 +++++++++++----------- .../taler-wallet-core/src/operations/pending.ts | 6 +-- .../taler-wallet-core/src/operations/recoup.ts | 16 +++---- .../taler-wallet-core/src/operations/refresh.ts | 19 ++++---- .../taler-wallet-core/src/operations/refund.ts | 15 +++--- packages/taler-wallet-core/src/operations/state.ts | 8 +--- .../taler-wallet-core/src/operations/testing.ts | 4 +- packages/taler-wallet-core/src/operations/tip.ts | 15 +++--- .../src/operations/transactions.ts | 4 +- .../src/operations/withdraw.test.ts | 2 +- .../taler-wallet-core/src/operations/withdraw.ts | 16 +++---- .../src/util/coinSelection.test.ts | 4 +- .../taler-wallet-core/src/util/coinSelection.ts | 2 +- packages/taler-wallet-core/src/util/http.ts | 2 +- packages/taler-wallet-core/src/util/query.ts | 3 +- 27 files changed, 128 insertions(+), 159 deletions(-) (limited to 'packages/taler-wallet-core') diff --git a/packages/taler-wallet-core/package.json b/packages/taler-wallet-core/package.json index de974469d..9956cb312 100644 --- a/packages/taler-wallet-core/package.json +++ b/packages/taler-wallet-core/package.json @@ -30,6 +30,7 @@ ], "main": "./dist/taler-wallet-core.js", "module": "./lib/index.js", + "type": "module", "types": "./lib/index.d.ts", "devDependencies": { "@ava/typescript": "^1.1.1", @@ -44,7 +45,6 @@ "eslint-plugin-jsx-a11y": "^6.4.1", "eslint-plugin-react": "^7.22.0", "eslint-plugin-react-hooks": "^4.2.0", - "esm": "^3.2.25", "jed": "^1.1.1", "nyc": "^15.1.0", "po2json": "^0.4.5", @@ -67,21 +67,8 @@ "tslib": "^2.1.0" }, "ava": { - "require": [ - "esm" - ], "files": [ - "src/**/*.test.*" - ], - "typescript": { - "extensions": [ - "js", - "ts", - "tsx" - ], - "rewritePaths": { - "src/": "lib/" - } - } + "lib/**/*test*" + ] } } diff --git a/packages/taler-wallet-core/src/crypto/primitives/kdf.ts b/packages/taler-wallet-core/src/crypto/primitives/kdf.ts index edc681bc1..af4d05035 100644 --- a/packages/taler-wallet-core/src/crypto/primitives/kdf.ts +++ b/packages/taler-wallet-core/src/crypto/primitives/kdf.ts @@ -14,8 +14,8 @@ GNU Taler; see the file COPYING. If not, see */ -import * as nacl from "./nacl-fast"; -import { sha256 } from "./sha256"; +import * as nacl from "./nacl-fast.js"; +import { sha256 } from "./sha256.js"; export function sha512(data: Uint8Array): Uint8Array { return nacl.hash(data); diff --git a/packages/taler-wallet-core/src/crypto/talerCrypto-test.ts b/packages/taler-wallet-core/src/crypto/talerCrypto-test.ts index 99a0e12c0..3718290d7 100644 --- a/packages/taler-wallet-core/src/crypto/talerCrypto-test.ts +++ b/packages/taler-wallet-core/src/crypto/talerCrypto-test.ts @@ -30,9 +30,9 @@ import { stringToBytes, bytesToString, rsaVerify, -} from "./talerCrypto"; -import { sha512, kdf } from "./primitives/kdf"; -import * as nacl from "./primitives/nacl-fast"; +} from "./talerCrypto.js"; +import { sha512, kdf } from "./primitives/kdf.js"; +import * as nacl from "./primitives/nacl-fast.js"; test("encoding", (t) => { const s = "Hello, World"; diff --git a/packages/taler-wallet-core/src/crypto/talerCrypto.ts b/packages/taler-wallet-core/src/crypto/talerCrypto.ts index 381896858..5739bc464 100644 --- a/packages/taler-wallet-core/src/crypto/talerCrypto.ts +++ b/packages/taler-wallet-core/src/crypto/talerCrypto.ts @@ -18,9 +18,9 @@ * Native implementation of GNU Taler crypto. */ -import * as nacl from "./primitives/nacl-fast"; +import * as nacl from "./primitives/nacl-fast.js"; import bigint from "big-integer"; -import { kdf } from "./primitives/kdf"; +import { kdf } from "./primitives/kdf.js"; // @ts-ignore const decoder = new TextDecoder(); diff --git a/packages/taler-wallet-core/src/crypto/workers/cryptoApi.ts b/packages/taler-wallet-core/src/crypto/workers/cryptoApi.ts index a38441067..546099777 100644 --- a/packages/taler-wallet-core/src/crypto/workers/cryptoApi.ts +++ b/packages/taler-wallet-core/src/crypto/workers/cryptoApi.ts @@ -22,9 +22,9 @@ /** * Imports. */ -import { CoinRecord, DenominationRecord, WireFee } from "../../db"; +import { CoinRecord, DenominationRecord, WireFee } from "../../db.js"; -import { CryptoWorker } from "./cryptoWorker"; +import { CryptoWorker } from "./cryptoWorker.js"; import { RecoupRequest, CoinDepositPermission } from "@gnu-taler/taler-util"; @@ -36,7 +36,7 @@ import { MakeSyncSignatureRequest, } from "@gnu-taler/taler-util"; -import * as timer from "../../util/timer"; +import * as timer from "../../util/timer.js"; import { Logger } from "@gnu-taler/taler-util"; import { DerivedRefreshSession, diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts index 62b0e2283..8f9d5757d 100644 --- a/packages/taler-wallet-core/src/db.ts +++ b/packages/taler-wallet-core/src/db.ts @@ -26,7 +26,7 @@ import { StoreDescriptor, StoreWithIndexes, IndexDescriptor, -} from "./util/query"; +} from "./util/query.js"; import { IDBFactory, IDBDatabase, IDBTransaction } from "@gnu-taler/idb-bridge"; import { Logger } from "@gnu-taler/taler-util"; import { diff --git a/packages/taler-wallet-core/src/operations/backup/export.ts b/packages/taler-wallet-core/src/operations/backup/export.ts index a62c26d68..4eab9d5ee 100644 --- a/packages/taler-wallet-core/src/operations/backup/export.ts +++ b/packages/taler-wallet-core/src/operations/backup/export.ts @@ -24,7 +24,7 @@ /** * Imports. */ -import { hash } from "../../crypto/primitives/nacl-fast"; +import { hash } from "../../crypto/primitives/nacl-fast.js"; import { WalletBackupContentV1, BackupExchange, @@ -49,11 +49,8 @@ import { BackupRefreshSession, BackupExchangeDetails, } from "@gnu-taler/taler-util"; -import { InternalWalletState } from "../state"; -import { - provideBackupState, - getWalletBackupState, -} from "./state"; +import { InternalWalletState } from "../state.js"; +import { provideBackupState, getWalletBackupState } from "./state"; import { Amounts, getTimestampNow } from "@gnu-taler/taler-util"; import { CoinSourceType, diff --git a/packages/taler-wallet-core/src/operations/backup/import.ts b/packages/taler-wallet-core/src/operations/backup/import.ts index b29491948..1caa508ff 100644 --- a/packages/taler-wallet-core/src/operations/backup/import.ts +++ b/packages/taler-wallet-core/src/operations/backup/import.ts @@ -50,9 +50,9 @@ import { PayCoinSelection } from "../../util/coinSelection"; import { j2s } from "@gnu-taler/taler-util"; import { checkDbInvariant, checkLogicInvariant } from "../../util/invariants"; import { Logger } from "@gnu-taler/taler-util"; -import { initRetryInfo } from "../../util/retries"; -import { InternalWalletState } from "../state"; -import { provideBackupState } from "./state"; +import { initRetryInfo } from "../../util/retries.js"; +import { InternalWalletState } from "../state.js"; +import { provideBackupState } from "./state.js"; import { makeEventId, TombstoneTag } from "../transactions.js"; import { getExchangeDetails } from "../exchanges.js"; import { GetReadOnlyAccess, GetReadWriteAccess } from "../../util/query.js"; diff --git a/packages/taler-wallet-core/src/operations/backup/index.ts b/packages/taler-wallet-core/src/operations/backup/index.ts index 86f1df541..00a76bd19 100644 --- a/packages/taler-wallet-core/src/operations/backup/index.ts +++ b/packages/taler-wallet-core/src/operations/backup/index.ts @@ -24,7 +24,7 @@ /** * Imports. */ -import { InternalWalletState } from "../state"; +import { InternalWalletState } from "../state.js"; import { AmountString, BackupRecovery, @@ -38,7 +38,7 @@ import { WalletBackupConfState, WALLET_BACKUP_STATE_KEY, } from "../../db.js"; -import { checkDbInvariant, checkLogicInvariant } from "../../util/invariants"; +import { checkDbInvariant, checkLogicInvariant } from "../../util/invariants.js"; import { bytesToString, decodeCrock, @@ -49,7 +49,7 @@ import { hash, rsaBlind, stringToBytes, -} from "../../crypto/talerCrypto"; +} from "../../crypto/talerCrypto.js"; import { canonicalizeBaseUrl, canonicalJson, j2s } from "@gnu-taler/taler-util"; import { durationFromSpec, @@ -57,7 +57,7 @@ import { Timestamp, timestampAddDuration, } from "@gnu-taler/taler-util"; -import { URL } from "../../util/url"; +import { URL } from "../../util/url.js"; import { buildCodecForObject, Codec, @@ -70,11 +70,11 @@ import { HttpResponseStatus, readSuccessResponseJsonOrThrow, readTalerErrorResponse, -} from "../../util/http"; +} from "../../util/http.js"; import { Logger } from "@gnu-taler/taler-util"; import { gunzipSync, gzipSync } from "fflate"; -import { kdf } from "../../crypto/primitives/kdf"; -import { initRetryInfo } from "../../util/retries"; +import { kdf } from "../../crypto/primitives/kdf.js"; +import { initRetryInfo } from "../../util/retries.js"; import { ConfirmPayResultType, PreparePayResultType, @@ -82,12 +82,12 @@ import { RecoveryMergeStrategy, TalerErrorDetails, } from "@gnu-taler/taler-util"; -import { CryptoApi } from "../../crypto/workers/cryptoApi"; -import { secretbox, secretbox_open } from "../../crypto/primitives/nacl-fast"; -import { checkPaymentByProposalId, confirmPay, preparePayForUri } from "../pay"; -import { exportBackup } from "./export"; -import { BackupCryptoPrecomputedData, importBackup } from "./import"; -import { provideBackupState, getWalletBackupState } from "./state"; +import { CryptoApi } from "../../crypto/workers/cryptoApi.js"; +import { secretbox, secretbox_open } from "../../crypto/primitives/nacl-fast.js"; +import { checkPaymentByProposalId, confirmPay, preparePayForUri } from "../pay.js"; +import { exportBackup } from "./export.js"; +import { BackupCryptoPrecomputedData, importBackup } from "./import.js"; +import { provideBackupState, getWalletBackupState } from "./state.js"; const logger = new Logger("operations/backup.ts"); diff --git a/packages/taler-wallet-core/src/operations/backup/state.ts b/packages/taler-wallet-core/src/operations/backup/state.ts index 1ab0c027e..bb540d5af 100644 --- a/packages/taler-wallet-core/src/operations/backup/state.ts +++ b/packages/taler-wallet-core/src/operations/backup/state.ts @@ -14,16 +14,16 @@ GNU Taler; see the file COPYING. If not, see */ +import { encodeCrock, getRandomBytes } from "../../crypto/talerCrypto.js"; import { ConfigRecord, WalletBackupConfState, WalletStoresV1, WALLET_BACKUP_STATE_KEY, } from "../../db.js"; -import { getRandomBytes, encodeCrock } from "../../index.js"; -import { checkDbInvariant } from "../../util/invariants"; +import { checkDbInvariant } from "../../util/invariants.js"; import { GetReadOnlyAccess } from "../../util/query.js"; -import { InternalWalletState } from "../state"; +import { InternalWalletState } from "../state.js"; export async function provideBackupState( ws: InternalWalletState, diff --git a/packages/taler-wallet-core/src/operations/deposits.ts b/packages/taler-wallet-core/src/operations/deposits.ts index 23cc435ff..c376ae8e0 100644 --- a/packages/taler-wallet-core/src/operations/deposits.ts +++ b/packages/taler-wallet-core/src/operations/deposits.ts @@ -14,16 +14,16 @@ GNU Taler; see the file COPYING. If not, see */ -import { kdf } from "../crypto/primitives/kdf"; +import { kdf } from "../crypto/primitives/kdf.js"; import { encodeCrock, getRandomBytes, stringToBytes, -} from "../crypto/talerCrypto"; -import { selectPayCoins } from "../util/coinSelection"; +} from "../crypto/talerCrypto.js"; +import { selectPayCoins } from "../util/coinSelection.js"; import { canonicalJson } from "@gnu-taler/taler-util"; -import { readSuccessResponseJsonOrThrow } from "../util/http"; -import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries"; +import { readSuccessResponseJsonOrThrow } from "../util/http.js"; +import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries.js"; import { Amounts, buildCodecForObject, @@ -53,8 +53,8 @@ import { getCandidatePayCoins, getEffectiveDepositAmount, getTotalPaymentCost, -} from "./pay"; -import { InternalWalletState } from "./state"; +} from "./pay.js"; +import { InternalWalletState } from "./state.js"; import { Logger } from "@gnu-taler/taler-util"; import { DepositGroupRecord } from "../db.js"; diff --git a/packages/taler-wallet-core/src/operations/exchanges.ts b/packages/taler-wallet-core/src/operations/exchanges.ts index 1f9a2ea6a..1948f70e1 100644 --- a/packages/taler-wallet-core/src/operations/exchanges.ts +++ b/packages/taler-wallet-core/src/operations/exchanges.ts @@ -47,15 +47,6 @@ import { WireInfo, WalletStoresV1, } from "../db.js"; -import { - URL, - readSuccessResponseJsonOrThrow, - getExpiryTimestamp, - readSuccessResponseTextOrThrow, - encodeCrock, - hash, - decodeCrock, -} from "../index.js"; import { j2s, canonicalizeBaseUrl } from "@gnu-taler/taler-util"; import { updateRetryInfoTimeout, initRetryInfo } from "../util/retries.js"; import { @@ -69,9 +60,11 @@ import { WALLET_CACHE_BREAKER_CLIENT_VERSION, WALLET_EXCHANGE_PROTOCOL_VERSION, } from "./versions.js"; -import { HttpRequestLibrary } from "../util/http.js"; +import { getExpiryTimestamp, HttpRequestLibrary, readSuccessResponseJsonOrThrow, readSuccessResponseTextOrThrow } from "../util/http.js"; import { CryptoApi } from "../crypto/workers/cryptoApi.js"; import { DbAccess, GetReadOnlyAccess } from "../util/query.js"; +import { decodeCrock, encodeCrock, hash } from "../crypto/talerCrypto.js"; +import { URL } from "../util/url.js"; const logger = new Logger("exchanges.ts"); diff --git a/packages/taler-wallet-core/src/operations/pay.ts b/packages/taler-wallet-core/src/operations/pay.ts index 9bfad177a..4425262b8 100644 --- a/packages/taler-wallet-core/src/operations/pay.ts +++ b/packages/taler-wallet-core/src/operations/pay.ts @@ -54,29 +54,6 @@ import { getDurationRemaining, } from "@gnu-taler/taler-util"; import { encodeCrock, getRandomBytes } from "../crypto/talerCrypto"; -import { - AbortStatus, - AllowedAuditorInfo, - AllowedExchangeInfo, - CoinRecord, - CoinStatus, - DenominationRecord, - getHttpResponseErrorDetails, - guardOperationException, - HttpResponseStatus, - makeErrorDetails, - OperationFailedAndReportedError, - OperationFailedError, - ProposalRecord, - ProposalStatus, - PurchaseRecord, - readSuccessResponseJsonOrErrorCode, - readSuccessResponseJsonOrThrow, - readTalerErrorResponse, - throwUnexpectedRequestError, - URL, - WalletContractData, -} from "../index.js"; import { PayCoinSelection, CoinCandidateSelection, @@ -94,10 +71,35 @@ import { getTotalRefreshCost, createRefreshGroup } from "./refresh.js"; import { InternalWalletState, EXCHANGE_COINS_LOCK } from "./state.js"; import { ContractTermsUtil } from "../util/contractTerms.js"; import { getExchangeDetails } from "./exchanges.js"; -import { DbAccess, GetReadWriteAccess } from "../util/query.js"; -import { WalletStoresV1 } from "../db.js"; -import { Wallet } from "../wallet.js"; -import { x25519_edwards_keyPair_fromSecretKey } from "../crypto/primitives/nacl-fast.js"; +import { GetReadWriteAccess } from "../util/query.js"; +import { + AbortStatus, + AllowedAuditorInfo, + AllowedExchangeInfo, + CoinRecord, + CoinStatus, + DenominationRecord, + ProposalRecord, + ProposalStatus, + PurchaseRecord, + WalletContractData, + WalletStoresV1, +} from "../db.js"; +import { + getHttpResponseErrorDetails, + HttpResponseStatus, + readSuccessResponseJsonOrErrorCode, + readSuccessResponseJsonOrThrow, + readTalerErrorResponse, + throwUnexpectedRequestError, +} from "../util/http.js"; +import { + guardOperationException, + makeErrorDetails, + OperationFailedAndReportedError, + OperationFailedError, +} from "./errors.js"; +import { URL } from "../util/url.js"; /** * Logger. diff --git a/packages/taler-wallet-core/src/operations/pending.ts b/packages/taler-wallet-core/src/operations/pending.ts index 8ab114ca0..8201e8cb9 100644 --- a/packages/taler-wallet-core/src/operations/pending.ts +++ b/packages/taler-wallet-core/src/operations/pending.ts @@ -27,10 +27,10 @@ import { PendingOperationsResponse, PendingOperationType, ReserveType, -} from "../pending-types"; +} from "../pending-types.js"; import { getTimestampNow, Timestamp } from "@gnu-taler/taler-util"; -import { InternalWalletState } from "./state"; -import { getBalancesInsideTransaction } from "./balance"; +import { InternalWalletState } from "./state.js"; +import { getBalancesInsideTransaction } from "./balance.js"; import { GetReadOnlyAccess } from "../util/query.js"; async function gatherExchangePending( diff --git a/packages/taler-wallet-core/src/operations/recoup.ts b/packages/taler-wallet-core/src/operations/recoup.ts index 24ac828f3..938422d3b 100644 --- a/packages/taler-wallet-core/src/operations/recoup.ts +++ b/packages/taler-wallet-core/src/operations/recoup.ts @@ -32,7 +32,7 @@ import { RefreshReason, TalerErrorDetails, } from "@gnu-taler/taler-util"; -import { encodeCrock, getRandomBytes } from "../crypto/talerCrypto"; +import { encodeCrock, getRandomBytes } from "../crypto/talerCrypto.js"; import { CoinRecord, CoinSourceType, @@ -44,14 +44,14 @@ import { WalletStoresV1, } from "../db.js"; -import { readSuccessResponseJsonOrThrow } from "../util/http"; +import { readSuccessResponseJsonOrThrow } from "../util/http.js"; import { Logger } from "@gnu-taler/taler-util"; -import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries"; -import { URL } from "../util/url"; -import { guardOperationException } from "./errors"; -import { createRefreshGroup, processRefreshGroup } from "./refresh"; -import { getReserveRequestTimeout, processReserve } from "./reserves"; -import { InternalWalletState } from "./state"; +import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries.js"; +import { URL } from "../util/url.js"; +import { guardOperationException } from "./errors.js"; +import { createRefreshGroup, processRefreshGroup } from "./refresh.js"; +import { getReserveRequestTimeout, processReserve } from "./reserves.js"; +import { InternalWalletState } from "./state.js"; import { GetReadWriteAccess } from "../util/query.js"; const logger = new Logger("operations/recoup.ts"); diff --git a/packages/taler-wallet-core/src/operations/refresh.ts b/packages/taler-wallet-core/src/operations/refresh.ts index 0b0eb4c4a..c442a7c90 100644 --- a/packages/taler-wallet-core/src/operations/refresh.ts +++ b/packages/taler-wallet-core/src/operations/refresh.ts @@ -14,7 +14,7 @@ GNU Taler; see the file COPYING. If not, see */ -import { encodeCrock, getRandomBytes } from "../crypto/talerCrypto"; +import { encodeCrock, getRandomBytes } from "../crypto/talerCrypto.js"; import { CoinRecord, CoinSourceType, @@ -36,10 +36,10 @@ import { } from "@gnu-taler/taler-util"; import { AmountJson, Amounts } from "@gnu-taler/taler-util"; import { amountToPretty } from "@gnu-taler/taler-util"; -import { readSuccessResponseJsonOrThrow } from "../util/http"; -import { checkDbInvariant } from "../util/invariants"; +import { readSuccessResponseJsonOrThrow } from "../util/http.js"; +import { checkDbInvariant } from "../util/invariants.js"; import { Logger } from "@gnu-taler/taler-util"; -import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries"; +import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries.js"; import { Duration, durationFromSpec, @@ -51,14 +51,13 @@ import { timestampDifference, timestampMin, } from "@gnu-taler/taler-util"; -import { URL } from "../util/url"; -import { guardOperationException } from "./errors"; -import { updateExchangeFromUrl } from "./exchanges"; -import { EXCHANGE_COINS_LOCK, InternalWalletState } from "./state"; -import { isWithdrawableDenom, selectWithdrawalDenominations } from "./withdraw"; +import { URL } from "../util/url.js"; +import { guardOperationException } from "./errors.js"; +import { updateExchangeFromUrl } from "./exchanges.js"; +import { EXCHANGE_COINS_LOCK, InternalWalletState } from "./state.js"; +import { isWithdrawableDenom, selectWithdrawalDenominations } from "./withdraw.js"; import { RefreshNewDenomInfo } from "../crypto/cryptoTypes.js"; import { GetReadWriteAccess } from "../util/query.js"; -import { Wallet } from "../wallet.js"; const logger = new Logger("refresh.ts"); diff --git a/packages/taler-wallet-core/src/operations/refund.ts b/packages/taler-wallet-core/src/operations/refund.ts index b3d368afa..6ef55e535 100644 --- a/packages/taler-wallet-core/src/operations/refund.ts +++ b/packages/taler-wallet-core/src/operations/refund.ts @@ -23,12 +23,10 @@ /** * Imports. */ -import { InternalWalletState } from "./state"; -import { guardOperationException } from "./errors"; +import { InternalWalletState } from "./state.js"; +import { guardOperationException } from "./errors.js"; import { getTimestampNow, - Timestamp, - durationAdd, timestampAddDuration, TalerErrorDetails, AbortingCoin, @@ -47,10 +45,10 @@ import { RefreshReason, } from "@gnu-taler/taler-util"; import { Logger } from "@gnu-taler/taler-util"; -import { readSuccessResponseJsonOrThrow } from "../util/http"; -import { URL } from "../util/url"; -import { updateRetryInfoTimeout, initRetryInfo } from "../util/retries"; -import { checkDbInvariant } from "../util/invariants"; +import { readSuccessResponseJsonOrThrow } from "../util/http.js"; +import { URL } from "../util/url.js"; +import { updateRetryInfoTimeout, initRetryInfo } from "../util/retries.js"; +import { checkDbInvariant } from "../util/invariants.js"; import { TalerErrorCode } from "@gnu-taler/taler-util"; import { PurchaseRecord, @@ -62,7 +60,6 @@ import { } from "../db.js"; import { getTotalRefreshCost, createRefreshGroup } from "./refresh.js"; import { GetReadWriteAccess } from "../util/query.js"; -import { Wallet } from "../wallet.js"; const logger = new Logger("refund.ts"); diff --git a/packages/taler-wallet-core/src/operations/state.ts b/packages/taler-wallet-core/src/operations/state.ts index 9bf73142c..66baa95a4 100644 --- a/packages/taler-wallet-core/src/operations/state.ts +++ b/packages/taler-wallet-core/src/operations/state.ts @@ -22,16 +22,12 @@ import { BalancesResponse, Logger, } from "@gnu-taler/taler-util"; +import { CryptoApi, CryptoWorkerFactory } from "../crypto/workers/cryptoApi.js"; import { WalletStoresV1 } from "../db.js"; -import { - CryptoApi, - OpenedPromise, - CryptoWorkerFactory, - openPromise, -} from "../index.js"; import { PendingOperationsResponse } from "../pending-types.js"; import { AsyncOpMemoMap, AsyncOpMemoSingle } from "../util/asyncMemo.js"; import { HttpRequestLibrary } from "../util/http"; +import { OpenedPromise, openPromise } from "../util/promiseUtils.js"; import { DbAccess } from "../util/query.js"; type NotificationListener = (n: WalletNotification) => void; diff --git a/packages/taler-wallet-core/src/operations/testing.ts b/packages/taler-wallet-core/src/operations/testing.ts index c9d99bf04..b163569ae 100644 --- a/packages/taler-wallet-core/src/operations/testing.ts +++ b/packages/taler-wallet-core/src/operations/testing.ts @@ -22,7 +22,7 @@ import { HttpRequestLibrary, readSuccessResponseJsonOrThrow, checkSuccessResponseOrThrow, -} from "../util/http"; +} from "../util/http.js"; import { AmountString, codecForAny, @@ -33,10 +33,10 @@ import { TestPayArgs, PreparePayResultType, } from "@gnu-taler/taler-util"; -import { URL } from "../index.js"; import { Wallet } from "../wallet.js"; import { createTalerWithdrawReserve } from "./reserves.js"; import { InternalWalletState } from "./state.js"; +import { URL } from "../util/url.js"; const logger = new Logger("operations/testing.ts"); diff --git a/packages/taler-wallet-core/src/operations/tip.ts b/packages/taler-wallet-core/src/operations/tip.ts index b96a8fcef..d82331632 100644 --- a/packages/taler-wallet-core/src/operations/tip.ts +++ b/packages/taler-wallet-core/src/operations/tip.ts @@ -37,19 +37,12 @@ import { CoinSourceType, CoinStatus, } from "../db.js"; -import { - URL, - readSuccessResponseJsonOrThrow, - encodeCrock, - getRandomBytes, - getHttpResponseErrorDetails, -} from "../index.js"; import { j2s } from "@gnu-taler/taler-util"; import { checkDbInvariant, checkLogicInvariant } from "../util/invariants.js"; import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries.js"; import { guardOperationException, makeErrorDetails } from "./errors.js"; import { updateExchangeFromUrl } from "./exchanges.js"; -import { InternalWalletState } from "./state"; +import { InternalWalletState } from "./state.js"; import { getExchangeWithdrawalInfo, updateWithdrawalDenoms, @@ -57,6 +50,12 @@ import { selectWithdrawalDenominations, denomSelectionInfoToState, } from "./withdraw.js"; +import { URL } from "../util/url.js"; +import { + getHttpResponseErrorDetails, + readSuccessResponseJsonOrThrow, +} from "../util/http.js"; +import { encodeCrock, getRandomBytes } from "../crypto/talerCrypto.js"; const logger = new Logger("operations/tip.ts"); diff --git a/packages/taler-wallet-core/src/operations/transactions.ts b/packages/taler-wallet-core/src/operations/transactions.ts index ecef3c2ce..3d9f1be41 100644 --- a/packages/taler-wallet-core/src/operations/transactions.ts +++ b/packages/taler-wallet-core/src/operations/transactions.ts @@ -17,7 +17,7 @@ /** * Imports. */ -import { InternalWalletState } from "./state"; +import { InternalWalletState } from "./state.js"; import { WalletRefundItem, RefundState, @@ -36,7 +36,7 @@ import { WithdrawalDetails, OrderShortInfo, } from "@gnu-taler/taler-util"; -import { getFundingPaytoUris } from "./reserves"; +import { getFundingPaytoUris } from "./reserves.js"; import { getExchangeDetails } from "./exchanges.js"; /** diff --git a/packages/taler-wallet-core/src/operations/withdraw.test.ts b/packages/taler-wallet-core/src/operations/withdraw.test.ts index a059eef95..c6de0a321 100644 --- a/packages/taler-wallet-core/src/operations/withdraw.test.ts +++ b/packages/taler-wallet-core/src/operations/withdraw.test.ts @@ -17,7 +17,7 @@ import { Amounts } from "@gnu-taler/taler-util"; import test from "ava"; import { DenominationRecord, DenominationStatus } from "../db.js"; -import { selectWithdrawalDenominations } from "./withdraw"; +import { selectWithdrawalDenominations } from "./withdraw.js"; test("withdrawal selection bug repro", (t) => { const amount = { diff --git a/packages/taler-wallet-core/src/operations/withdraw.ts b/packages/taler-wallet-core/src/operations/withdraw.ts index 9f5c225fc..3400238ed 100644 --- a/packages/taler-wallet-core/src/operations/withdraw.ts +++ b/packages/taler-wallet-core/src/operations/withdraw.ts @@ -35,7 +35,7 @@ import { DenomSelectionState, ExchangeRecord, ExchangeDetailsRecord, -} from "../db"; +} from "../db.js"; import { BankWithdrawDetails, TalerErrorDetails, @@ -48,20 +48,20 @@ import { WithdrawResponse, codecForTalerConfigResponse, } from "@gnu-taler/taler-util"; -import { InternalWalletState } from "./state"; +import { InternalWalletState } from "./state.js"; import { Logger } from "@gnu-taler/taler-util"; -import { getExchangeDetails, updateExchangeFromUrl } from "./exchanges"; +import { getExchangeDetails, updateExchangeFromUrl } from "./exchanges.js"; import { WALLET_EXCHANGE_PROTOCOL_VERSION, WALLET_BANK_INTEGRATION_PROTOCOL_VERSION, -} from "./versions"; +} from "./versions.js"; import * as LibtoolVersion from "@gnu-taler/taler-util"; import { guardOperationException, makeErrorDetails, OperationFailedError, -} from "./errors"; +} from "./errors.js"; import { NotificationType } from "@gnu-taler/taler-util"; import { getTimestampNow, @@ -69,10 +69,10 @@ import { timestampCmp, timestampSubtractDuraction, } from "@gnu-taler/taler-util"; -import { readSuccessResponseJsonOrThrow } from "../util/http"; -import { URL } from "../util/url"; +import { readSuccessResponseJsonOrThrow } from "../util/http.js"; +import { URL } from "../util/url.js"; import { TalerErrorCode } from "@gnu-taler/taler-util"; -import { updateRetryInfoTimeout, initRetryInfo } from "../util/retries"; +import { updateRetryInfoTimeout, initRetryInfo } from "../util/retries.js"; import { compare } from "@gnu-taler/taler-util"; import { walletCoreDebugFlags } from "../util/debugFlags.js"; import { getExchangeTrust } from "./currencies.js"; diff --git a/packages/taler-wallet-core/src/util/coinSelection.test.ts b/packages/taler-wallet-core/src/util/coinSelection.test.ts index bfcd05cce..1e87bc1f3 100644 --- a/packages/taler-wallet-core/src/util/coinSelection.test.ts +++ b/packages/taler-wallet-core/src/util/coinSelection.test.ts @@ -17,9 +17,9 @@ /** * Imports. */ + import test from "ava"; import { AmountJson, Amounts } from "@gnu-taler/taler-util"; -import test from "ava"; -import { AvailableCoinInfo, selectPayCoins } from "./coinSelection"; +import { AvailableCoinInfo, selectPayCoins } from "./coinSelection.js"; function a(x: string): AmountJson { const amt = Amounts.parse(x); diff --git a/packages/taler-wallet-core/src/util/coinSelection.ts b/packages/taler-wallet-core/src/util/coinSelection.ts index bd90526a5..500cee5d8 100644 --- a/packages/taler-wallet-core/src/util/coinSelection.ts +++ b/packages/taler-wallet-core/src/util/coinSelection.ts @@ -23,7 +23,7 @@ /** * Imports. */ -import { AmountJson, AmountLike, Amounts } from "@gnu-taler/taler-util"; +import { AmountJson, Amounts } from "@gnu-taler/taler-util"; import { strcmp, Logger } from "@gnu-taler/taler-util"; const logger = new Logger("coinSelection.ts"); diff --git a/packages/taler-wallet-core/src/util/http.ts b/packages/taler-wallet-core/src/util/http.ts index 649105f2e..868619ada 100644 --- a/packages/taler-wallet-core/src/util/http.ts +++ b/packages/taler-wallet-core/src/util/http.ts @@ -24,7 +24,7 @@ /** * Imports */ -import { OperationFailedError, makeErrorDetails } from "../operations/errors"; +import { OperationFailedError, makeErrorDetails } from "../operations/errors.js"; import { Logger, Duration, diff --git a/packages/taler-wallet-core/src/util/query.ts b/packages/taler-wallet-core/src/util/query.ts index cf3f791d5..c7c08b47c 100644 --- a/packages/taler-wallet-core/src/util/query.ts +++ b/packages/taler-wallet-core/src/util/query.ts @@ -23,7 +23,7 @@ /** * Imports. */ -import { openPromise } from "./promiseUtils"; +import { openPromise } from "./promiseUtils.js"; import { IDBRequest, IDBTransaction, @@ -31,7 +31,6 @@ import { IDBDatabase, IDBFactory, IDBVersionChangeEvent, - Event, IDBCursor, IDBKeyPath, } from "@gnu-taler/idb-bridge"; -- cgit v1.2.3