From 7e80682ef6423da2c3a10dcd03ba19d496394fcf Mon Sep 17 00:00:00 2001 From: Peter Somogyvari Date: Tue, 31 Oct 2023 12:23:15 -0700 Subject: [PATCH] build(typescript): project-wide fixes to allow us to use ESM-only deps Apologies for the huge diff, this can't be broken down to smaller changes that would still compile because of cross-package dependencies. I realize that this change is not exactly the optimal solution, but it is probably a step in the right direction. If I somehow found the time to submit pull requests to the libraries that I needed to fork and re-publish (see details below) and then get the changes onto the upstream and get them released as the official packages, then we could (in theory) arrive at a solution that is the recommended way of fixing these problems (apart from going full ESM-only) This work stands on the shoulders of the previous commits from @outSH and takes a slightly different direction compared to what we've been talking about earlier on account of the problem that the eval-import workaround causes crashes in Jest. Based on the above I went through the following adventures: 1. I migrated the build system of kubo-rpc-client myself so that it correctly exports CJS and ESM and typings for both of those as well, I put that code on my fork [1] and then published it onto npm as well [2] After this, I was hoping that now we could just import the package in our CJS code without issues, but what really happened is that instead of crashing at the require call that pull in kubo itself, it started crashing deeper in the require stack where kubo itself was requiring it's own ESM only dependencies (of which there seem to be at least 10 or 15). At this point I realized that me migrating and self-publishing all of these additional packages might not be worth the effort and started looking for something easier. 2. I gave dynamic imports + moduleResultion=Node16 as my next attempt to get our build back to working order. With this, the kubo-rpc-client can now be imported dynamically without issues in packages that declare themselves as resolving modules as "Node16" in their tsconfig.json Other issues here were encountered because not all of our ESM only packages are used in a way that they can be imported dynamically (for example if their types are part of our own types or are being re-exported). The two libraries with this problem were `run-time-error` and `socket.io-client` for both of which I ended up going through the same treatment as for kubo-rpc-client above (but this time my effort wasn't) in vain. They work and so I did some search and replace in the entire codebase to use these re-published packages with the correct types: [3] [4] [5] [6] 3. After this the project build was working, but Jest was still failing with compiler errors which I determined to happen because it uses the root tsconfig.json file for it's internal TS compilation and that root tsconfig.json file was not setting module resolution to Node16. 4. After fixing that the final hurdle (hopefully) was to ensure that jest gets execued with the custom node option as below: NODE_OPTIONS=--experimental-vm-modules yarn jest [1] https://github.com/petermetz/js-kubo-rpc-client-esm-cjs [2] https://www.npmjs.com/package/kubo-rpc-client-esm-cjs [3] https://github.com/petermetz/socket.io-client [4] https://www.npmjs.com/package/socket.io-client-fixed-types [5] https://github.com/petermetz/RuntimeError [6] https://www.npmjs.com/package/run-time-error-cjs Huge thanks for https://arethetypeswrong.github.io/ a tool I used extensively to create the fixes for the libraries above. One more thing that I tried just to collect more data points was to set the moduleResultion project-wide to Node16 via setting it in the root tsconfig.base.json but this broke the compiler itself, as in, there is a bug in the Typescript compiler in v4.x as seen here: https://github.com/microsoft/TypeScript/issues/51221 So this is one more reason for us to upgrade to 5.x as soon as possible. Signed-off-by: Peter Somogyvari --- .../package.json | 2 +- .../cbdc-bridging-app-dummy-infrastructure.ts | 4 +- .../tsconfig.json | 1 + .../business-logic-asset-trade.ts | 2 +- .../transferNumericAsset.ts | 2 +- .../converter/bamboo-harvest-converter.ts | 2 +- .../model/converter/bookshelf-converter.ts | 2 +- .../bamboo-harvest-detail.page.ts | 2 +- .../transferNumericAsset.ts | 2 +- .../package.json | 4 +- .../plugin-htlc-coordinator-besu.ts | 2 +- .../package.json | 5 +- .../main/typescript/kubo-rpc-client-types.ts | 12 +- .../typescript/plugin-object-store-ipfs.ts | 8 +- .../plugin-object-store-ipfs.test.ts | 7 +- .../unit/plugin-object-store-ipfs.test.ts | 5 +- .../tsconfig.json | 4 +- jest.config.js | 3 +- package.json | 8 +- .../testcli/package.json | 2 +- .../testcli/testsock.js | 2 +- packages/cacti-esm-compat-hacks/README.md | 17 -- packages/cacti-esm-compat-hacks/package.json | 64 -------- .../src/main/typescript/dynamic-import.ts | 20 --- .../src/main/typescript/index.ts | 1 - .../src/main/typescript/index.web.ts | 1 - .../src/main/typescript/public-api.ts | 1 - .../integration/api-surface.test.ts | 6 - packages/cacti-esm-compat-hacks/tsconfig.json | 14 -- packages/cactus-api-client/package.json | 3 +- .../main/typescript/socketio-api-client.ts | 2 +- packages/cactus-cmd-api-server/package.json | 4 +- .../api-client/api-server-api-client.ts | 10 +- .../src/main/typescript/api-server.ts | 4 +- .../get-open-api-spec-v1-endpoint.test.ts | 2 +- ...pc-proto-gen-ts-client-healthcheck.test.ts | 2 +- ...-proto-gen-ts-client-m-tls-enabled.test.ts | 2 +- .../cactus-cmd-socketio-server/package.json | 2 +- .../src/main/typescript/verifier/Verifier.ts | 2 +- .../create-runtime-error-with-cause.ts | 2 +- .../create-runtime-error-with-cause.test.ts | 2 +- .../get-open-api-spec-v1-endpoint-base.ts | 2 +- .../package.json | 4 +- .../typescript/api-client/besu-api-client.ts | 2 +- .../plugin-ledger-connector-besu.ts | 2 +- .../package.json | 4 +- .../api-client/ethereum-api-client.ts | 2 +- .../plugin-ledger-connector-ethereum.ts | 2 +- .../package.json | 4 +- .../api-client/fabric-api-client.ts | 2 +- .../main/typescript/common/is-ssh-exec-ok.ts | 2 +- .../plugin-ledger-connector-fabric.ts | 2 +- .../watch-blocks/watch-blocks-v1-endpoint.ts | 2 +- .../package.json | 2 +- .../test/typescript/unit-test/package.json | 2 +- .../unit-test/validatorDriver_getNonceHex.ts | 2 +- .../validatorDriver_getNumericBalance.ts | 2 +- .../validatorDriver_sendRawTransaction.ts | 2 +- .../validatorDriver_transferNumericAsset.ts | 2 +- .../package.json | 4 +- .../typescript/api-client/iroha-api-client.ts | 4 +- .../typescript/iroha-transaction-wrapper.ts | 2 +- .../plugin-ledger-connector-iroha.ts | 2 +- .../iroha-iroha-transfer-example.test.ts | 2 +- .../iroha-socketio-endpoint.test.ts | 2 +- .../openapi/openapi-validation.test.ts | 2 +- .../run-transaction-endpoint-v1.test.ts | 2 +- .../package.json | 2 +- .../api-client/iroha2-api-client.ts | 2 +- .../package.json | 4 +- .../api-client/quorum-api-client.ts | 2 +- .../plugin-ledger-connector-quorum.ts | 2 +- .../plugin-ledger-connector-xdai.ts | 2 +- .../cactus-plugin-odap-hermes/package.json | 2 +- .../backup-gateway-after-client-crash.test.ts | 3 +- .../client-crash-after-delete-asset.test.ts | 3 +- .../client-crash-after-lock-asset.test.ts | 3 +- ...nt-crash-after-transfer-initiation.test.ts | 3 +- ...dap-api-call-with-ledger-connector.test.ts | 3 +- .../integration/odap-api-call.test.ts | 3 +- .../integration/odap-rollback.test.ts | 13 +- .../test/typescript/integration/odap.test.ts | 4 +- .../server-crash-after-create-asset.test.ts | 4 +- ...er-crash-after-transfer-initiation.test.ts | 4 +- .../unit/client/commit-final.test.ts | 4 +- .../typescript/unit/recovery/logging.test.ts | 4 +- .../unit/recovery/recover-success.test.ts | 4 +- .../unit/recovery/recover-update-ack.test.ts | 4 +- .../unit/recovery/recover-update.test.ts | 4 +- .../typescript/unit/recovery/recover.test.ts | 4 +- .../unit/server/commit-final.test.ts | 4 +- .../unit/server/lock-evidence.test.ts | 4 +- .../cactus-plugin-odap-hermes/tsconfig.json | 6 +- .../package.json | 2 +- .../main/typescript/db-client/db-client.ts | 2 +- .../typescript/plugin-persistence-ethereum.ts | 2 +- .../token-client/base-token-client.ts | 2 +- .../token-client/token-client-erc20.ts | 2 +- .../token-client/token-client-erc721.ts | 2 +- .../src/main/typescript/utils.ts | 2 +- .../main/typescript/db-client/db-client.ts | 2 +- packages/cactus-test-geth-ledger/package.json | 2 +- .../src/main/typescript/geth-test-ledger.ts | 2 +- packages/cactus-test-tooling/package.json | 4 +- .../typescript/besu/besu-mp-test-ledger.ts | 2 +- .../src/main/typescript/common/containers.ts | 2 +- .../fabric/fabric-test-ledger-v1.ts | 2 +- .../go-ipfs/go-ipfs-test-container.ts | 2 +- .../openethereum/openethereum-test-ledger.ts | 2 +- .../rustc-container/rustc-container.ts | 2 +- .../socketio-test-setup-helpers.ts | 20 ++- .../substrate-test-ledger.ts | 2 +- tools/bump-openapi-spec-dep-versions.ts | 2 +- tools/create-production-only-archive.ts | 2 +- .../check-open-api-json-specs.ts | 2 +- .../custom-checks/check-package-json-sort.ts | 2 +- tools/custom-checks/check-pkg-licenses.ts | 2 +- tools/custom-checks/check-pkg-npm-scope.ts | 2 +- .../check-sibling-dep-version-consistency.ts | 2 +- tools/generate-sbom.ts | 2 +- tools/get-latest-sem-ver-git-tag.ts | 2 +- tools/npm-list.ts | 2 +- tools/sync-npm-deps-to-tsc-projects.ts | 2 +- tsconfig.json | 7 +- yarn.lock | 148 ++++++++++-------- 125 files changed, 265 insertions(+), 371 deletions(-) delete mode 100644 packages/cacti-esm-compat-hacks/README.md delete mode 100644 packages/cacti-esm-compat-hacks/package.json delete mode 100644 packages/cacti-esm-compat-hacks/src/main/typescript/dynamic-import.ts delete mode 100755 packages/cacti-esm-compat-hacks/src/main/typescript/index.ts delete mode 100755 packages/cacti-esm-compat-hacks/src/main/typescript/index.web.ts delete mode 100755 packages/cacti-esm-compat-hacks/src/main/typescript/public-api.ts delete mode 100644 packages/cacti-esm-compat-hacks/src/test/typescript/integration/api-surface.test.ts delete mode 100644 packages/cacti-esm-compat-hacks/tsconfig.json diff --git a/examples/cactus-example-cbdc-bridging-backend/package.json b/examples/cactus-example-cbdc-bridging-backend/package.json index 7265c4aad1b..0694cb2ebb3 100644 --- a/examples/cactus-example-cbdc-bridging-backend/package.json +++ b/examples/cactus-example-cbdc-bridging-backend/package.json @@ -75,8 +75,8 @@ "dotenv": "^16.0.1", "fabric-network": "2.2.19", "fs-extra": "10.1.0", - "ipfs-http-client": "60.0.1", "knex": "2.5.1", + "kubo-rpc-client": "3.0.1", "nyc": "^13.1.0", "openapi-types": "9.1.0", "sqlite3": "^5.0.8", diff --git a/examples/cactus-example-cbdc-bridging-backend/src/main/typescript/infrastructure/cbdc-bridging-app-dummy-infrastructure.ts b/examples/cactus-example-cbdc-bridging-backend/src/main/typescript/infrastructure/cbdc-bridging-app-dummy-infrastructure.ts index 9858adb1377..223fe17b32d 100644 --- a/examples/cactus-example-cbdc-bridging-backend/src/main/typescript/infrastructure/cbdc-bridging-app-dummy-infrastructure.ts +++ b/examples/cactus-example-cbdc-bridging-backend/src/main/typescript/infrastructure/cbdc-bridging-app-dummy-infrastructure.ts @@ -1,7 +1,6 @@ import path from "path"; import { v4 as uuidv4 } from "uuid"; import fs from "fs-extra"; -import { create } from "ipfs-http-client"; import { Logger, Checks, @@ -289,7 +288,8 @@ export class CbdcBridgingAppDummyInfrastructure { public async createIPFSConnector(): Promise { this.log.info(`Creating Besu Connector...`); - const ipfsClientOrOptions = create({ + const kuboRpcClientModule = await import("kubo-rpc-client"); + const ipfsClientOrOptions = kuboRpcClientModule.create({ url: await this.ipfs.getApiUrl(), }); diff --git a/examples/cactus-example-cbdc-bridging-backend/tsconfig.json b/examples/cactus-example-cbdc-bridging-backend/tsconfig.json index 0dc5c643ee7..f6b8e106992 100644 --- a/examples/cactus-example-cbdc-bridging-backend/tsconfig.json +++ b/examples/cactus-example-cbdc-bridging-backend/tsconfig.json @@ -5,6 +5,7 @@ "outDir": "./dist/lib/", "declarationDir": "dist/lib", "rootDir": "./src", + "moduleResolution": "Node16", "tsBuildInfoFile": "../../.build-cache/cactus-example-cbdc-bridging-backend.tsbuildinfo", }, "references": [ diff --git a/examples/cactus-example-discounted-asset-trade/business-logic-asset-trade.ts b/examples/cactus-example-discounted-asset-trade/business-logic-asset-trade.ts index fa3a610550c..e2f6ed9385f 100644 --- a/examples/cactus-example-discounted-asset-trade/business-logic-asset-trade.ts +++ b/examples/cactus-example-discounted-asset-trade/business-logic-asset-trade.ts @@ -38,7 +38,7 @@ import { } from "./fabric-connector"; import { sendEthereumTransaction } from "./transaction-ethereum"; import { hasKey } from "@hyperledger/cactus-common"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; const moduleName = "BusinessLogicAssetTrade"; const logger = getLogger(`${moduleName}`); diff --git a/examples/cactus-example-electricity-trade/tools/transferNumericAsset/transferNumericAsset.ts b/examples/cactus-example-electricity-trade/tools/transferNumericAsset/transferNumericAsset.ts index 9af42138f2d..0f1b9edd0a7 100644 --- a/examples/cactus-example-electricity-trade/tools/transferNumericAsset/transferNumericAsset.ts +++ b/examples/cactus-example-electricity-trade/tools/transferNumericAsset/transferNumericAsset.ts @@ -5,7 +5,7 @@ * transferNumericAsset.ts */ -import { io } from "socket.io-client"; +import { io } from "socket.io-client-fixed-types"; { // Validator test program.(socket.io client) diff --git a/examples/cactus-example-supply-chain-business-logic-plugin/src/main/typescript/model/converter/bamboo-harvest-converter.ts b/examples/cactus-example-supply-chain-business-logic-plugin/src/main/typescript/model/converter/bamboo-harvest-converter.ts index 96c49251366..e6211fd075c 100644 --- a/examples/cactus-example-supply-chain-business-logic-plugin/src/main/typescript/model/converter/bamboo-harvest-converter.ts +++ b/examples/cactus-example-supply-chain-business-logic-plugin/src/main/typescript/model/converter/bamboo-harvest-converter.ts @@ -1,5 +1,5 @@ import { BambooHarvest } from "../../generated/openapi/typescript-axios"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; /** * Responsible for converting model entities such as the `BambooHarvest` to and diff --git a/examples/cactus-example-supply-chain-business-logic-plugin/src/main/typescript/model/converter/bookshelf-converter.ts b/examples/cactus-example-supply-chain-business-logic-plugin/src/main/typescript/model/converter/bookshelf-converter.ts index 5bfb05a5a9c..91f25dbc7ee 100644 --- a/examples/cactus-example-supply-chain-business-logic-plugin/src/main/typescript/model/converter/bookshelf-converter.ts +++ b/examples/cactus-example-supply-chain-business-logic-plugin/src/main/typescript/model/converter/bookshelf-converter.ts @@ -1,5 +1,5 @@ import { Bookshelf } from "../../generated/openapi/typescript-axios/index"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; /** * Responsible for converting model entities such as the `Bookshelf` to and diff --git a/examples/cactus-example-supply-chain-frontend/src/app/bamboo-harvest/bamboo-harvest-detail/bamboo-harvest-detail.page.ts b/examples/cactus-example-supply-chain-frontend/src/app/bamboo-harvest/bamboo-harvest-detail/bamboo-harvest-detail.page.ts index 0d8e2e0856b..3259abfb439 100644 --- a/examples/cactus-example-supply-chain-frontend/src/app/bamboo-harvest/bamboo-harvest-detail/bamboo-harvest-detail.page.ts +++ b/examples/cactus-example-supply-chain-frontend/src/app/bamboo-harvest/bamboo-harvest-detail/bamboo-harvest-detail.page.ts @@ -1,5 +1,5 @@ import { v4 as uuidv4 } from "uuid"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; import { Component, Inject, Input, OnInit } from "@angular/core"; import { diff --git a/examples/cactus-example-tcs-huawei/tools/transferNumericAsset/transferNumericAsset.ts b/examples/cactus-example-tcs-huawei/tools/transferNumericAsset/transferNumericAsset.ts index 9af42138f2d..0f1b9edd0a7 100644 --- a/examples/cactus-example-tcs-huawei/tools/transferNumericAsset/transferNumericAsset.ts +++ b/examples/cactus-example-tcs-huawei/tools/transferNumericAsset/transferNumericAsset.ts @@ -5,7 +5,7 @@ * transferNumericAsset.ts */ -import { io } from "socket.io-client"; +import { io } from "socket.io-client-fixed-types"; { // Validator test program.(socket.io client) diff --git a/extensions/cactus-plugin-htlc-coordinator-besu/package.json b/extensions/cactus-plugin-htlc-coordinator-besu/package.json index 854a16cf84d..3779c3f5a2c 100644 --- a/extensions/cactus-plugin-htlc-coordinator-besu/package.json +++ b/extensions/cactus-plugin-htlc-coordinator-besu/package.json @@ -70,8 +70,8 @@ "joi": "14.3.1", "openapi-types": "7.0.1", "prom-client": "13.1.0", - "run-time-error": "1.4.0", - "socket.io-client": "4.5.4", + "run-time-error-cjs": "1.4.0", + "socket.io-client-fixed-types": "4.5.4", "typescript-optional": "2.0.1" }, "devDependencies": { diff --git a/extensions/cactus-plugin-htlc-coordinator-besu/src/main/typescript/plugin-htlc-coordinator-besu.ts b/extensions/cactus-plugin-htlc-coordinator-besu/src/main/typescript/plugin-htlc-coordinator-besu.ts index f1143e35637..18f77f14bcf 100644 --- a/extensions/cactus-plugin-htlc-coordinator-besu/src/main/typescript/plugin-htlc-coordinator-besu.ts +++ b/extensions/cactus-plugin-htlc-coordinator-besu/src/main/typescript/plugin-htlc-coordinator-besu.ts @@ -4,7 +4,7 @@ import { v4 as uuidv4 } from "uuid"; import { Express } from "express"; import { promisify } from "util"; import { Optional } from "typescript-optional"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; import fastSafeStringify from "fast-safe-stringify"; import OAS from "../json/openapi.json"; import { diff --git a/extensions/cactus-plugin-object-store-ipfs/package.json b/extensions/cactus-plugin-object-store-ipfs/package.json index f9fb0f34373..b1df3184429 100644 --- a/extensions/cactus-plugin-object-store-ipfs/package.json +++ b/extensions/cactus-plugin-object-store-ipfs/package.json @@ -55,12 +55,11 @@ "webpack:dev:web": "webpack --env=dev --target=web --config ../../webpack.config.js" }, "dependencies": { - "@hyperledger/cacti-esm-compat-hacks": "2.0.0-alpha.2", "@hyperledger/cactus-common": "2.0.0-alpha.2", "@hyperledger/cactus-core": "2.0.0-alpha.2", "@hyperledger/cactus-core-api": "2.0.0-alpha.2", "axios": "1.5.1", - "run-time-error": "1.4.0", + "run-time-error-cjs": "1.4.0", "typescript-optional": "2.0.1", "uuid": "8.3.2" }, @@ -71,6 +70,8 @@ "express": "4.18.2", "ipfs-core-types": "0.14.1", "ipfs-unixfs": "9.0.1", + "kubo-rpc-client": "3.0.1", + "kubo-rpc-client-esm-cjs": "3.0.1", "multiformats": "11.0.2" }, "engines": { diff --git a/extensions/cactus-plugin-object-store-ipfs/src/main/typescript/kubo-rpc-client-types.ts b/extensions/cactus-plugin-object-store-ipfs/src/main/typescript/kubo-rpc-client-types.ts index 5f3a547b75b..d01df0fc5c0 100644 --- a/extensions/cactus-plugin-object-store-ipfs/src/main/typescript/kubo-rpc-client-types.ts +++ b/extensions/cactus-plugin-object-store-ipfs/src/main/typescript/kubo-rpc-client-types.ts @@ -3,11 +3,15 @@ * To fix this we define required types here, based on their counterparts in kubo-rpc-client. */ +// @ts-ignore import type { Multiaddr } from "@multiformats/multiaddr"; +// @ts-ignore import type { MultihashHasher } from "multiformats/hashes/interface"; import type { Agent as HttpAgent } from "http"; import type { Agent as HttpsAgent } from "https"; +// @ts-ignore import type { CID } from "multiformats/cid"; +// @ts-ignore import type { Mtime } from "ipfs-unixfs"; ///////////////////////////////////// @@ -16,10 +20,12 @@ import type { Mtime } from "ipfs-unixfs"; // Some are simplified when details are not needed export type MultibaseCodec = - import("multiformats/bases/interface").MultibaseCodec; +// @ts-ignore +import("multiformats/bases/interface").MultibaseCodec; export type BlockCodec< - T1 = any, - T2 = any, +T1 = any, +T2 = any, +// @ts-ignore > = import("multiformats/codecs/interface").BlockCodec; export interface LoadBaseFn { diff --git a/extensions/cactus-plugin-object-store-ipfs/src/main/typescript/plugin-object-store-ipfs.ts b/extensions/cactus-plugin-object-store-ipfs/src/main/typescript/plugin-object-store-ipfs.ts index 7c4bb20ee23..3e96dd53512 100644 --- a/extensions/cactus-plugin-object-store-ipfs/src/main/typescript/plugin-object-store-ipfs.ts +++ b/extensions/cactus-plugin-object-store-ipfs/src/main/typescript/plugin-object-store-ipfs.ts @@ -1,6 +1,7 @@ import path from "path"; import type { Express } from "express"; -import { RuntimeError } from "run-time-error"; +// @ts-ignore +import { RuntimeError } from "run-time-error-cjs"; import { Logger, Checks, @@ -18,7 +19,6 @@ import type { SetObjectRequestV1, SetObjectResponseV1, } from "@hyperledger/cactus-core-api"; -import { dynamicImportKuboRpcClientESMWorkaround } from "@hyperledger/cacti-esm-compat-hacks"; import OAS from "../json/openapi.json"; @@ -60,8 +60,8 @@ export class PluginObjectStoreIpfs implements IPluginObjectStore { if (isLikeIpfsHttpClient(this.opts.ipfsClientOrOptions)) { this.ipfs = this.opts.ipfsClientOrOptions; } else if (this.opts.ipfsClientOrOptions) { - const kuboRpcModule = await dynamicImportKuboRpcClientESMWorkaround(); - this.ipfs = kuboRpcModule.create(this.opts.ipfsClientOrOptions); + const { create } = await import("kubo-rpc-client"); + this.ipfs = create(this.opts.ipfsClientOrOptions); } else { const errorMessage = `initIpfs Need either "ipfsClient" or "ipfsClientOptions" to construct ${this.className} Neither was provided.`; throw new RuntimeError(errorMessage); diff --git a/extensions/cactus-plugin-object-store-ipfs/src/test/typescript/integration/plugin-object-store-ipfs.test.ts b/extensions/cactus-plugin-object-store-ipfs/src/test/typescript/integration/plugin-object-store-ipfs.test.ts index 2e53341eb6e..67a65ddaac4 100644 --- a/extensions/cactus-plugin-object-store-ipfs/src/test/typescript/integration/plugin-object-store-ipfs.test.ts +++ b/extensions/cactus-plugin-object-store-ipfs/src/test/typescript/integration/plugin-object-store-ipfs.test.ts @@ -16,7 +16,6 @@ import { GoIpfsTestContainer, Containers, } from "@hyperledger/cactus-test-tooling"; -import { dynamicImportKuboRpcClientESMWorkaround } from "@hyperledger/cacti-esm-compat-hacks"; import { PluginObjectStoreIpfs } from "../../../main/typescript"; import { DefaultApi as ObjectStoreIpfsApi } from "../../../main/typescript/public-api"; @@ -61,8 +60,10 @@ test(testCase, async (t: Test) => { t.comment(`Go IPFS Test Container API URL: ${ipfsApiUrl}`); t.comment(`Go IPFS Test Container Gateway URL: ${ipfsGatewayUrl}`); - const kuboRpcModule = await dynamicImportKuboRpcClientESMWorkaround(); - const ipfsClientOrOptions = kuboRpcModule.create({ + + const { create } = await import("kubo-rpc-client"); + + const ipfsClientOrOptions = create({ url: ipfsApiUrl, }); const instanceId = uuidv4(); diff --git a/extensions/cactus-plugin-object-store-ipfs/src/test/typescript/unit/plugin-object-store-ipfs.test.ts b/extensions/cactus-plugin-object-store-ipfs/src/test/typescript/unit/plugin-object-store-ipfs.test.ts index e804c9fbad4..9203f376bbb 100644 --- a/extensions/cactus-plugin-object-store-ipfs/src/test/typescript/unit/plugin-object-store-ipfs.test.ts +++ b/extensions/cactus-plugin-object-store-ipfs/src/test/typescript/unit/plugin-object-store-ipfs.test.ts @@ -8,7 +8,6 @@ import bodyParser from "body-parser"; import { Servers } from "@hyperledger/cactus-common"; import type { IListenOptions, LogLevelDesc } from "@hyperledger/cactus-common"; import { Configuration } from "@hyperledger/cactus-core-api"; -import { dynamicImportKuboRpcClientESMWorkaround } from "@hyperledger/cacti-esm-compat-hacks"; import { PluginObjectStoreIpfs } from "../../../main/typescript"; import type { IPluginObjectStoreIpfsOptions } from "../../../main/typescript"; @@ -16,7 +15,7 @@ import { DefaultApi as ObjectStoreIpfsApi } from "../../../main/typescript/publi test("PluginObjectStoreIpfs", async (t1: Test) => { const logLevel: LogLevelDesc = "TRACE"; - const kuboRpcModule = await dynamicImportKuboRpcClientESMWorkaround(); + const kuboRpcModule = await import("kubo-rpc-client"); const ipfsClientOrOptions = kuboRpcModule.create(); t1.doesNotThrow( () => @@ -49,7 +48,7 @@ test("PluginObjectStoreIpfs", async (t1: Test) => { }); test.skip("get,set,has,delete alters state as expected", async (t: Test) => { - const kuboRpcModule = await dynamicImportKuboRpcClientESMWorkaround(); + const kuboRpcModule = await import("kubo-rpc-client"); const options: IPluginObjectStoreIpfsOptions = { ipfsClientOrOptions: kuboRpcModule.create(), // FIXME: use an actual mock IPFS client instanceId: uuidv4(), diff --git a/extensions/cactus-plugin-object-store-ipfs/tsconfig.json b/extensions/cactus-plugin-object-store-ipfs/tsconfig.json index 3e1666ab5cb..00f79d62a67 100644 --- a/extensions/cactus-plugin-object-store-ipfs/tsconfig.json +++ b/extensions/cactus-plugin-object-store-ipfs/tsconfig.json @@ -7,6 +7,7 @@ "tsBuildInfoFile": "../../.build-cache/cactus-plugin-object-store-ipfs.tsbuildinfo", "skipLibCheck": true, "composite": true, + "moduleResolution": "Node16" }, "include": [ "./src", @@ -22,9 +23,6 @@ { "path": "../../packages/cactus-core-api/tsconfig.json" }, - { - "path": "../../packages/cacti-esm-compat-hacks/tsconfig.json" - }, { "path": "../../packages/cactus-test-tooling/tsconfig.json" } diff --git a/jest.config.js b/jest.config.js index 3609db3ba14..16627785bf3 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,6 +1,7 @@ -/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */ +/** @type {import('ts-jest/dist/types').JestConfigWithTsJest} */ module.exports = { preset: "ts-jest", + logHeapUsage: true, testEnvironment: "node", maxWorkers: 1, maxConcurrency: 1, diff --git a/package.json b/package.json index c27cca1d6b4..d20daa43f36 100644 --- a/package.json +++ b/package.json @@ -68,9 +68,9 @@ "webpack": "lerna run webpack:dev", "webpack:dev:web": "lerna run webpack:dev:web", "webpack:dev:node": "lerna run webpack:dev:node", - "test:jest:all": "NODE_OPTIONS=--max_old_space_size=3072 jest", - "test:tap:all": "tap", - "test:all": "yarn test:jest:all && yarn test:tap:all", + "test:jest:all": "NODE_OPTIONS=\"--max_old_space_size=3072 --experimental-vm-modules\" jest", + "test:tap:all": "NODE_OPTIONS=\"--experimental-vm-modules\" tap", + "test:all": "NODE_OPTIONS=\"--experimental-vm-modules\" yarn test:jest:all && yarn test:tap:all", "prettier": "prettier --write --config .prettierrc.js \"./**/src/main/json/openapi.json\"", "lerna-publish-canary": "lerna publish --canary --force-publish --dist-tag $(git branch --show-current) --preid $(git branch --show-current) --loglevel=silly", "prepare": "husky install", @@ -146,7 +146,7 @@ "openapi-types": "12.1.3", "prettier": "3.0.3", "protoc-gen-ts": "0.8.6", - "run-time-error": "1.4.0", + "run-time-error-cjs": "1.4.0", "secp256k1": "4.0.3", "semver-parser": "4.1.4", "shebang-loader": "0.0.1", diff --git a/packages-python/cactus_validator_socketio_indy/testcli/package.json b/packages-python/cactus_validator_socketio_indy/testcli/package.json index a007de99959..cad1141ad51 100644 --- a/packages-python/cactus_validator_socketio_indy/testcli/package.json +++ b/packages-python/cactus_validator_socketio_indy/testcli/package.json @@ -5,6 +5,6 @@ "private": true, "dependencies": { "jsonwebtoken": "8.5.1", - "socket.io-client": "4.5.4" + "socket.io-client-fixed-types": "4.5.4" } } diff --git a/packages-python/cactus_validator_socketio_indy/testcli/testsock.js b/packages-python/cactus_validator_socketio_indy/testcli/testsock.js index 21f38bce9ac..1e922643247 100644 --- a/packages-python/cactus_validator_socketio_indy/testcli/testsock.js +++ b/packages-python/cactus_validator_socketio_indy/testcli/testsock.js @@ -1,7 +1,7 @@ const fs = require("fs"); const jwt = require("jsonwebtoken"); const { exit } = require("process"); -const io = require("socket.io-client"); +const io = require("socket.io-client-fixed-types"); const url = "http://localhost:10080"; const socket = io(url, { diff --git a/packages/cacti-esm-compat-hacks/README.md b/packages/cacti-esm-compat-hacks/README.md deleted file mode 100644 index a46890a5fdf..00000000000 --- a/packages/cacti-esm-compat-hacks/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# `@hyperledger/cacti-esm-compat-hacks` - -Small library with hacks and helper functions to interoperate with ECMAScript modules - -## Usage - -### Dynamic import of kubo-rpc-client - -```typescript -import { dynamicImportKuboRpcClientESMWorkaround } from "@hyperledger/cacti-esm-compat-hacks"; - -// Must be called inside an async method -const kuboRpcModule = await dynamicImportKuboRpcClientESMWorkaround(); -const ipfsClientOrOptions = kuboRpcModule.create({ - url: ipfsApiUrl, -}); -``` diff --git a/packages/cacti-esm-compat-hacks/package.json b/packages/cacti-esm-compat-hacks/package.json deleted file mode 100644 index 4621501db81..00000000000 --- a/packages/cacti-esm-compat-hacks/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@hyperledger/cacti-esm-compat-hacks", - "version": "2.0.0-alpha.2", - "description": "Small library with hacks and helper functions to interoperate with ECMAScript modules", - "keywords": [ - "Hyperledger", - "Cactus", - "Integration", - "Blockchain", - "Distributed Ledger Technology" - ], - "homepage": "https://github.com/hyperledger/cacti#readme", - "bugs": { - "url": "https://github.com/hyperledger/cacti/issues" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/hyperledger/cacti.git" - }, - "license": "Apache-2.0", - "author": { - "name": "Hyperledger Cactus Contributors", - "email": "cactus@lists.hyperledger.org", - "url": "https://www.hyperledger.org/use/cacti" - }, - "contributors": [ - { - "name": "Please add yourself to the list of contributors", - "email": "your.name@example.com", - "url": "https://example.com" - }, - { - "name": "Michal Bajer", - "email": "michal.bajer@fujitsu.com", - "url": "https://www.fujitsu.com/global/" - } - ], - "main": "dist/lib/main/typescript/index.js", - "module": "dist/lib/main/typescript/index.js", - "browser": "dist/cacti-esm-compat-hacks.web.umd.js", - "types": "dist/lib/main/typescript/index.d.ts", - "files": [ - "dist/*" - ], - "scripts": { - "webpack": "npm-run-all webpack:dev", - "webpack:dev": "npm-run-all webpack:dev:node webpack:dev:web", - "webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js", - "webpack:dev:web": "webpack --env=dev --target=web --config ../../webpack.config.js" - }, - "dependencies": { - "kubo-rpc-client": "3.0.1" - }, - "engines": { - "node": ">=16", - "npm": ">=8" - }, - "publishConfig": { - "access": "public" - }, - "browserMinified": "dist/cacti-esm-compat-hacks.web.umd.min.js", - "mainMinified": "dist/cacti-esm-compat-hacks.node.umd.min.js", - "watch": {} -} diff --git a/packages/cacti-esm-compat-hacks/src/main/typescript/dynamic-import.ts b/packages/cacti-esm-compat-hacks/src/main/typescript/dynamic-import.ts deleted file mode 100644 index fc76cb5e23e..00000000000 --- a/packages/cacti-esm-compat-hacks/src/main/typescript/dynamic-import.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Dynamically import `kubo-rpc-client` module (which is ESM-only and importing it from CJS ends up in error). - * - * @deprecated - * This is a workaround until we migrate to ESM or find another solution. - * Read more on rationale: https://github.com/hyperledger/cacti/pull/2829 - * - * @returns `kubo-rpc-client` module - */ -export async function dynamicImportKuboRpcClientESMWorkaround(): Promise< - typeof import("kubo-rpc-client") -> { - console.warn( - "WARNING - Do not use dynamicImportKuboRpcClientESMWorkaround() unless it's absolutely necessary!", - "It uses eval to fix an issue of transpiling dynamic imports to `require` statement, see https://github.com/microsoft/TypeScript/issues/43329.", - "Switch to regular import when possible (when ESM is supported).", - ); - - return eval('import("kubo-rpc-client")'); -} diff --git a/packages/cacti-esm-compat-hacks/src/main/typescript/index.ts b/packages/cacti-esm-compat-hacks/src/main/typescript/index.ts deleted file mode 100755 index 87cb558397c..00000000000 --- a/packages/cacti-esm-compat-hacks/src/main/typescript/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./public-api"; diff --git a/packages/cacti-esm-compat-hacks/src/main/typescript/index.web.ts b/packages/cacti-esm-compat-hacks/src/main/typescript/index.web.ts deleted file mode 100755 index 87cb558397c..00000000000 --- a/packages/cacti-esm-compat-hacks/src/main/typescript/index.web.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./public-api"; diff --git a/packages/cacti-esm-compat-hacks/src/main/typescript/public-api.ts b/packages/cacti-esm-compat-hacks/src/main/typescript/public-api.ts deleted file mode 100755 index 49487c66d22..00000000000 --- a/packages/cacti-esm-compat-hacks/src/main/typescript/public-api.ts +++ /dev/null @@ -1 +0,0 @@ -export { dynamicImportKuboRpcClientESMWorkaround } from "./dynamic-import"; diff --git a/packages/cacti-esm-compat-hacks/src/test/typescript/integration/api-surface.test.ts b/packages/cacti-esm-compat-hacks/src/test/typescript/integration/api-surface.test.ts deleted file mode 100644 index 34aba3a0aea..00000000000 --- a/packages/cacti-esm-compat-hacks/src/test/typescript/integration/api-surface.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import * as apiSurface from "../../../main/typescript/public-api"; -import "jest-extended"; - -test("Library can be loaded", async () => { - expect(apiSurface).toBeTruthy(); -}); diff --git a/packages/cacti-esm-compat-hacks/tsconfig.json b/packages/cacti-esm-compat-hacks/tsconfig.json deleted file mode 100644 index 15e612701b8..00000000000 --- a/packages/cacti-esm-compat-hacks/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "../../tsconfig.base.json", - "compilerOptions": { - "composite": true, - "outDir": "./dist/lib/", - "declarationDir": "dist/lib", - "rootDir": "./src", - "tsBuildInfoFile": "../../.build-cache/cacti-esm-compat-hacks.tsbuildinfo" - }, - "include": [ - "./src" - ], - "references": [] -} \ No newline at end of file diff --git a/packages/cactus-api-client/package.json b/packages/cactus-api-client/package.json index 94ccc450ca0..86f13028e13 100644 --- a/packages/cactus-api-client/package.json +++ b/packages/cactus-api-client/package.json @@ -56,12 +56,13 @@ "@hyperledger/cactus-plugin-consortium-manual": "2.0.0-alpha.2", "jsonwebtoken": "9.0.0", "rxjs": "7.8.1", - "socket.io-client": "4.5.4" + "socket.io-client-fixed-types": "4.5.4" }, "devDependencies": { "@hyperledger/cactus-test-tooling": "2.0.0-alpha.2", "@types/jsonwebtoken": "9.0.0", "@types/lodash": "4.14.195", + "@types/node": "20.8.10", "lodash": "4.17.21" }, "engines": { diff --git a/packages/cactus-api-client/src/main/typescript/socketio-api-client.ts b/packages/cactus-api-client/src/main/typescript/socketio-api-client.ts index 9a1ac3dfaeb..d9987717191 100644 --- a/packages/cactus-api-client/src/main/typescript/socketio-api-client.ts +++ b/packages/cactus-api-client/src/main/typescript/socketio-api-client.ts @@ -16,7 +16,7 @@ import { } from "@hyperledger/cactus-common"; import { ISocketApiClient } from "@hyperledger/cactus-core-api"; -import { Socket, SocketOptions, ManagerOptions, io } from "socket.io-client"; +import { Socket, SocketOptions, ManagerOptions, io } from "socket.io-client-fixed-types"; import { readFileSync } from "fs"; import { resolve as resolvePath } from "path"; import { diff --git a/packages/cactus-cmd-api-server/package.json b/packages/cactus-cmd-api-server/package.json index 44a4a00a9f8..7d4460f4732 100644 --- a/packages/cactus-cmd-api-server/package.json +++ b/packages/cactus-cmd-api-server/package.json @@ -84,12 +84,12 @@ "lmify": "0.3.0", "node-forge": "1.3.0", "prom-client": "13.2.0", - "run-time-error": "1.4.0", + "run-time-error-cjs": "1.4.0", "rxjs": "7.8.1", "safe-stable-stringify": "2.4.3", "semver": "7.5.2", "socket.io": "4.5.4", - "socket.io-client": "4.5.4", + "socket.io-client-fixed-types": "4.5.4", "typescript-optional": "2.0.1", "uuid": "8.3.2" }, diff --git a/packages/cactus-cmd-api-server/src/main/typescript/api-client/api-server-api-client.ts b/packages/cactus-cmd-api-server/src/main/typescript/api-client/api-server-api-client.ts index b0e9b51e29a..f361180ba9a 100644 --- a/packages/cactus-cmd-api-server/src/main/typescript/api-client/api-server-api-client.ts +++ b/packages/cactus-cmd-api-server/src/main/typescript/api-client/api-server-api-client.ts @@ -1,6 +1,6 @@ import { Observable, ReplaySubject } from "rxjs"; import { finalize } from "rxjs/operators"; -import { Socket, io, SocketOptions } from "socket.io-client"; +const { Socket, io, SocketOptions } = require("socket.io-client-fixed-types"); import { Logger, Checks, IAsyncProvider } from "@hyperledger/cactus-common"; import { LogLevelDesc, LoggerProvider } from "@hyperledger/cactus-common"; import { Constants } from "@hyperledger/cactus-core-api"; @@ -78,12 +78,12 @@ export class ApiServerApiClient extends DefaultApi { public async watchHealthcheckV1(): Promise> { const { log, tokenProvider } = this; - const socketOptions: SocketOptions = { + const socketOptions: typeof SocketOptions = { auth: { token: this.configuration?.baseOptions.headers.Authorization }, path: this.wsApiPath, - } as SocketOptions; // TODO + } as typeof SocketOptions; // TODO - const socket: Socket = io(this.wsApiHost, socketOptions); + const socket: typeof Socket = io(this.wsApiHost, socketOptions); const subject = new ReplaySubject(1); socket.on("error", (ex: Error) => { @@ -97,7 +97,7 @@ export class ApiServerApiClient extends DefaultApi { log.error("[SocketIOClient] DISCONNECT=%s Active=%b", reason, active); }); - socket.on("connect_error", async (err) => { + socket.on("connect_error", async (err: unknown) => { log.debug("[SocketIOClient] CONNECT_ERROR: %o", err); if (tokenProvider.isPresent()) { const theProvider = tokenProvider.get(); // unwrap the Optional diff --git a/packages/cactus-cmd-api-server/src/main/typescript/api-server.ts b/packages/cactus-cmd-api-server/src/main/typescript/api-server.ts index c455801aff3..1be43818ac7 100644 --- a/packages/cactus-cmd-api-server/src/main/typescript/api-server.ts +++ b/packages/cactus-cmd-api-server/src/main/typescript/api-server.ts @@ -9,7 +9,7 @@ import path from "path"; import tls from "tls"; import { Server, createServer } from "http"; import { createServer as createSecureServer } from "https"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; import { gte } from "semver"; import lmify from "lmify"; import fs from "fs-extra"; @@ -22,7 +22,6 @@ import compression from "compression"; import bodyParser from "body-parser"; import cors, { CorsOptionsDelegate, CorsRequest } from "cors"; -import rateLimit from "express-rate-limit"; import { Server as SocketIoServer } from "socket.io"; import { authorize as authorizeSocket } from "@thream/socketio-jwt"; @@ -521,6 +520,7 @@ export class ApiServer { }, }); + const { rateLimit } = await import("express-rate-limit"); const rateLimiterIndexHtml = rateLimit({ windowMs: 15 * 60 * 1000, // 15 minutes max: 100, // Limit each IP to 100 requests per `window` (here, per 15 minutes) diff --git a/packages/cactus-cmd-api-server/src/test/typescript/unit/get-open-api-spec-v1-endpoint.test.ts b/packages/cactus-cmd-api-server/src/test/typescript/unit/get-open-api-spec-v1-endpoint.test.ts index 7987ddfbed5..f2848b926b2 100644 --- a/packages/cactus-cmd-api-server/src/test/typescript/unit/get-open-api-spec-v1-endpoint.test.ts +++ b/packages/cactus-cmd-api-server/src/test/typescript/unit/get-open-api-spec-v1-endpoint.test.ts @@ -22,7 +22,7 @@ import { v4 as uuidv4 } from "uuid"; import { default_service, empty } from "../../../main/typescript/public-api"; import * as grpc from "@grpc/grpc-js"; import { GrpcServerApiServer } from "../../../main/typescript/web-services/grpc/grpc-server-api-server"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; describe("cmd-api-server:getOpenApiSpecV1Endpoint", () => { const logLevel: LogLevelDesc = "TRACE"; diff --git a/packages/cactus-cmd-api-server/src/test/typescript/unit/grpc-proto-gen-ts-client-healthcheck.test.ts b/packages/cactus-cmd-api-server/src/test/typescript/unit/grpc-proto-gen-ts-client-healthcheck.test.ts index 1246f76112a..3de32ec2b06 100644 --- a/packages/cactus-cmd-api-server/src/test/typescript/unit/grpc-proto-gen-ts-client-healthcheck.test.ts +++ b/packages/cactus-cmd-api-server/src/test/typescript/unit/grpc-proto-gen-ts-client-healthcheck.test.ts @@ -9,7 +9,7 @@ import { AuthorizationProtocol } from "../../../main/typescript/public-api"; import { default_service } from "../../../main/typescript/public-api"; import { health_check_response_pb } from "../../../main/typescript/public-api"; import { empty } from "../../../main/typescript/public-api"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; const testCase = "API server: runs gRPC TS-proto web services"; const logLevel: LogLevelDesc = "TRACE"; diff --git a/packages/cactus-cmd-api-server/src/test/typescript/unit/grpc-proto-gen-ts-client-m-tls-enabled.test.ts b/packages/cactus-cmd-api-server/src/test/typescript/unit/grpc-proto-gen-ts-client-m-tls-enabled.test.ts index 14b001737cd..456d5554bfe 100644 --- a/packages/cactus-cmd-api-server/src/test/typescript/unit/grpc-proto-gen-ts-client-m-tls-enabled.test.ts +++ b/packages/cactus-cmd-api-server/src/test/typescript/unit/grpc-proto-gen-ts-client-m-tls-enabled.test.ts @@ -10,7 +10,7 @@ import { AuthorizationProtocol } from "../../../main/typescript/public-api"; import { default_service } from "../../../main/typescript/public-api"; import { health_check_response_pb } from "../../../main/typescript/public-api"; import { empty } from "../../../main/typescript/public-api"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; const testCase = "API server: runs gRPC web services - mTLS"; const logLevel: LogLevelDesc = "TRACE"; diff --git a/packages/cactus-cmd-socketio-server/package.json b/packages/cactus-cmd-socketio-server/package.json index 6caaeb1afb1..dad7ed40252 100644 --- a/packages/cactus-cmd-socketio-server/package.json +++ b/packages/cactus-cmd-socketio-server/package.json @@ -61,7 +61,7 @@ "morgan": "1.10.0", "shelljs": "0.8.5", "socket.io": "4.5.4", - "socket.io-client": "4.5.4", + "socket.io-client-fixed-types": "4.5.4", "web3": "1.6.1", "xmlhttprequest": "1.8.0" }, diff --git a/packages/cactus-cmd-socketio-server/src/main/typescript/verifier/Verifier.ts b/packages/cactus-cmd-socketio-server/src/main/typescript/verifier/Verifier.ts index c0fd11a8478..7a23254a9a5 100644 --- a/packages/cactus-cmd-socketio-server/src/main/typescript/verifier/Verifier.ts +++ b/packages/cactus-cmd-socketio-server/src/main/typescript/verifier/Verifier.ts @@ -18,7 +18,7 @@ import { ConfigUtil } from "../routing-interface/util/ConfigUtil"; import { VerifierAuthentication } from "./VerifierAuthentication"; const XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest; -import { Socket, io } from "socket.io-client"; +import { Socket, io } from "socket.io-client-fixed-types"; const fs = require("fs"); const path = require("path"); diff --git a/packages/cactus-common/src/main/typescript/exception/create-runtime-error-with-cause.ts b/packages/cactus-common/src/main/typescript/exception/create-runtime-error-with-cause.ts index 1a5ec659ec4..bef8326dffb 100644 --- a/packages/cactus-common/src/main/typescript/exception/create-runtime-error-with-cause.ts +++ b/packages/cactus-common/src/main/typescript/exception/create-runtime-error-with-cause.ts @@ -1,4 +1,4 @@ -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; import { coerceUnknownToError } from "./coerce-unknown-to-error"; /** diff --git a/packages/cactus-common/src/test/typescript/unit/exception/create-runtime-error-with-cause.test.ts b/packages/cactus-common/src/test/typescript/unit/exception/create-runtime-error-with-cause.test.ts index d544b3cd8f5..69a3615eac1 100644 --- a/packages/cactus-common/src/test/typescript/unit/exception/create-runtime-error-with-cause.test.ts +++ b/packages/cactus-common/src/test/typescript/unit/exception/create-runtime-error-with-cause.test.ts @@ -3,7 +3,7 @@ import "jest-extended"; import { createRuntimeErrorWithCause } from "../../../../main/typescript/public-api"; import stringify from "fast-safe-stringify"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; describe("createRuntimeErrorWithCause() & newRex()", () => { it("avoids losing information of inner exception: RuntimeError instance", () => { diff --git a/packages/cactus-core/src/main/typescript/web-services/get-open-api-spec-v1-endpoint-base.ts b/packages/cactus-core/src/main/typescript/web-services/get-open-api-spec-v1-endpoint-base.ts index 40b645b0bd3..ae09b19c8e6 100644 --- a/packages/cactus-core/src/main/typescript/web-services/get-open-api-spec-v1-endpoint-base.ts +++ b/packages/cactus-core/src/main/typescript/web-services/get-open-api-spec-v1-endpoint-base.ts @@ -1,5 +1,5 @@ import type { Express, Request, Response } from "express"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; import { stringify } from "safe-stable-stringify"; import { diff --git a/packages/cactus-plugin-ledger-connector-besu/package.json b/packages/cactus-plugin-ledger-connector-besu/package.json index e027b4c0845..364d00cad9b 100644 --- a/packages/cactus-plugin-ledger-connector-besu/package.json +++ b/packages/cactus-plugin-ledger-connector-besu/package.json @@ -62,9 +62,9 @@ "joi": "17.9.1", "openapi-types": "9.1.0", "prom-client": "13.2.0", - "run-time-error": "1.4.0", + "run-time-error-cjs": "1.4.0", "rxjs": "7.8.1", - "socket.io-client": "4.5.4", + "socket.io-client-fixed-types": "4.5.4", "typescript-optional": "2.0.1", "web3": "1.6.1", "web3-core": "1.6.1", diff --git a/packages/cactus-plugin-ledger-connector-besu/src/main/typescript/api-client/besu-api-client.ts b/packages/cactus-plugin-ledger-connector-besu/src/main/typescript/api-client/besu-api-client.ts index 00f1da54e36..463085f6814 100644 --- a/packages/cactus-plugin-ledger-connector-besu/src/main/typescript/api-client/besu-api-client.ts +++ b/packages/cactus-plugin-ledger-connector-besu/src/main/typescript/api-client/besu-api-client.ts @@ -1,6 +1,6 @@ import { Observable, ReplaySubject } from "rxjs"; import { finalize } from "rxjs/operators"; -import { Socket, io } from "socket.io-client"; +import { Socket, io } from "socket.io-client-fixed-types"; import { Logger, Checks } from "@hyperledger/cactus-common"; import { LogLevelDesc, LoggerProvider } from "@hyperledger/cactus-common"; import { Constants, ISocketApiClient } from "@hyperledger/cactus-core-api"; diff --git a/packages/cactus-plugin-ledger-connector-besu/src/main/typescript/plugin-ledger-connector-besu.ts b/packages/cactus-plugin-ledger-connector-besu/src/main/typescript/plugin-ledger-connector-besu.ts index 8f4d902af4e..43c409380db 100644 --- a/packages/cactus-plugin-ledger-connector-besu/src/main/typescript/plugin-ledger-connector-besu.ts +++ b/packages/cactus-plugin-ledger-connector-besu/src/main/typescript/plugin-ledger-connector-besu.ts @@ -87,7 +87,7 @@ import { IGetPrometheusExporterMetricsEndpointV1Options, } from "./web-services/get-prometheus-exporter-metrics-endpoint-v1"; import { WatchBlocksV1Endpoint } from "./web-services/watch-blocks-v1-endpoint"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; import { GetBalanceEndpoint } from "./web-services/get-balance-endpoint"; import { GetTransactionEndpoint } from "./web-services/get-transaction-endpoint"; import { GetPastLogsEndpoint } from "./web-services/get-past-logs-endpoint"; diff --git a/packages/cactus-plugin-ledger-connector-ethereum/package.json b/packages/cactus-plugin-ledger-connector-ethereum/package.json index 8e1d8d45752..36acbbba01b 100644 --- a/packages/cactus-plugin-ledger-connector-ethereum/package.json +++ b/packages/cactus-plugin-ledger-connector-ethereum/package.json @@ -75,10 +75,10 @@ "http-proxy-middleware": "2.0.6", "minimist": "1.2.8", "prom-client": "13.2.0", - "run-time-error": "1.4.0", + "run-time-error-cjs": "1.4.0", "rxjs": "7.8.1", "sanitize-html": "2.7.0", - "socket.io-client": "4.5.4", + "socket.io-client-fixed-types": "4.5.4", "typescript-optional": "2.0.1", "web3": "4.1.2", "web3-eth": "4.2.0", diff --git a/packages/cactus-plugin-ledger-connector-ethereum/src/main/typescript/api-client/ethereum-api-client.ts b/packages/cactus-plugin-ledger-connector-ethereum/src/main/typescript/api-client/ethereum-api-client.ts index 6d58572d1f4..8254f954ba8 100644 --- a/packages/cactus-plugin-ledger-connector-ethereum/src/main/typescript/api-client/ethereum-api-client.ts +++ b/packages/cactus-plugin-ledger-connector-ethereum/src/main/typescript/api-client/ethereum-api-client.ts @@ -1,6 +1,6 @@ import { Observable, ReplaySubject } from "rxjs"; import { finalize } from "rxjs/operators"; -import { io } from "socket.io-client"; +import { io } from "socket.io-client-fixed-types"; import { Logger, Checks } from "@hyperledger/cactus-common"; import { LogLevelDesc, LoggerProvider } from "@hyperledger/cactus-common"; import { Constants, ISocketApiClient } from "@hyperledger/cactus-core-api"; diff --git a/packages/cactus-plugin-ledger-connector-ethereum/src/main/typescript/plugin-ledger-connector-ethereum.ts b/packages/cactus-plugin-ledger-connector-ethereum/src/main/typescript/plugin-ledger-connector-ethereum.ts index 06309dd445b..75ff90d91bf 100644 --- a/packages/cactus-plugin-ledger-connector-ethereum/src/main/typescript/plugin-ledger-connector-ethereum.ts +++ b/packages/cactus-plugin-ledger-connector-ethereum/src/main/typescript/plugin-ledger-connector-ethereum.ts @@ -77,7 +77,7 @@ import { isWeb3SigningCredentialNone, } from "./types/model-type-guards"; import { PrometheusExporter } from "./prometheus-exporter/prometheus-exporter"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; import { createProxyMiddleware, fixRequestBody } from "http-proxy-middleware"; import { diff --git a/packages/cactus-plugin-ledger-connector-fabric/package.json b/packages/cactus-plugin-ledger-connector-fabric/package.json index 2ec4de2a8c1..d0de524783a 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/package.json +++ b/packages/cactus-plugin-ledger-connector-fabric/package.json @@ -77,12 +77,12 @@ "node-vault": "0.9.22", "openapi-types": "9.1.0", "prom-client": "13.2.0", - "run-time-error": "1.4.0", + "run-time-error-cjs": "1.4.0", "rxjs": "7.8.1", "sanitize-filename": "1.6.3", "sanitize-html": "2.7.0", "secp256k1": "4.0.3", - "socket.io-client": "4.5.4", + "socket.io-client-fixed-types": "4.5.4", "temp": "0.9.4", "typescript-optional": "2.0.1", "uuid": "8.3.2", diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/api-client/fabric-api-client.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/api-client/fabric-api-client.ts index 1311dc57f9f..c3ae330dde9 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/api-client/fabric-api-client.ts +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/api-client/fabric-api-client.ts @@ -5,7 +5,7 @@ import { Observable, ReplaySubject } from "rxjs"; import { finalize } from "rxjs/operators"; -import { io } from "socket.io-client"; +import { io } from "socket.io-client-fixed-types"; import { Logger, Checks } from "@hyperledger/cactus-common"; import { LogLevelDesc, LoggerProvider } from "@hyperledger/cactus-common"; import { Constants, ISocketApiClient } from "@hyperledger/cactus-core-api"; diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/common/is-ssh-exec-ok.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/common/is-ssh-exec-ok.ts index 42a2a9f8153..c48517ab8fb 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/common/is-ssh-exec-ok.ts +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/common/is-ssh-exec-ok.ts @@ -1,5 +1,5 @@ import { SSHExecCommandResponse } from "node-ssh"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; export function isSshExecOk(res: SSHExecCommandResponse): boolean { const fnTag = "isSshExecOk()"; diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/plugin-ledger-connector-fabric.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/plugin-ledger-connector-fabric.ts index b5ed3f47c28..618ab22bfa0 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/plugin-ledger-connector-fabric.ts +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/plugin-ledger-connector-fabric.ts @@ -3,7 +3,7 @@ import path from "path"; import { v4 as uuidv4 } from "uuid"; import { Certificate } from "@fidm/x509"; import { Express } from "express"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; import "multer"; import temp from "temp"; import { diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/watch-blocks/watch-blocks-v1-endpoint.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/watch-blocks/watch-blocks-v1-endpoint.ts index 67867c2be71..f48f4e62ca7 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/watch-blocks/watch-blocks-v1-endpoint.ts +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/watch-blocks/watch-blocks-v1-endpoint.ts @@ -16,7 +16,7 @@ import { import { BlockEvent, BlockListener, EventType, Gateway } from "fabric-network"; import { Socket as SocketIoSocket } from "socket.io"; import { v4 as uuidv4 } from "uuid"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; import { assertFabricFunctionIsAvailable } from "../common/utils"; import { SignPayloadCallback } from "../plugin-ledger-connector-fabric"; diff --git a/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/package.json b/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/package.json index b717423d918..8b754ccfec7 100644 --- a/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/package.json +++ b/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/package.json @@ -72,7 +72,7 @@ "@types/node": "15.14.9", "@types/shelljs": "0.8.12", "shelljs": "0.8.5", - "socket.io-client": "4.5.4" + "socket.io-client-fixed-types": "4.5.4" }, "engines": { "node": ">=10", diff --git a/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/src/test/typescript/unit-test/package.json b/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/src/test/typescript/unit-test/package.json index 15d0d131cc3..7ab383a8185 100644 --- a/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/src/test/typescript/unit-test/package.json +++ b/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/src/test/typescript/unit-test/package.json @@ -14,7 +14,7 @@ "config": "1.31.0", "ethereumjs-common": "1.5.2", "ethereumjs-tx": "2.1.2", - "socket.io-client": "4.5.4", + "socket.io-client-fixed-types": "4.5.4", "ts-node": "9.1.1", "web3": "1.7.0" }, diff --git a/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/src/test/typescript/unit-test/validatorDriver_getNonceHex.ts b/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/src/test/typescript/unit-test/validatorDriver_getNonceHex.ts index 8b9ff0a6673..94c5db05be7 100644 --- a/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/src/test/typescript/unit-test/validatorDriver_getNonceHex.ts +++ b/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/src/test/typescript/unit-test/validatorDriver_getNonceHex.ts @@ -14,7 +14,7 @@ // //////// -import { io } from "socket.io-client"; +import { io } from "socket.io-client-fixed-types"; { // Validator test program.(socket.io client) diff --git a/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/src/test/typescript/unit-test/validatorDriver_getNumericBalance.ts b/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/src/test/typescript/unit-test/validatorDriver_getNumericBalance.ts index 7fb491742af..e54145e60fb 100644 --- a/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/src/test/typescript/unit-test/validatorDriver_getNumericBalance.ts +++ b/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/src/test/typescript/unit-test/validatorDriver_getNumericBalance.ts @@ -14,7 +14,7 @@ // //////// -import { io } from "socket.io-client"; +import { io } from "socket.io-client-fixed-types"; { // Validator test program.(socket.io client) diff --git a/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/src/test/typescript/unit-test/validatorDriver_sendRawTransaction.ts b/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/src/test/typescript/unit-test/validatorDriver_sendRawTransaction.ts index 00a9bd61e5c..a6eeb99b887 100644 --- a/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/src/test/typescript/unit-test/validatorDriver_sendRawTransaction.ts +++ b/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/src/test/typescript/unit-test/validatorDriver_sendRawTransaction.ts @@ -13,7 +13,7 @@ // //////// -import { io } from "socket.io-client"; +import { io } from "socket.io-client-fixed-types"; { // Validator test program.(socket.io client) diff --git a/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/src/test/typescript/unit-test/validatorDriver_transferNumericAsset.ts b/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/src/test/typescript/unit-test/validatorDriver_transferNumericAsset.ts index 711c76a9cb9..f6a87ef9b06 100644 --- a/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/src/test/typescript/unit-test/validatorDriver_transferNumericAsset.ts +++ b/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/src/test/typescript/unit-test/validatorDriver_transferNumericAsset.ts @@ -14,7 +14,7 @@ // //////// -import { io } from "socket.io-client"; +import { io } from "socket.io-client-fixed-types"; { // Validator test program.(socket.io client) diff --git a/packages/cactus-plugin-ledger-connector-iroha/package.json b/packages/cactus-plugin-ledger-connector-iroha/package.json index 6ff499858bd..1e79417a6f0 100644 --- a/packages/cactus-plugin-ledger-connector-iroha/package.json +++ b/packages/cactus-plugin-ledger-connector-iroha/package.json @@ -67,10 +67,10 @@ "key-encoder": "2.0.3", "openapi-types": "7.0.1", "prom-client": "13.1.0", - "run-time-error": "1.4.0", + "run-time-error-cjs": "1.4.0", "rxjs": "7.8.1", "sanitize-html": "2.7.0", - "socket.io-client": "4.5.4", + "socket.io-client-fixed-types": "4.5.4", "typescript-optional": "2.0.1" }, "devDependencies": { diff --git a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/api-client/iroha-api-client.ts b/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/api-client/iroha-api-client.ts index ed38cb60ad8..528fb2a6682 100644 --- a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/api-client/iroha-api-client.ts +++ b/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/api-client/iroha-api-client.ts @@ -1,6 +1,6 @@ import { Observable, ReplaySubject, share } from "rxjs"; import { finalize } from "rxjs/operators"; -import { Socket, io } from "socket.io-client"; +import { Socket, io } from "socket.io-client-fixed-types"; import { Logger, Checks } from "@hyperledger/cactus-common"; import { LogLevelDesc, LoggerProvider } from "@hyperledger/cactus-common"; import { Constants, ISocketApiClient } from "@hyperledger/cactus-core-api"; @@ -15,7 +15,7 @@ import { Configuration, ConfigurationParameters, } from "../generated/openapi/typescript-axios/configuration"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; export interface IrohaApiClientParameters extends ConfigurationParameters { logLevel?: LogLevelDesc; diff --git a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/iroha-transaction-wrapper.ts b/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/iroha-transaction-wrapper.ts index 05d5ec6c6ff..5737bf8b218 100644 --- a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/iroha-transaction-wrapper.ts +++ b/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/iroha-transaction-wrapper.ts @@ -12,7 +12,7 @@ import { RunTransactionResponse, } from "./generated/openapi/typescript-axios"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; import * as grpc from "@grpc/grpc-js"; import { diff --git a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/plugin-ledger-connector-iroha.ts b/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/plugin-ledger-connector-iroha.ts index 7327b750465..3a60f6d9db9 100644 --- a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/plugin-ledger-connector-iroha.ts +++ b/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/plugin-ledger-connector-iroha.ts @@ -29,7 +29,7 @@ import { LogLevelDesc, } from "@hyperledger/cactus-common"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; import { IrohaCommand, diff --git a/packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/integration/iroha-iroha-transfer-example.test.ts b/packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/integration/iroha-iroha-transfer-example.test.ts index 7d7efb190b3..9e8fba0be05 100644 --- a/packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/integration/iroha-iroha-transfer-example.test.ts +++ b/packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/integration/iroha-iroha-transfer-example.test.ts @@ -19,7 +19,7 @@ import { LogLevelDesc, Servers, } from "@hyperledger/cactus-common"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; import { PluginLedgerConnectorIroha, DefaultApi as IrohaApi, diff --git a/packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/integration/iroha-socketio-endpoint.test.ts b/packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/integration/iroha-socketio-endpoint.test.ts index e7c06ed9394..d738621eaa7 100644 --- a/packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/integration/iroha-socketio-endpoint.test.ts +++ b/packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/integration/iroha-socketio-endpoint.test.ts @@ -4,7 +4,7 @@ import { AddressInfo } from "net"; import KeyEncoder from "key-encoder"; import { v4 as internalIpV4 } from "internal-ip"; import { v4 as uuidv4 } from "uuid"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; import cryptoHelper from "iroha-helpers/lib/cryptoHelper"; import express from "express"; import bodyParser from "body-parser"; diff --git a/packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/integration/openapi/openapi-validation.test.ts b/packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/integration/openapi/openapi-validation.test.ts index 41ab3fa7b69..58584b4133c 100644 --- a/packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/integration/openapi/openapi-validation.test.ts +++ b/packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/integration/openapi/openapi-validation.test.ts @@ -21,7 +21,7 @@ import { LogLevelDesc, Servers, } from "@hyperledger/cactus-common"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; import { PluginLedgerConnectorIroha, DefaultApi as IrohaApi, diff --git a/packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/integration/run-transaction-endpoint-v1.test.ts b/packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/integration/run-transaction-endpoint-v1.test.ts index f66e781c213..5b1ef80009b 100644 --- a/packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/integration/run-transaction-endpoint-v1.test.ts +++ b/packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/integration/run-transaction-endpoint-v1.test.ts @@ -20,7 +20,7 @@ import { LogLevelDesc, Servers, } from "@hyperledger/cactus-common"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; import { PluginLedgerConnectorIroha, DefaultApi as IrohaApi, diff --git a/packages/cactus-plugin-ledger-connector-iroha2/package.json b/packages/cactus-plugin-ledger-connector-iroha2/package.json index bf5092c209b..ea73032dd82 100644 --- a/packages/cactus-plugin-ledger-connector-iroha2/package.json +++ b/packages/cactus-plugin-ledger-connector-iroha2/package.json @@ -59,7 +59,7 @@ "rxjs": "7.8.1", "sanitize-html": "2.7.0", "socket.io": "4.4.1", - "socket.io-client": "4.5.4", + "socket.io-client-fixed-types": "4.5.4", "undici": "5.26.2" }, "devDependencies": { diff --git a/packages/cactus-plugin-ledger-connector-iroha2/src/main/typescript/api-client/iroha2-api-client.ts b/packages/cactus-plugin-ledger-connector-iroha2/src/main/typescript/api-client/iroha2-api-client.ts index efa6f6255ce..4c37d6850b0 100644 --- a/packages/cactus-plugin-ledger-connector-iroha2/src/main/typescript/api-client/iroha2-api-client.ts +++ b/packages/cactus-plugin-ledger-connector-iroha2/src/main/typescript/api-client/iroha2-api-client.ts @@ -6,7 +6,7 @@ import { Observable, ReplaySubject } from "rxjs"; import { finalize } from "rxjs/operators"; // eslint-disable-next-line @typescript-eslint/no-var-requires -const io = require("socket.io-client"); +const io = require("socket.io-client-fixed-types"); import { Logger, Checks } from "@hyperledger/cactus-common"; import { LogLevelDesc, LoggerProvider } from "@hyperledger/cactus-common"; import { Constants, ISocketApiClient } from "@hyperledger/cactus-core-api"; diff --git a/packages/cactus-plugin-ledger-connector-quorum/package.json b/packages/cactus-plugin-ledger-connector-quorum/package.json index de724e27f9e..44aa6a41500 100644 --- a/packages/cactus-plugin-ledger-connector-quorum/package.json +++ b/packages/cactus-plugin-ledger-connector-quorum/package.json @@ -64,10 +64,10 @@ "express": "4.18.2", "minimist": "1.2.8", "prom-client": "13.2.0", - "run-time-error": "1.4.0", + "run-time-error-cjs": "1.4.0", "rxjs": "7.8.1", "sanitize-html": "2.7.0", - "socket.io-client": "4.5.4", + "socket.io-client-fixed-types": "4.5.4", "typescript-optional": "2.0.1", "web3": "1.6.1", "web3-core-helpers": "1.6.1", diff --git a/packages/cactus-plugin-ledger-connector-quorum/src/main/typescript/api-client/quorum-api-client.ts b/packages/cactus-plugin-ledger-connector-quorum/src/main/typescript/api-client/quorum-api-client.ts index 9f23bfbfce5..32350d171b8 100644 --- a/packages/cactus-plugin-ledger-connector-quorum/src/main/typescript/api-client/quorum-api-client.ts +++ b/packages/cactus-plugin-ledger-connector-quorum/src/main/typescript/api-client/quorum-api-client.ts @@ -1,6 +1,6 @@ import { Observable, ReplaySubject } from "rxjs"; import { finalize } from "rxjs/operators"; -import { io } from "socket.io-client"; +import { io } from "socket.io-client-fixed-types"; import { Logger, Checks } from "@hyperledger/cactus-common"; import { LogLevelDesc, LoggerProvider } from "@hyperledger/cactus-common"; import { Constants, ISocketApiClient } from "@hyperledger/cactus-core-api"; diff --git a/packages/cactus-plugin-ledger-connector-quorum/src/main/typescript/plugin-ledger-connector-quorum.ts b/packages/cactus-plugin-ledger-connector-quorum/src/main/typescript/plugin-ledger-connector-quorum.ts index 7390e5fe56f..aa2bad3b4c2 100644 --- a/packages/cactus-plugin-ledger-connector-quorum/src/main/typescript/plugin-ledger-connector-quorum.ts +++ b/packages/cactus-plugin-ledger-connector-quorum/src/main/typescript/plugin-ledger-connector-quorum.ts @@ -78,7 +78,7 @@ import { InvokeRawWeb3EthContractEndpoint } from "./web-services/invoke-raw-web3 import { isWeb3SigningCredentialNone } from "./model-type-guards"; import { PrometheusExporter } from "./prometheus-exporter/prometheus-exporter"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; export interface IPluginLedgerConnectorQuorumOptions extends ICactusPluginOptions { diff --git a/packages/cactus-plugin-ledger-connector-xdai/src/main/typescript/plugin-ledger-connector-xdai.ts b/packages/cactus-plugin-ledger-connector-xdai/src/main/typescript/plugin-ledger-connector-xdai.ts index 57e490afadf..672525fd94d 100644 --- a/packages/cactus-plugin-ledger-connector-xdai/src/main/typescript/plugin-ledger-connector-xdai.ts +++ b/packages/cactus-plugin-ledger-connector-xdai/src/main/typescript/plugin-ledger-connector-xdai.ts @@ -59,7 +59,7 @@ import { } from "./web-services/get-prometheus-exporter-metrics-endpoint-v1"; import { DeployContractSolidityBytecodeJsonObjectEndpoint } from "./web-services/deploy-contract-solidity-bytecode-json-object-endpoint"; import { InvokeContractJsonObjectEndpoint } from "./web-services/invoke-contract-json-object-endpoint"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; export const E_KEYCHAIN_NOT_FOUND = "cactus.connector.xdai.keychain_not_found"; diff --git a/packages/cactus-plugin-odap-hermes/package.json b/packages/cactus-plugin-odap-hermes/package.json index fe3ce203209..9ff180db143 100644 --- a/packages/cactus-plugin-odap-hermes/package.json +++ b/packages/cactus-plugin-odap-hermes/package.json @@ -68,12 +68,12 @@ "web3-utils": "1.6.1" }, "devDependencies": { - "@hyperledger/cacti-esm-compat-hacks": "2.0.0-alpha.2", "@types/crypto-js": "4.0.1", "@types/express": "4.17.19", "@types/tape": "4.13.4", "crypto-js": "4.0.0", "fabric-network": "2.2.19", + "kubo-rpc-client": "3.0.1", "typescript": "4.9.5" }, "engines": { diff --git a/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/backup-gateway-after-client-crash.test.ts b/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/backup-gateway-after-client-crash.test.ts index aff97daa844..6916fa60446 100644 --- a/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/backup-gateway-after-client-crash.test.ts +++ b/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/backup-gateway-after-client-crash.test.ts @@ -52,7 +52,6 @@ import { ReceiptType, Web3SigningCredential, } from "@hyperledger/cactus-plugin-ledger-connector-besu"; -import { dynamicImportKuboRpcClientESMWorkaround } from "@hyperledger/cacti-esm-compat-hacks"; import Web3 from "web3"; import { makeSessionDataChecks } from "../make-checks"; @@ -161,7 +160,7 @@ beforeAll(async () => { const ipfsApiUrl = await ipfsContainer.getApiUrl(); - const kuboRpcModule = await dynamicImportKuboRpcClientESMWorkaround(); + const kuboRpcModule = await import("kubo-rpc-client"); const ipfsClientOrOptions = kuboRpcModule.create({ url: ipfsApiUrl, }); diff --git a/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/client-crash-after-delete-asset.test.ts b/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/client-crash-after-delete-asset.test.ts index 453256994f9..e152204ce9f 100644 --- a/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/client-crash-after-delete-asset.test.ts +++ b/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/client-crash-after-delete-asset.test.ts @@ -51,7 +51,6 @@ import { ReceiptType, Web3SigningCredential, } from "@hyperledger/cactus-plugin-ledger-connector-besu"; -import { dynamicImportKuboRpcClientESMWorkaround } from "@hyperledger/cacti-esm-compat-hacks"; import Web3 from "web3"; import { makeSessionDataChecks } from "../make-checks"; @@ -158,7 +157,7 @@ beforeAll(async () => { const ipfsApiUrl = await ipfsContainer.getApiUrl(); - const kuboRpcModule = await dynamicImportKuboRpcClientESMWorkaround(); + const kuboRpcModule = await import("kubo-rpc-client"); const ipfsClientOrOptions = kuboRpcModule.create({ url: ipfsApiUrl, }); diff --git a/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/client-crash-after-lock-asset.test.ts b/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/client-crash-after-lock-asset.test.ts index e1942658e57..06d414a8b7e 100644 --- a/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/client-crash-after-lock-asset.test.ts +++ b/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/client-crash-after-lock-asset.test.ts @@ -51,7 +51,6 @@ import { ReceiptType, Web3SigningCredential, } from "@hyperledger/cactus-plugin-ledger-connector-besu"; -import { dynamicImportKuboRpcClientESMWorkaround } from "@hyperledger/cacti-esm-compat-hacks"; import Web3 from "web3"; import { makeSessionDataChecks } from "../make-checks"; @@ -158,7 +157,7 @@ beforeAll(async () => { const ipfsApiUrl = await ipfsContainer.getApiUrl(); - const kuboRpcModule = await dynamicImportKuboRpcClientESMWorkaround(); + const kuboRpcModule = await import("kubo-rpc-client"); const ipfsClientOrOptions = kuboRpcModule.create({ url: ipfsApiUrl, }); diff --git a/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/client-crash-after-transfer-initiation.test.ts b/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/client-crash-after-transfer-initiation.test.ts index 16116e5edde..dff7aff3122 100644 --- a/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/client-crash-after-transfer-initiation.test.ts +++ b/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/client-crash-after-transfer-initiation.test.ts @@ -18,7 +18,6 @@ import { PluginOdapGateway, } from "../../../main/typescript/gateway/plugin-odap-gateway"; import { GoIpfsTestContainer } from "@hyperledger/cactus-test-tooling"; -import { dynamicImportKuboRpcClientESMWorkaround } from "@hyperledger/cacti-esm-compat-hacks"; import { AssetProfile, ClientV1Request, @@ -93,7 +92,7 @@ beforeAll(async () => { const ipfsApiUrl = await ipfsContainer.getApiUrl(); - const kuboRpcModule = await dynamicImportKuboRpcClientESMWorkaround(); + const kuboRpcModule = await import("kubo-rpc-client"); const ipfsClientOrOptions = kuboRpcModule.create({ url: ipfsApiUrl, }); diff --git a/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/odap-api-call-with-ledger-connector.test.ts b/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/odap-api-call-with-ledger-connector.test.ts index 3c6e376a1a2..52928195bcd 100644 --- a/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/odap-api-call-with-ledger-connector.test.ts +++ b/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/odap-api-call-with-ledger-connector.test.ts @@ -52,7 +52,6 @@ import { PluginFactoryLedgerConnector, Web3SigningCredential, } from "@hyperledger/cactus-plugin-ledger-connector-besu"; -import { dynamicImportKuboRpcClientESMWorkaround } from "@hyperledger/cacti-esm-compat-hacks"; import { makeSessionDataChecks } from "../make-checks"; import { @@ -153,7 +152,7 @@ beforeAll(async () => { const ipfsApiUrl = await ipfsContainer.getApiUrl(); - const kuboRpcModule = await dynamicImportKuboRpcClientESMWorkaround(); + const kuboRpcModule = await import("kubo-rpc-client"); const ipfsClientOrOptions = kuboRpcModule.create({ url: ipfsApiUrl, }); diff --git a/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/odap-api-call.test.ts b/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/odap-api-call.test.ts index 1213de425cd..4510dfad615 100644 --- a/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/odap-api-call.test.ts +++ b/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/odap-api-call.test.ts @@ -17,7 +17,6 @@ import { import { Configuration } from "@hyperledger/cactus-core-api"; import { GoIpfsTestContainer } from "@hyperledger/cactus-test-tooling"; -import { dynamicImportKuboRpcClientESMWorkaround } from "@hyperledger/cacti-esm-compat-hacks"; import { PluginOdapGateway, @@ -80,7 +79,7 @@ beforeAll(async () => { const ipfsApiUrl = await ipfsContainer.getApiUrl(); - const kuboRpcModule = await dynamicImportKuboRpcClientESMWorkaround(); + const kuboRpcModule = await import("kubo-rpc-client"); const ipfsClientOrOptions = kuboRpcModule.create({ url: ipfsApiUrl, }); diff --git a/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/odap-rollback.test.ts b/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/odap-rollback.test.ts index 9610127c826..2e3cb92993a 100644 --- a/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/odap-rollback.test.ts +++ b/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/odap-rollback.test.ts @@ -23,6 +23,9 @@ import { pruneDockerAllIfGithubAction, GoIpfsTestContainer, BesuTestLedger, + DEFAULT_FABRIC_2_AIO_IMAGE_NAME, + DEFAULT_FABRIC_2_AIO_IMAGE_VERSION, + DEFAULT_FABRIC_2_AIO_FABRIC_VERSION, } from "@hyperledger/cactus-test-tooling"; import { PluginKeychainMemory } from "@hyperledger/cactus-plugin-keychain-memory"; import { ClientV1Request } from "../../../main/typescript/public-api"; @@ -51,7 +54,6 @@ import { ReceiptType, Web3SigningCredential, } from "@hyperledger/cactus-plugin-ledger-connector-besu"; -import { dynamicImportKuboRpcClientESMWorkaround } from "@hyperledger/cacti-esm-compat-hacks"; import Web3 from "web3"; import { @@ -155,7 +157,7 @@ beforeAll(async () => { const ipfsApiUrl = await ipfsContainer.getApiUrl(); - const kuboRpcModule = await dynamicImportKuboRpcClientESMWorkaround(); + const kuboRpcModule = await import("kubo-rpc-client"); const ipfsClientOrOptions = kuboRpcModule.create({ url: ipfsApiUrl, }); @@ -180,8 +182,11 @@ beforeAll(async () => { fabricLedger = new FabricTestLedgerV1({ emitContainerLogs: true, publishAllPorts: true, - imageName: "ghcr.io/hyperledger/cactus-fabric2-all-in-one", - envVars: new Map([["FABRIC_VERSION", "2.2.0"]]), + imageName: DEFAULT_FABRIC_2_AIO_IMAGE_NAME, + imageVersion: DEFAULT_FABRIC_2_AIO_IMAGE_VERSION, + envVars: new Map([ + ["FABRIC_VERSION", DEFAULT_FABRIC_2_AIO_FABRIC_VERSION], + ]), logLevel, }); diff --git a/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/odap.test.ts b/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/odap.test.ts index 1582d511b25..850494b8524 100644 --- a/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/odap.test.ts +++ b/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/odap.test.ts @@ -15,7 +15,7 @@ import { v4 as uuidV4 } from "uuid"; import { Configuration } from "@hyperledger/cactus-core-api"; import { PluginOdapGateway } from "../../../main/typescript/gateway/plugin-odap-gateway"; import { GoIpfsTestContainer } from "@hyperledger/cactus-test-tooling"; -import { dynamicImportKuboRpcClientESMWorkaround } from "@hyperledger/cacti-esm-compat-hacks"; + import { AssetProfile, ClientV1Request, @@ -66,7 +66,7 @@ beforeAll(async () => { const ipfsApiUrl = await ipfsContainer.getApiUrl(); - const kuboRpcModule = await dynamicImportKuboRpcClientESMWorkaround(); + const kuboRpcModule = await import("kubo-rpc-client"); const ipfsClientOrOptions = kuboRpcModule.create({ url: ipfsApiUrl, }); diff --git a/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/server-crash-after-create-asset.test.ts b/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/server-crash-after-create-asset.test.ts index a2ce8675269..8b2d7c5a5fb 100644 --- a/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/server-crash-after-create-asset.test.ts +++ b/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/server-crash-after-create-asset.test.ts @@ -51,7 +51,7 @@ import { ReceiptType, Web3SigningCredential, } from "@hyperledger/cactus-plugin-ledger-connector-besu"; -import { dynamicImportKuboRpcClientESMWorkaround } from "@hyperledger/cacti-esm-compat-hacks"; + import Web3 from "web3"; import { makeSessionDataChecks } from "../make-checks"; @@ -157,7 +157,7 @@ beforeAll(async () => { const ipfsApiUrl = await ipfsContainer.getApiUrl(); - const kuboRpcModule = await dynamicImportKuboRpcClientESMWorkaround(); + const kuboRpcModule = await import("kubo-rpc-client"); const ipfsClientOrOptions = kuboRpcModule.create({ url: ipfsApiUrl, }); diff --git a/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/server-crash-after-transfer-initiation.test.ts b/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/server-crash-after-transfer-initiation.test.ts index 998d847debb..3e588b34e95 100644 --- a/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/server-crash-after-transfer-initiation.test.ts +++ b/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/server-crash-after-transfer-initiation.test.ts @@ -14,7 +14,7 @@ import { } from "@hyperledger/cactus-common"; import { Configuration } from "@hyperledger/cactus-core-api"; import { GoIpfsTestContainer } from "@hyperledger/cactus-test-tooling"; -import { dynamicImportKuboRpcClientESMWorkaround } from "@hyperledger/cacti-esm-compat-hacks"; + import { AssetProfile, ClientV1Request, @@ -93,7 +93,7 @@ beforeAll(async () => { const ipfsApiUrl = await ipfsContainer.getApiUrl(); - const kuboRpcModule = await dynamicImportKuboRpcClientESMWorkaround(); + const kuboRpcModule = await import("kubo-rpc-client"); const ipfsClientOrOptions = kuboRpcModule.create({ url: ipfsApiUrl, }); diff --git a/packages/cactus-plugin-odap-hermes/src/test/typescript/unit/client/commit-final.test.ts b/packages/cactus-plugin-odap-hermes/src/test/typescript/unit/client/commit-final.test.ts index af5bf436d95..1c1ba8dc55d 100644 --- a/packages/cactus-plugin-odap-hermes/src/test/typescript/unit/client/commit-final.test.ts +++ b/packages/cactus-plugin-odap-hermes/src/test/typescript/unit/client/commit-final.test.ts @@ -20,7 +20,7 @@ import { import { Configuration } from "@hyperledger/cactus-core-api"; import { PluginObjectStoreIpfs } from "@hyperledger/cactus-plugin-object-store-ipfs"; import { GoIpfsTestContainer } from "@hyperledger/cactus-test-tooling"; -import { dynamicImportKuboRpcClientESMWorkaround } from "@hyperledger/cacti-esm-compat-hacks"; + import express from "express"; import { AddressInfo } from "net"; @@ -76,7 +76,7 @@ beforeAll(async () => { const ipfsApiUrl = await ipfsContainer.getApiUrl(); - const kuboRpcModule = await dynamicImportKuboRpcClientESMWorkaround(); + const kuboRpcModule = await import("kubo-rpc-client"); const ipfsClientOrOptions = kuboRpcModule.create({ url: ipfsApiUrl, }); diff --git a/packages/cactus-plugin-odap-hermes/src/test/typescript/unit/recovery/logging.test.ts b/packages/cactus-plugin-odap-hermes/src/test/typescript/unit/recovery/logging.test.ts index e0c668aaa5d..f57c88fccd1 100644 --- a/packages/cactus-plugin-odap-hermes/src/test/typescript/unit/recovery/logging.test.ts +++ b/packages/cactus-plugin-odap-hermes/src/test/typescript/unit/recovery/logging.test.ts @@ -16,7 +16,7 @@ import { v4 as uuidV4 } from "uuid"; import { Configuration } from "@hyperledger/cactus-core-api"; import { PluginOdapGateway } from "../../../../main/typescript/gateway/plugin-odap-gateway"; import { GoIpfsTestContainer } from "@hyperledger/cactus-test-tooling"; -import { dynamicImportKuboRpcClientESMWorkaround } from "@hyperledger/cacti-esm-compat-hacks"; + import { OdapLocalLog, @@ -87,7 +87,7 @@ beforeAll(async () => { const ipfsApiUrl = await ipfsContainer.getApiUrl(); - const kuboRpcModule = await dynamicImportKuboRpcClientESMWorkaround(); + const kuboRpcModule = await import("kubo-rpc-client"); const ipfsClientOrOptions = kuboRpcModule.create({ url: ipfsApiUrl, }); diff --git a/packages/cactus-plugin-odap-hermes/src/test/typescript/unit/recovery/recover-success.test.ts b/packages/cactus-plugin-odap-hermes/src/test/typescript/unit/recovery/recover-success.test.ts index 56d55204e61..4c1d884654c 100644 --- a/packages/cactus-plugin-odap-hermes/src/test/typescript/unit/recovery/recover-success.test.ts +++ b/packages/cactus-plugin-odap-hermes/src/test/typescript/unit/recovery/recover-success.test.ts @@ -15,7 +15,7 @@ import { v4 as uuidV4 } from "uuid"; import { Configuration } from "@hyperledger/cactus-core-api"; import { PluginOdapGateway } from "../../../../main/typescript/gateway/plugin-odap-gateway"; import { GoIpfsTestContainer } from "@hyperledger/cactus-test-tooling"; -import { dynamicImportKuboRpcClientESMWorkaround } from "@hyperledger/cacti-esm-compat-hacks"; + import { RecoverSuccessV1Message, SessionData, @@ -70,7 +70,7 @@ beforeAll(async () => { const ipfsApiUrl = await ipfsContainer.getApiUrl(); // t.comment(`Go IPFS Test Container API URL: ${ipfsApiUrl}`); - const kuboRpcModule = await dynamicImportKuboRpcClientESMWorkaround(); + const kuboRpcModule = await import("kubo-rpc-client"); const ipfsClientOrOptions = kuboRpcModule.create({ url: ipfsApiUrl, }); diff --git a/packages/cactus-plugin-odap-hermes/src/test/typescript/unit/recovery/recover-update-ack.test.ts b/packages/cactus-plugin-odap-hermes/src/test/typescript/unit/recovery/recover-update-ack.test.ts index 0cb34aeabcf..55b4ce61064 100644 --- a/packages/cactus-plugin-odap-hermes/src/test/typescript/unit/recovery/recover-update-ack.test.ts +++ b/packages/cactus-plugin-odap-hermes/src/test/typescript/unit/recovery/recover-update-ack.test.ts @@ -15,7 +15,7 @@ import { v4 as uuidV4 } from "uuid"; import { Configuration } from "@hyperledger/cactus-core-api"; import { PluginOdapGateway } from "../../../../main/typescript/gateway/plugin-odap-gateway"; import { GoIpfsTestContainer } from "@hyperledger/cactus-test-tooling"; -import { dynamicImportKuboRpcClientESMWorkaround } from "@hyperledger/cacti-esm-compat-hacks"; + import { RecoverUpdateAckV1Message, @@ -71,7 +71,7 @@ beforeAll(async () => { const ipfsApiUrl = await ipfsContainer.getApiUrl(); // t.comment(`Go IPFS Test Container API URL: ${ipfsApiUrl}`); - const kuboRpcModule = await dynamicImportKuboRpcClientESMWorkaround(); + const kuboRpcModule = await import("kubo-rpc-client"); const ipfsClientOrOptions = kuboRpcModule.create({ url: ipfsApiUrl, }); diff --git a/packages/cactus-plugin-odap-hermes/src/test/typescript/unit/recovery/recover-update.test.ts b/packages/cactus-plugin-odap-hermes/src/test/typescript/unit/recovery/recover-update.test.ts index 697b327501d..bddd607fbd7 100644 --- a/packages/cactus-plugin-odap-hermes/src/test/typescript/unit/recovery/recover-update.test.ts +++ b/packages/cactus-plugin-odap-hermes/src/test/typescript/unit/recovery/recover-update.test.ts @@ -16,7 +16,7 @@ import { v4 as uuidV4 } from "uuid"; import { Configuration } from "@hyperledger/cactus-core-api"; import { PluginOdapGateway } from "../../../../main/typescript/gateway/plugin-odap-gateway"; import { GoIpfsTestContainer } from "@hyperledger/cactus-test-tooling"; -import { dynamicImportKuboRpcClientESMWorkaround } from "@hyperledger/cacti-esm-compat-hacks"; + import { OdapLocalLog, RecoverUpdateV1Message, @@ -81,7 +81,7 @@ beforeAll(async () => { const ipfsApiUrl = await ipfsContainer.getApiUrl(); // t.comment(`Go IPFS Test Container API URL: ${ipfsApiUrl}`); - const kuboRpcModule = await dynamicImportKuboRpcClientESMWorkaround(); + const kuboRpcModule = await import("kubo-rpc-client"); const ipfsClientOrOptions = kuboRpcModule.create({ url: ipfsApiUrl, }); diff --git a/packages/cactus-plugin-odap-hermes/src/test/typescript/unit/recovery/recover.test.ts b/packages/cactus-plugin-odap-hermes/src/test/typescript/unit/recovery/recover.test.ts index 2e447fabe2b..e0414ba4e1c 100644 --- a/packages/cactus-plugin-odap-hermes/src/test/typescript/unit/recovery/recover.test.ts +++ b/packages/cactus-plugin-odap-hermes/src/test/typescript/unit/recovery/recover.test.ts @@ -19,7 +19,7 @@ import { PluginOdapGateway, } from "../../../../main/typescript/gateway/plugin-odap-gateway"; import { GoIpfsTestContainer } from "@hyperledger/cactus-test-tooling"; -import { dynamicImportKuboRpcClientESMWorkaround } from "@hyperledger/cacti-esm-compat-hacks"; + import { RecoverV1Message } from "../../../../main/typescript/public-api"; import { randomInt } from "crypto"; import { checkValidRecoverMessage } from "../../../../main/typescript/gateway/recovery/recover"; @@ -73,7 +73,7 @@ beforeAll(async () => { const ipfsApiUrl = await ipfsContainer.getApiUrl(); - const kuboRpcModule = await dynamicImportKuboRpcClientESMWorkaround(); + const kuboRpcModule = await import("kubo-rpc-client"); const ipfsClientOrOptions = kuboRpcModule.create({ url: ipfsApiUrl, }); diff --git a/packages/cactus-plugin-odap-hermes/src/test/typescript/unit/server/commit-final.test.ts b/packages/cactus-plugin-odap-hermes/src/test/typescript/unit/server/commit-final.test.ts index 6372cd08fa3..65e29de27d9 100644 --- a/packages/cactus-plugin-odap-hermes/src/test/typescript/unit/server/commit-final.test.ts +++ b/packages/cactus-plugin-odap-hermes/src/test/typescript/unit/server/commit-final.test.ts @@ -21,7 +21,7 @@ import { import { Configuration } from "@hyperledger/cactus-core-api"; import { PluginObjectStoreIpfs } from "@hyperledger/cactus-plugin-object-store-ipfs"; import { GoIpfsTestContainer } from "@hyperledger/cactus-test-tooling"; -import { dynamicImportKuboRpcClientESMWorkaround } from "@hyperledger/cacti-esm-compat-hacks"; + import express from "express"; import { AddressInfo } from "net"; @@ -77,7 +77,7 @@ beforeAll(async () => { const ipfsApiUrl = await ipfsContainer.getApiUrl(); - const kuboRpcModule = await dynamicImportKuboRpcClientESMWorkaround(); + const kuboRpcModule = await import("kubo-rpc-client"); const ipfsClientOrOptions = kuboRpcModule.create({ url: ipfsApiUrl, }); diff --git a/packages/cactus-plugin-odap-hermes/src/test/typescript/unit/server/lock-evidence.test.ts b/packages/cactus-plugin-odap-hermes/src/test/typescript/unit/server/lock-evidence.test.ts index 525f6ae6488..5ade55da597 100644 --- a/packages/cactus-plugin-odap-hermes/src/test/typescript/unit/server/lock-evidence.test.ts +++ b/packages/cactus-plugin-odap-hermes/src/test/typescript/unit/server/lock-evidence.test.ts @@ -22,7 +22,7 @@ import { import { Configuration } from "@hyperledger/cactus-core-api"; import { PluginObjectStoreIpfs } from "@hyperledger/cactus-plugin-object-store-ipfs"; import { GoIpfsTestContainer } from "@hyperledger/cactus-test-tooling"; -import { dynamicImportKuboRpcClientESMWorkaround } from "@hyperledger/cacti-esm-compat-hacks"; + import express from "express"; import { AddressInfo } from "net"; @@ -80,7 +80,7 @@ beforeAll(async () => { const ipfsApiUrl = await ipfsContainer.getApiUrl(); - const kuboRpcModule = await dynamicImportKuboRpcClientESMWorkaround(); + const kuboRpcModule = await import("kubo-rpc-client"); const ipfsClientOrOptions = kuboRpcModule.create({ url: ipfsApiUrl, }); diff --git a/packages/cactus-plugin-odap-hermes/tsconfig.json b/packages/cactus-plugin-odap-hermes/tsconfig.json index f112e91e8e2..d6575773431 100644 --- a/packages/cactus-plugin-odap-hermes/tsconfig.json +++ b/packages/cactus-plugin-odap-hermes/tsconfig.json @@ -8,7 +8,8 @@ "allowJs": false, "skipLibCheck": true, "rootDir": "./src/", - "tsBuildInfoFile": "../../.build-cache/cactus-plugin-odap-hermes.tsbuildinfo" + "tsBuildInfoFile": "../../.build-cache/cactus-plugin-odap-hermes.tsbuildinfo", + "moduleResolution": "Node16" }, "ts-node": { "files": true @@ -35,9 +36,6 @@ }, { "path": "../../extensions/cactus-plugin-object-store-ipfs/tsconfig.json" - }, - { - "path": "../../packages/cacti-esm-compat-hacks/tsconfig.json" } ] } \ No newline at end of file diff --git a/packages/cactus-plugin-persistence-ethereum/package.json b/packages/cactus-plugin-persistence-ethereum/package.json index 0b05a92a972..9b7b40f5ffc 100644 --- a/packages/cactus-plugin-persistence-ethereum/package.json +++ b/packages/cactus-plugin-persistence-ethereum/package.json @@ -64,7 +64,7 @@ "@hyperledger/cactus-plugin-ledger-connector-ethereum": "2.0.0-alpha.2", "async-mutex": "0.4.0", "pg": "8.8.0", - "run-time-error": "1.4.0", + "run-time-error-cjs": "1.4.0", "uuid": "8.3.2", "web3-utils": "4.0.6", "web3-validator": "2.0.2" diff --git a/packages/cactus-plugin-persistence-ethereum/src/main/typescript/db-client/db-client.ts b/packages/cactus-plugin-persistence-ethereum/src/main/typescript/db-client/db-client.ts index 7df10af5553..0d41f41f061 100644 --- a/packages/cactus-plugin-persistence-ethereum/src/main/typescript/db-client/db-client.ts +++ b/packages/cactus-plugin-persistence-ethereum/src/main/typescript/db-client/db-client.ts @@ -15,7 +15,7 @@ import { getRuntimeErrorCause } from "../utils"; import fs from "fs"; import path from "path"; import { Client as PostgresClient } from "pg"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; ////////////////////////////////// // Helper Types diff --git a/packages/cactus-plugin-persistence-ethereum/src/main/typescript/plugin-persistence-ethereum.ts b/packages/cactus-plugin-persistence-ethereum/src/main/typescript/plugin-persistence-ethereum.ts index 6176f11f206..1d4c5893b40 100644 --- a/packages/cactus-plugin-persistence-ethereum/src/main/typescript/plugin-persistence-ethereum.ts +++ b/packages/cactus-plugin-persistence-ethereum/src/main/typescript/plugin-persistence-ethereum.ts @@ -36,7 +36,7 @@ import { TokenTypeV1, TrackedOperationV1, } from "./generated/openapi/typescript-axios"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; import { Interface as EthersInterface } from "@ethersproject/abi"; import { Mutex } from "async-mutex"; import { v4 as uuidv4 } from "uuid"; diff --git a/packages/cactus-plugin-persistence-ethereum/src/main/typescript/token-client/base-token-client.ts b/packages/cactus-plugin-persistence-ethereum/src/main/typescript/token-client/base-token-client.ts index d8704baebe6..071667770ae 100644 --- a/packages/cactus-plugin-persistence-ethereum/src/main/typescript/token-client/base-token-client.ts +++ b/packages/cactus-plugin-persistence-ethereum/src/main/typescript/token-client/base-token-client.ts @@ -15,7 +15,7 @@ import { LoggerProvider, LogLevelDesc, } from "@hyperledger/cactus-common"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; import { getRuntimeErrorCause } from "../utils"; /** diff --git a/packages/cactus-plugin-persistence-ethereum/src/main/typescript/token-client/token-client-erc20.ts b/packages/cactus-plugin-persistence-ethereum/src/main/typescript/token-client/token-client-erc20.ts index e3da513c6c4..dfde9b4e853 100644 --- a/packages/cactus-plugin-persistence-ethereum/src/main/typescript/token-client/token-client-erc20.ts +++ b/packages/cactus-plugin-persistence-ethereum/src/main/typescript/token-client/token-client-erc20.ts @@ -6,7 +6,7 @@ import { EthereumApiClient } from "@hyperledger/cactus-plugin-ledger-connector-e import type { LogLevelDesc } from "@hyperledger/cactus-common"; import TokenClient from "./base-token-client"; import ERC20 from "../../json/contract-abi/ERC20.json"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; /** * Client for calling methods on ERC20 token contract. diff --git a/packages/cactus-plugin-persistence-ethereum/src/main/typescript/token-client/token-client-erc721.ts b/packages/cactus-plugin-persistence-ethereum/src/main/typescript/token-client/token-client-erc721.ts index e2303ebad54..29b28dd5821 100644 --- a/packages/cactus-plugin-persistence-ethereum/src/main/typescript/token-client/token-client-erc721.ts +++ b/packages/cactus-plugin-persistence-ethereum/src/main/typescript/token-client/token-client-erc721.ts @@ -6,7 +6,7 @@ import { EthereumApiClient } from "@hyperledger/cactus-plugin-ledger-connector-e import type { LogLevelDesc } from "@hyperledger/cactus-common"; import TokenClient from "./base-token-client"; import ERC721 from "../../json/contract-abi/ERC721.json"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; /** * Client for calling methods on ERC721 token contract. diff --git a/packages/cactus-plugin-persistence-ethereum/src/main/typescript/utils.ts b/packages/cactus-plugin-persistence-ethereum/src/main/typescript/utils.ts index 3e711c5be6f..fff04a552ce 100644 --- a/packages/cactus-plugin-persistence-ethereum/src/main/typescript/utils.ts +++ b/packages/cactus-plugin-persistence-ethereum/src/main/typescript/utils.ts @@ -4,7 +4,7 @@ import { toChecksumAddress } from "web3-utils"; import { isAddress } from "web3-validator"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; /** * Get error cause for RuntimeError (instance of `Error`, string or undefined) diff --git a/packages/cactus-plugin-persistence-fabric/src/main/typescript/db-client/db-client.ts b/packages/cactus-plugin-persistence-fabric/src/main/typescript/db-client/db-client.ts index 6d01366f0c4..ef096d7d0f7 100644 --- a/packages/cactus-plugin-persistence-fabric/src/main/typescript/db-client/db-client.ts +++ b/packages/cactus-plugin-persistence-fabric/src/main/typescript/db-client/db-client.ts @@ -21,7 +21,7 @@ import { InsertBlockTransactionEntryInterface, InsertDetailedTransactionEntryInterface, } from "../types"; -// import { RuntimeError } from "run-time-error"; +// import { RuntimeError } from "run-time-error-cjs"; export interface PostgresDatabaseClientOptions { connectionString: string; diff --git a/packages/cactus-test-geth-ledger/package.json b/packages/cactus-test-geth-ledger/package.json index b1d07a6d57e..af27802a4f3 100644 --- a/packages/cactus-test-geth-ledger/package.json +++ b/packages/cactus-test-geth-ledger/package.json @@ -54,7 +54,7 @@ "@hyperledger/cactus-test-tooling": "2.0.0-alpha.2", "dockerode": "3.3.0", "internal-ip": "6.2.0", - "run-time-error": "1.4.0", + "run-time-error-cjs": "1.4.0", "web3": "4.0.3", "web3-eth-accounts": "4.0.3" }, diff --git a/packages/cactus-test-geth-ledger/src/main/typescript/geth-test-ledger.ts b/packages/cactus-test-geth-ledger/src/main/typescript/geth-test-ledger.ts index 4736708bf7b..7e5d5f7f3b8 100644 --- a/packages/cactus-test-geth-ledger/src/main/typescript/geth-test-ledger.ts +++ b/packages/cactus-test-geth-ledger/src/main/typescript/geth-test-ledger.ts @@ -3,7 +3,7 @@ import Docker, { Container } from "dockerode"; import { v4 as internalIpV4 } from "internal-ip"; import Web3, { ContractAbi, TransactionReceipt } from "web3"; import type { Web3Account } from "web3-eth-accounts"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; import { Logger, diff --git a/packages/cactus-test-tooling/package.json b/packages/cactus-test-tooling/package.json index 3d8b13ce1e2..18d776e53d5 100644 --- a/packages/cactus-test-tooling/package.json +++ b/packages/cactus-test-tooling/package.json @@ -78,9 +78,9 @@ "node-forge": "1.3.0", "node-ssh": "13.1.0", "p-retry": "4.6.1", - "run-time-error": "1.4.0", + "run-time-error-cjs": "1.4.0", "socket.io": "4.5.4", - "socket.io-client": "4.5.4", + "socket.io-client-fixed-types": "4.5.4", "tar-stream": "2.2.0", "temp": "0.9.4", "typescript-optional": "2.0.1", diff --git a/packages/cactus-test-tooling/src/main/typescript/besu/besu-mp-test-ledger.ts b/packages/cactus-test-tooling/src/main/typescript/besu/besu-mp-test-ledger.ts index fc17aab2747..3d4a99d8f38 100644 --- a/packages/cactus-test-tooling/src/main/typescript/besu/besu-mp-test-ledger.ts +++ b/packages/cactus-test-tooling/src/main/typescript/besu/besu-mp-test-ledger.ts @@ -9,7 +9,7 @@ import { } from "@hyperledger/cactus-common"; import { LoggerProvider } from "@hyperledger/cactus-common"; import { Containers } from "../common/containers"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; import { EventEmitter } from "events"; export interface IBesuMpTestLedgerOptions { diff --git a/packages/cactus-test-tooling/src/main/typescript/common/containers.ts b/packages/cactus-test-tooling/src/main/typescript/common/containers.ts index 602b9804057..3aac196ee4f 100644 --- a/packages/cactus-test-tooling/src/main/typescript/common/containers.ts +++ b/packages/cactus-test-tooling/src/main/typescript/common/containers.ts @@ -8,7 +8,7 @@ import execa from "execa"; import tar from "tar-stream"; import fs from "fs-extra"; import pRetry from "p-retry"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; import { Streams } from "../common/streams"; import { Checks, diff --git a/packages/cactus-test-tooling/src/main/typescript/fabric/fabric-test-ledger-v1.ts b/packages/cactus-test-tooling/src/main/typescript/fabric/fabric-test-ledger-v1.ts index 7126e57cafc..2c674854730 100644 --- a/packages/cactus-test-tooling/src/main/typescript/fabric/fabric-test-ledger-v1.ts +++ b/packages/cactus-test-tooling/src/main/typescript/fabric/fabric-test-ledger-v1.ts @@ -34,7 +34,7 @@ import path from "path"; import fs from "fs"; import yaml from "js-yaml"; import { envMapToDocker } from "../common/env-map-to-docker"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; export interface organizationDefinitionFabricV2 { path: string; diff --git a/packages/cactus-test-tooling/src/main/typescript/go-ipfs/go-ipfs-test-container.ts b/packages/cactus-test-tooling/src/main/typescript/go-ipfs/go-ipfs-test-container.ts index 5c9ce83f6b7..0fd85bdffa6 100644 --- a/packages/cactus-test-tooling/src/main/typescript/go-ipfs/go-ipfs-test-container.ts +++ b/packages/cactus-test-tooling/src/main/typescript/go-ipfs/go-ipfs-test-container.ts @@ -1,6 +1,6 @@ import type { EventEmitter } from "events"; import { Optional } from "typescript-optional"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; import type { Container } from "dockerode"; import Docker from "dockerode"; import { Logger, Checks, Bools } from "@hyperledger/cactus-common"; diff --git a/packages/cactus-test-tooling/src/main/typescript/openethereum/openethereum-test-ledger.ts b/packages/cactus-test-tooling/src/main/typescript/openethereum/openethereum-test-ledger.ts index e4a5040d121..7a8fed5821b 100644 --- a/packages/cactus-test-tooling/src/main/typescript/openethereum/openethereum-test-ledger.ts +++ b/packages/cactus-test-tooling/src/main/typescript/openethereum/openethereum-test-ledger.ts @@ -15,7 +15,7 @@ import { } from "@hyperledger/cactus-common"; import { Containers } from "../common/containers"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; export interface IOpenEthereumTestLedgerOptions { envVars?: string[]; diff --git a/packages/cactus-test-tooling/src/main/typescript/rustc-container/rustc-container.ts b/packages/cactus-test-tooling/src/main/typescript/rustc-container/rustc-container.ts index 4b39312c121..06fd24d7aeb 100644 --- a/packages/cactus-test-tooling/src/main/typescript/rustc-container/rustc-container.ts +++ b/packages/cactus-test-tooling/src/main/typescript/rustc-container/rustc-container.ts @@ -1,7 +1,7 @@ import type { EventEmitter } from "events"; import fs from "fs-extra"; import { Optional } from "typescript-optional"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; import type { Container } from "dockerode"; import Docker from "dockerode"; import { Logger, Checks, Bools } from "@hyperledger/cactus-common"; diff --git a/packages/cactus-test-tooling/src/main/typescript/socketio-test-setup-helpers/socketio-test-setup-helpers.ts b/packages/cactus-test-tooling/src/main/typescript/socketio-test-setup-helpers/socketio-test-setup-helpers.ts index 31e1ccd1e14..c4515322f70 100644 --- a/packages/cactus-test-tooling/src/main/typescript/socketio-test-setup-helpers/socketio-test-setup-helpers.ts +++ b/packages/cactus-test-tooling/src/main/typescript/socketio-test-setup-helpers/socketio-test-setup-helpers.ts @@ -2,8 +2,8 @@ * Helper module for setting up client/server test sockets. */ -import { Server, Socket as ServerSocket } from "socket.io"; -import { io, Socket as ClientSocket } from "socket.io-client"; +import { Server, ServerOptions as SocketServerOptions, Socket as ServerSocket } from "socket.io"; +import { io, Socket as ClientSocket, ManagerOptions, SocketOptions } from "socket.io-client-fixed-types"; import { createServer } from "http"; export { Server, ServerSocket, ClientSocket }; @@ -18,10 +18,12 @@ export function createListeningMockServer(): Promise<[Server, string]> { const httpServer = createServer(); httpServer.unref(); - const testServer = new Server(httpServer, { + const socketServerOptions: Partial = { transports: ["websocket"], - cookie: false, - }); + cookie: false + }; + + const testServer = new Server(httpServer, socketServerOptions); httpServer.listen(0, () => { const addrInfo = httpServer.address(); @@ -42,11 +44,15 @@ export function createListeningMockServer(): Promise<[Server, string]> { * @port - Localhost port to connect to. */ export function createClientSocket(port: string): ClientSocket { - return io(`http://localhost:${port}`, { + + const clientSocketOpts: Partial = { reconnectionAttempts: 10, reconnectionDelay: 1000, + // @ts-ignore transports: ["websocket"], - }); + }; + + return io(`http://localhost:${port}`, clientSocketOpts as any); } /** diff --git a/packages/cactus-test-tooling/src/main/typescript/substrate-test-ledger/substrate-test-ledger.ts b/packages/cactus-test-tooling/src/main/typescript/substrate-test-ledger/substrate-test-ledger.ts index 967d2950511..784070a1c79 100644 --- a/packages/cactus-test-tooling/src/main/typescript/substrate-test-ledger/substrate-test-ledger.ts +++ b/packages/cactus-test-tooling/src/main/typescript/substrate-test-ledger/substrate-test-ledger.ts @@ -1,6 +1,6 @@ import type { EventEmitter } from "events"; import { Optional } from "typescript-optional"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; import type { Container, ContainerCreateOptions, diff --git a/tools/bump-openapi-spec-dep-versions.ts b/tools/bump-openapi-spec-dep-versions.ts index 6baf9b10553..cbdbde02260 100644 --- a/tools/bump-openapi-spec-dep-versions.ts +++ b/tools/bump-openapi-spec-dep-versions.ts @@ -5,7 +5,7 @@ import yargs from "yargs"; import { hideBin } from "yargs/helpers"; import fs from "fs-extra"; import { globby, Options as GlobbyOptions } from "globby"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; import prettier from "prettier"; import { OpenAPIV3_1 } from "openapi-types"; import { isValidSemVer } from "semver-parser"; diff --git a/tools/create-production-only-archive.ts b/tools/create-production-only-archive.ts index 30cda137734..55280ea5c18 100644 --- a/tools/create-production-only-archive.ts +++ b/tools/create-production-only-archive.ts @@ -5,7 +5,7 @@ import { fileURLToPath } from "url"; import { deleteAsync } from "del"; import fs from "fs-extra"; import { globby, Options as GlobbyOptions } from "globby"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; import yargs from "yargs"; import { hideBin } from "yargs/helpers"; import { simpleGit, SimpleGit, SimpleGitOptions } from "simple-git"; diff --git a/tools/custom-checks/check-open-api-json-specs.ts b/tools/custom-checks/check-open-api-json-specs.ts index b8d56c35e06..d9a9828603b 100644 --- a/tools/custom-checks/check-open-api-json-specs.ts +++ b/tools/custom-checks/check-open-api-json-specs.ts @@ -2,7 +2,7 @@ import fs from "fs-extra"; import path from "path"; import { fileURLToPath } from "url"; import { globby, Options as GlobbyOptions } from "globby"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; import { hasProperty } from "./has-property"; import { isStdLibRecord } from "./is-std-lib-record"; diff --git a/tools/custom-checks/check-package-json-sort.ts b/tools/custom-checks/check-package-json-sort.ts index a0a2ef558ba..a4be18f7bcc 100644 --- a/tools/custom-checks/check-package-json-sort.ts +++ b/tools/custom-checks/check-package-json-sort.ts @@ -2,7 +2,7 @@ import fs from "fs-extra"; import path from "path"; import { fileURLToPath } from "url"; import { globby, Options as GlobbyOptions } from "globby"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; import { isStdLibRecord } from "./is-std-lib-record"; import { sortPackageJson } from "sort-package-json"; import lernaCfg from "../../lerna.json" assert { type: "json" }; diff --git a/tools/custom-checks/check-pkg-licenses.ts b/tools/custom-checks/check-pkg-licenses.ts index 8a1d9b779a3..e46441829f9 100644 --- a/tools/custom-checks/check-pkg-licenses.ts +++ b/tools/custom-checks/check-pkg-licenses.ts @@ -2,7 +2,7 @@ import fs from "fs-extra"; import path from "path"; import { fileURLToPath } from "url"; import { globby, Options as GlobbyOptions } from "globby"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; import { isStdLibRecord } from "./is-std-lib-record"; export interface ICheckPkgLicensesRequest { diff --git a/tools/custom-checks/check-pkg-npm-scope.ts b/tools/custom-checks/check-pkg-npm-scope.ts index 5406a16747d..34c347f171f 100644 --- a/tools/custom-checks/check-pkg-npm-scope.ts +++ b/tools/custom-checks/check-pkg-npm-scope.ts @@ -2,7 +2,7 @@ import fs from "fs-extra"; import path from "path"; import { fileURLToPath } from "url"; import { globby, Options as GlobbyOptions } from "globby"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; import { sortPackageJson } from "sort-package-json"; import { hasKey } from "../has-key"; // eslint-disable-next-line prettier/prettier diff --git a/tools/custom-checks/check-sibling-dep-version-consistency.ts b/tools/custom-checks/check-sibling-dep-version-consistency.ts index e6bb4d5e46b..aebfe3959b3 100644 --- a/tools/custom-checks/check-sibling-dep-version-consistency.ts +++ b/tools/custom-checks/check-sibling-dep-version-consistency.ts @@ -2,7 +2,7 @@ import fs from "fs-extra"; import path from "path"; import { fileURLToPath } from "url"; import { globby, Options as GlobbyOptions } from "globby"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; import { isStdLibRecord } from "./is-std-lib-record"; import { readFile } from "fs/promises"; diff --git a/tools/generate-sbom.ts b/tools/generate-sbom.ts index e84329196a9..7ee2710dbf4 100644 --- a/tools/generate-sbom.ts +++ b/tools/generate-sbom.ts @@ -5,7 +5,7 @@ import { promisify } from "util"; import { exec, ExecOptions } from "child_process"; import fs from "fs-extra"; import { globby, Options as GlobbyOptions } from "globby"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; import fastSafeStringify from "fast-safe-stringify"; import { INpmListDependencyV1, npmList } from "./npm-list"; diff --git a/tools/get-latest-sem-ver-git-tag.ts b/tools/get-latest-sem-ver-git-tag.ts index 9d3676c841f..7fc367a2803 100644 --- a/tools/get-latest-sem-ver-git-tag.ts +++ b/tools/get-latest-sem-ver-git-tag.ts @@ -2,7 +2,7 @@ import path from "path"; import { fileURLToPath } from "url" import { simpleGit, SimpleGit, SimpleGitOptions } from "simple-git"; import { compareSemVer, isValidSemVer } from "semver-parser"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; const TAG = "[tools/get-latest-sem-ver-git-tag.ts]"; diff --git a/tools/npm-list.ts b/tools/npm-list.ts index 9bcb0758e72..9798fdae233 100644 --- a/tools/npm-list.ts +++ b/tools/npm-list.ts @@ -2,7 +2,7 @@ import { ExecOptions, exec } from "child_process"; import { promisify } from "util"; import fastSafeStringify from "fast-safe-stringify"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; import { hasKey } from "./has-key"; const execAsync = promisify(exec); diff --git a/tools/sync-npm-deps-to-tsc-projects.ts b/tools/sync-npm-deps-to-tsc-projects.ts index bb4327796b5..9cdcec2858f 100644 --- a/tools/sync-npm-deps-to-tsc-projects.ts +++ b/tools/sync-npm-deps-to-tsc-projects.ts @@ -4,7 +4,7 @@ import path from "path"; import JSON5 from "json5"; import fs from "fs-extra"; import { globby, Options as GlobbyOptions } from "globby"; -import { RuntimeError } from "run-time-error"; +import { RuntimeError } from "run-time-error-cjs"; import { readFile } from "fs/promises"; const __filename = fileURLToPath(import.meta.url); diff --git a/tsconfig.json b/tsconfig.json index aabc61005d6..289fea75f26 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,9 +13,6 @@ { "path": "./packages/cacti-ledger-browser/tsconfig.json" }, - { - "path": "./packages/cacti-esm-compat-hacks/tsconfig.json" - }, { "path": "./packages/cactus-common/tsconfig.json" }, @@ -173,7 +170,7 @@ "compilerOptions": { "incremental": true, "target": "ES2017", - "module": "CommonJS", + "module": "Node16", "lib": [ "es2015", "es2016", @@ -213,7 +210,7 @@ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ /* Module Resolution Options */ - "moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */, + "moduleResolution": "Node16" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */, "resolveJsonModule": true /* When true allows the importing of json files in Typescript code */, // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ diff --git a/yarn.lock b/yarn.lock index 7406e5862d4..7505119cce3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6551,14 +6551,6 @@ __metadata: languageName: node linkType: hard -"@hyperledger/cacti-esm-compat-hacks@2.0.0-alpha.2, @hyperledger/cacti-esm-compat-hacks@workspace:packages/cacti-esm-compat-hacks": - version: 0.0.0-use.local - resolution: "@hyperledger/cacti-esm-compat-hacks@workspace:packages/cacti-esm-compat-hacks" - dependencies: - kubo-rpc-client: 3.0.1 - languageName: unknown - linkType: soft - "@hyperledger/cacti-example-cbdc-bridging-frontend@workspace:examples/cactus-example-cbdc-bridging-frontend": version: 0.0.0-use.local resolution: "@hyperledger/cacti-example-cbdc-bridging-frontend@workspace:examples/cactus-example-cbdc-bridging-frontend" @@ -6849,10 +6841,11 @@ __metadata: "@hyperledger/cactus-test-tooling": 2.0.0-alpha.2 "@types/jsonwebtoken": 9.0.0 "@types/lodash": 4.14.195 + "@types/node": 20.8.10 jsonwebtoken: 9.0.0 lodash: 4.17.21 rxjs: 7.8.1 - socket.io-client: 4.5.4 + socket.io-client-fixed-types: 4.5.4 languageName: unknown linkType: soft @@ -6910,12 +6903,12 @@ __metadata: node-forge: 1.3.0 prom-client: 13.2.0 protobufjs: 7.2.5 - run-time-error: 1.4.0 + run-time-error-cjs: 1.4.0 rxjs: 7.8.1 safe-stable-stringify: 2.4.3 semver: 7.5.2 socket.io: 4.5.4 - socket.io-client: 4.5.4 + socket.io-client-fixed-types: 4.5.4 typescript-optional: 2.0.1 uuid: 8.3.2 languageName: unknown @@ -6958,7 +6951,7 @@ __metadata: morgan: 1.10.0 shelljs: 0.8.5 socket.io: 4.5.4 - socket.io-client: 4.5.4 + socket.io-client-fixed-types: 4.5.4 ts-node: 8.9.1 web3: 1.6.1 xmlhttprequest: 1.8.0 @@ -7171,9 +7164,9 @@ __metadata: fs-extra: 10.1.0 hardhat: 2.17.2 http-status-codes: 2.1.4 - ipfs-http-client: 60.0.1 jose: 4.9.2 knex: 2.5.1 + kubo-rpc-client: 3.0.1 nyc: ^13.1.0 openapi-types: 9.1.0 remix-tests: ^0.1.34 @@ -7462,9 +7455,9 @@ __metadata: joi: 14.3.1 openapi-types: 7.0.1 prom-client: 13.1.0 - run-time-error: 1.4.0 + run-time-error-cjs: 1.4.0 socket.io: 4.5.4 - socket.io-client: 4.5.4 + socket.io-client-fixed-types: 4.5.4 typescript-optional: 2.0.1 web3-eth-abi: 4.0.3 web3-utils: 4.0.3 @@ -7648,10 +7641,10 @@ __metadata: key-encoder: 2.0.3 openapi-types: 9.1.0 prom-client: 13.2.0 - run-time-error: 1.4.0 + run-time-error-cjs: 1.4.0 rxjs: 7.8.1 socket.io: 4.5.4 - socket.io-client: 4.5.4 + socket.io-client-fixed-types: 4.5.4 typescript-optional: 2.0.1 web3: 1.6.1 web3-core: 1.6.1 @@ -7738,11 +7731,11 @@ __metadata: js-yaml: 4.1.0 minimist: 1.2.8 prom-client: 13.2.0 - run-time-error: 1.4.0 + run-time-error-cjs: 1.4.0 rxjs: 7.8.1 sanitize-html: 2.7.0 socket.io: 4.5.4 - socket.io-client: 4.5.4 + socket.io-client-fixed-types: 4.5.4 typescript-optional: 2.0.1 web3: 4.1.2 web3-eth: 4.2.0 @@ -7792,13 +7785,13 @@ __metadata: node-vault: 0.9.22 openapi-types: 9.1.0 prom-client: 13.2.0 - run-time-error: 1.4.0 + run-time-error-cjs: 1.4.0 rxjs: 7.8.1 sanitize-filename: 1.6.3 sanitize-html: 2.7.0 secp256k1: 4.0.3 socket.io: 4.5.4 - socket.io-client: 4.5.4 + socket.io-client-fixed-types: 4.5.4 temp: 0.9.4 typescript-optional: 2.0.1 uuid: 8.3.2 @@ -7833,7 +7826,7 @@ __metadata: serve-favicon: 2.4.5 shelljs: 0.8.5 socket.io: 4.5.4 - socket.io-client: 4.5.4 + socket.io-client-fixed-types: 4.5.4 web3: 1.8.1 languageName: unknown linkType: soft @@ -7862,7 +7855,7 @@ __metadata: rxjs: 7.8.1 sanitize-html: 2.7.0 socket.io: 4.5.4 - socket.io-client: 4.5.4 + socket.io-client-fixed-types: 4.5.4 undici: 5.26.2 uuid: 8.3.2 languageName: unknown @@ -7889,11 +7882,11 @@ __metadata: key-encoder: 2.0.3 openapi-types: 7.0.1 prom-client: 13.1.0 - run-time-error: 1.4.0 + run-time-error-cjs: 1.4.0 rxjs: 7.8.1 sanitize-html: 2.7.0 socket.io: 4.5.4 - socket.io-client: 4.5.4 + socket.io-client-fixed-types: 4.5.4 typescript-optional: 2.0.1 languageName: unknown linkType: soft @@ -7915,11 +7908,11 @@ __metadata: express: 4.18.2 minimist: 1.2.8 prom-client: 13.2.0 - run-time-error: 1.4.0 + run-time-error-cjs: 1.4.0 rxjs: 7.8.1 sanitize-html: 2.7.0 socket.io: 4.5.4 - socket.io-client: 4.5.4 + socket.io-client-fixed-types: 4.5.4 typescript-optional: 2.0.1 web3: 1.6.1 web3-core-helpers: 1.6.1 @@ -8030,7 +8023,6 @@ __metadata: version: 0.0.0-use.local resolution: "@hyperledger/cactus-plugin-object-store-ipfs@workspace:extensions/cactus-plugin-object-store-ipfs" dependencies: - "@hyperledger/cacti-esm-compat-hacks": 2.0.0-alpha.2 "@hyperledger/cactus-common": 2.0.0-alpha.2 "@hyperledger/cactus-core": 2.0.0-alpha.2 "@hyperledger/cactus-core-api": 2.0.0-alpha.2 @@ -8041,8 +8033,10 @@ __metadata: express: 4.18.2 ipfs-core-types: 0.14.1 ipfs-unixfs: 9.0.1 + kubo-rpc-client: 3.0.1 + kubo-rpc-client-esm-cjs: 3.0.1 multiformats: 11.0.2 - run-time-error: 1.4.0 + run-time-error-cjs: 1.4.0 typescript-optional: 2.0.1 uuid: 8.3.2 languageName: unknown @@ -8052,7 +8046,6 @@ __metadata: version: 0.0.0-use.local resolution: "@hyperledger/cactus-plugin-odap-hermes@workspace:packages/cactus-plugin-odap-hermes" dependencies: - "@hyperledger/cacti-esm-compat-hacks": 2.0.0-alpha.2 "@hyperledger/cactus-cmd-api-server": 2.0.0-alpha.2 "@hyperledger/cactus-common": 2.0.0-alpha.2 "@hyperledger/cactus-core": 2.0.0-alpha.2 @@ -8069,6 +8062,7 @@ __metadata: crypto-js: 4.0.0 fabric-network: 2.2.19 knex: 2.4.0 + kubo-rpc-client: 3.0.1 secp256k1: 4.0.3 socket.io: 4.5.4 sqlite3: 5.1.5 @@ -8100,7 +8094,7 @@ __metadata: jest-extended: 4.0.1 npm-run-all: 4.1.5 pg: 8.8.0 - run-time-error: 1.4.0 + run-time-error-cjs: 1.4.0 rxjs: 7.8.1 socket.io: 4.5.4 uuid: 8.3.2 @@ -8178,7 +8172,7 @@ __metadata: "@types/dockerode": 3.2.7 dockerode: 3.3.0 internal-ip: 6.2.0 - run-time-error: 1.4.0 + run-time-error-cjs: 1.4.0 web3: 4.0.3 web3-eth-accounts: 4.0.3 languageName: unknown @@ -8330,9 +8324,9 @@ __metadata: node-forge: 1.3.0 node-ssh: 13.1.0 p-retry: 4.6.1 - run-time-error: 1.4.0 + run-time-error-cjs: 1.4.0 socket.io: 4.5.4 - socket.io-client: 4.5.4 + socket.io-client-fixed-types: 4.5.4 tar-stream: 2.2.0 temp: 0.9.4 typescript-optional: 2.0.1 @@ -8450,7 +8444,7 @@ __metadata: openapi-types: 12.1.3 prettier: 3.0.3 protoc-gen-ts: 0.8.6 - run-time-error: 1.4.0 + run-time-error-cjs: 1.4.0 secp256k1: 4.0.3 semver-parser: 4.1.4 shebang-loader: 0.0.1 @@ -13263,6 +13257,15 @@ __metadata: languageName: node linkType: hard +"@types/node@npm:20.8.10": + version: 20.8.10 + resolution: "@types/node@npm:20.8.10" + dependencies: + undici-types: ~5.26.4 + checksum: 7c61190e43e8074a1b571e52ff14c880bc67a0447f2fe5ed0e1a023eb8a23d5f815658edb98890f7578afe0f090433c4a635c7c87311762544e20dd78723e515 + languageName: node + linkType: hard + "@types/node@npm:^10.1.0, @types/node@npm:^10.17.60": version: 10.17.60 resolution: "@types/node@npm:10.17.60" @@ -28537,7 +28540,7 @@ __metadata: languageName: node linkType: hard -"ipfs-core-utils@npm:^0.18.0, ipfs-core-utils@npm:^0.18.1": +"ipfs-core-utils@npm:^0.18.0": version: 0.18.1 resolution: "ipfs-core-utils@npm:0.18.1" dependencies: @@ -28565,33 +28568,6 @@ __metadata: languageName: node linkType: hard -"ipfs-http-client@npm:60.0.1": - version: 60.0.1 - resolution: "ipfs-http-client@npm:60.0.1" - dependencies: - "@ipld/dag-cbor": ^9.0.0 - "@ipld/dag-json": ^10.0.0 - "@ipld/dag-pb": ^4.0.0 - "@libp2p/logger": ^2.0.5 - "@libp2p/peer-id": ^2.0.0 - "@multiformats/multiaddr": ^11.1.5 - any-signal: ^3.0.0 - dag-jose: ^4.0.0 - err-code: ^3.0.1 - ipfs-core-types: ^0.14.1 - ipfs-core-utils: ^0.18.1 - ipfs-utils: ^9.0.13 - it-first: ^2.0.0 - it-last: ^2.0.0 - merge-options: ^3.0.4 - multiformats: ^11.0.0 - parse-duration: ^1.0.0 - stream-to-it: ^0.2.2 - uint8arrays: ^4.0.2 - checksum: 14c2bf2b7c401a3d5b3d3b935942475549e0a792953d485afc69a746c4be1e367ea4a0bc3f65f7de39d8d280c2777866b4e6b98c8d91e68dbdb2c235b98295b7 - languageName: node - linkType: hard - "ipfs-unixfs@npm:9.0.1, ipfs-unixfs@npm:^9.0.0": version: 9.0.1 resolution: "ipfs-unixfs@npm:9.0.1" @@ -32047,6 +32023,33 @@ __metadata: languageName: node linkType: hard +"kubo-rpc-client-esm-cjs@npm:3.0.1": + version: 3.0.1 + resolution: "kubo-rpc-client-esm-cjs@npm:3.0.1" + dependencies: + "@ipld/dag-cbor": ^9.0.0 + "@ipld/dag-json": ^10.0.0 + "@ipld/dag-pb": ^4.0.0 + "@libp2p/crypto": ^1.0.11 + "@libp2p/logger": ^2.0.5 + "@libp2p/peer-id": ^2.0.0 + "@multiformats/multiaddr": ^11.1.5 + any-signal: ^3.0.1 + dag-jose: ^4.0.0 + err-code: ^3.0.1 + ipfs-core-utils: ^0.18.0 + ipfs-utils: ^9.0.7 + it-first: ^2.0.0 + it-last: ^2.0.0 + merge-options: ^3.0.4 + multiformats: ^11.0.0 + parse-duration: ^1.0.2 + stream-to-it: ^0.2.4 + uint8arrays: ^4.0.3 + checksum: f15b28ccc74fea2a30d359b530af4d62ceaf8eab304feeb72913c136081433b397969f406c42ad1878c78787e0b0417aa88645c8b4fef02569744ec8a316bda0 + languageName: node + linkType: hard + "kubo-rpc-client@npm:3.0.1": version: 3.0.1 resolution: "kubo-rpc-client@npm:3.0.1" @@ -41520,10 +41523,10 @@ __metadata: languageName: node linkType: hard -"run-time-error@npm:1.4.0": +"run-time-error-cjs@npm:1.4.0": version: 1.4.0 - resolution: "run-time-error@npm:1.4.0" - checksum: f29eecdb2ccee1d4bdd19d43b1b2d679249e077574714c97dc48f57369a18f479d7dd6277e2470aa1277cded50c7e3c66df1f1d18c1d36f7f5c1db9824062f57 + resolution: "run-time-error-cjs@npm:1.4.0" + checksum: 4d37f1fb3e62d9b3f1175a8bb2a017858f00e942a1ac90f7d0117a07b68e7911802ead174856fd0cfd668f0f59b5184ea4f19879438927c0647d9fcef616a5be languageName: node linkType: hard @@ -42787,15 +42790,15 @@ __metadata: languageName: node linkType: hard -"socket.io-client@npm:4.5.4": +"socket.io-client-fixed-types@npm:4.5.4": version: 4.5.4 - resolution: "socket.io-client@npm:4.5.4" + resolution: "socket.io-client-fixed-types@npm:4.5.4" dependencies: "@socket.io/component-emitter": ~3.1.0 debug: ~4.3.2 engine.io-client: ~6.2.3 socket.io-parser: ~4.2.1 - checksum: 8320ce4a96e9c28318b17037e412746b1d612cfba653c3c321c0e49042f0be9aeb8de67d5861e45e9aad32407bb4dd204bfe199565d78d5320aaf65253371b7f + checksum: b7287454638ac6d34d5773a5bb8fb08ec555499e38fa2ee9c05f6e98cd2265a9800d8512fdba6ed5363bbd95cb30f757a1da9dfe9d1d1756b297d1743d6031f3 languageName: node linkType: hard @@ -46435,6 +46438,13 @@ __metadata: languageName: node linkType: hard +"undici-types@npm:~5.26.4": + version: 5.26.5 + resolution: "undici-types@npm:5.26.5" + checksum: 3192ef6f3fd5df652f2dc1cd782b49d6ff14dc98e5dced492aa8a8c65425227da5da6aafe22523c67f035a272c599bb89cfe803c1db6311e44bed3042fc25487 + languageName: node + linkType: hard + "undici@npm:5.26.2": version: 5.26.2 resolution: "undici@npm:5.26.2"