diff --git a/.cspell.json b/.cspell.json index b3076bc74e..6e71dd09dd 100644 --- a/.cspell.json +++ b/.cspell.json @@ -71,6 +71,8 @@ "ipaddress", "ipfs", "IPFSHTTP", + "IPLD", + "ipld", "Iroha", "Irohad", "isready", @@ -148,6 +150,7 @@ "txqueue", "Uisrs", "undici", + "unixfs", "Unmarshal", "uuidv", "vscc", diff --git a/examples/cactus-example-cbdc-bridging-backend/package.json b/examples/cactus-example-cbdc-bridging-backend/package.json index 8cadaf9c4b..396c068728 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 9858adb137..223fe17b32 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 0dc5c643ee..f6b8e10699 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-electricity-trade/tools/transferNumericAsset/transferNumericAsset.ts b/examples/cactus-example-electricity-trade/tools/transferNumericAsset/transferNumericAsset.ts index 9af42138f2..0f1b9edd0a 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-tcs-huawei/tools/transferNumericAsset/transferNumericAsset.ts b/examples/cactus-example-tcs-huawei/tools/transferNumericAsset/transferNumericAsset.ts index 9af42138f2..0f1b9edd0a 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 ed53114dcc..6d82a502f3 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", "uuid": "9.0.1" }, 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 f1143e3563..18f77f14bc 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/README.md b/extensions/cactus-plugin-object-store-ipfs/README.md index 0991fea56d..7f5872bcc3 100644 --- a/extensions/cactus-plugin-object-store-ipfs/README.md +++ b/extensions/cactus-plugin-object-store-ipfs/README.md @@ -46,7 +46,7 @@ This plugin uses OpenAPI to generate the API paths. There are three endpoints de Firstly create an instance of the plugin. ```typescript -import { create } from "ipfs-http-client"; +import { create } from "kubo-rpc-client"; const logLevel: LogLevelDesc = "TRACE"; const ipfsClientOrOptions = create(); diff --git a/extensions/cactus-plugin-object-store-ipfs/package.json b/extensions/cactus-plugin-object-store-ipfs/package.json index 1706e92aeb..75ccb7f442 100644 --- a/extensions/cactus-plugin-object-store-ipfs/package.json +++ b/extensions/cactus-plugin-object-store-ipfs/package.json @@ -59,19 +59,22 @@ "@hyperledger/cactus-core": "2.0.0-alpha.2", "@hyperledger/cactus-core-api": "2.0.0-alpha.2", "axios": "1.5.1", - "ipfs-http-client": "60.0.1", - "run-time-error": "1.4.0", + "run-time-error-cjs": "1.4.0", "typescript-optional": "2.0.1", "uuid": "8.3.2" }, "devDependencies": { "@hyperledger/cactus-test-tooling": "2.0.0-alpha.2", + "@multiformats/multiaddr": "11.6.1", "@types/body-parser": "1.19.4", "@types/express": "4.17.19", "body-parser": "1.20.2", "express": "4.18.2", "ipfs-core-types": "0.14.1", - "multiformats": "9.4.9" + "ipfs-unixfs": "9.0.1", + "kubo-rpc-client": "3.0.1", + "kubo-rpc-client-esm-cjs": "3.0.1", + "multiformats": "11.0.2" }, "engines": { "node": ">=10", diff --git a/extensions/cactus-plugin-object-store-ipfs/src/main/typescript/i-ipfs-http-client.ts b/extensions/cactus-plugin-object-store-ipfs/src/main/typescript/i-ipfs-http-client.ts deleted file mode 100644 index 42a4325b6c..0000000000 --- a/extensions/cactus-plugin-object-store-ipfs/src/main/typescript/i-ipfs-http-client.ts +++ /dev/null @@ -1,48 +0,0 @@ -import type { IPFS } from "ipfs-core-types"; -import type { EndpointConfig, IPFSHTTPClient } from "ipfs-http-client"; - -export interface IIpfsHttpClient extends IPFS { - getEndpointConfig: () => EndpointConfig; -} - -export function isIpfsHttpClientOptions(x: unknown): x is IPFSHTTPClient { - if (!x) { - return false; - } - return ( - typeof (x as IIpfsHttpClient).add === "function" && - typeof (x as IIpfsHttpClient).addAll === "function" && - typeof (x as IIpfsHttpClient).bitswap === "object" && - typeof (x as IIpfsHttpClient).block === "object" && - typeof (x as IIpfsHttpClient).bootstrap === "object" && - typeof (x as IIpfsHttpClient).cat === "function" && - typeof (x as IIpfsHttpClient).commands === "function" && - typeof (x as IIpfsHttpClient).config === "object" && - typeof (x as IIpfsHttpClient).dag === "object" && - typeof (x as IIpfsHttpClient).dht === "object" && - typeof (x as IIpfsHttpClient).diag === "object" && - typeof (x as IIpfsHttpClient).dns === "function" && - typeof (x as IIpfsHttpClient).files === "object" && - typeof (x as IIpfsHttpClient).get === "function" && - typeof (x as IIpfsHttpClient).getEndpointConfig === "function" && - typeof (x as IIpfsHttpClient).id === "function" && - typeof (x as IIpfsHttpClient).isOnline === "function" && - typeof (x as IIpfsHttpClient).key === "object" && - typeof (x as IIpfsHttpClient).log === "object" && - typeof (x as IIpfsHttpClient).ls === "function" && - typeof (x as IIpfsHttpClient).mount === "function" && - typeof (x as IIpfsHttpClient).name === "object" && - typeof (x as IIpfsHttpClient).object === "object" && - typeof (x as IIpfsHttpClient).pin === "object" && - typeof (x as IIpfsHttpClient).ping === "function" && - typeof (x as IIpfsHttpClient).pubsub === "object" && - // typeof (x as IIpfsHttpClient).refs === "function" && - typeof (x as IIpfsHttpClient).repo === "object" && - typeof (x as IIpfsHttpClient).resolve === "function" && - typeof (x as IIpfsHttpClient).start === "function" && - typeof (x as IIpfsHttpClient).stats === "object" && - typeof (x as IIpfsHttpClient).stop === "function" && - typeof (x as IIpfsHttpClient).swarm === "object" && - typeof (x as IIpfsHttpClient).version === "function" - ); -} 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 new file mode 100644 index 0000000000..d01df0fc5c --- /dev/null +++ b/extensions/cactus-plugin-object-store-ipfs/src/main/typescript/kubo-rpc-client-types.ts @@ -0,0 +1,133 @@ +/** + * Since kubo-rpc-client uses ESM only, we can't import it to get types (since we use CJS). + * 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"; + +///////////////////////////////////// +// Types from kubo-rpc-client +///////////////////////////////////// +// Some are simplified when details are not needed + +export type MultibaseCodec = +// @ts-ignore +import("multiformats/bases/interface").MultibaseCodec; +export type BlockCodec< +T1 = any, +T2 = any, +// @ts-ignore +> = import("multiformats/codecs/interface").BlockCodec; + +export interface LoadBaseFn { + (codeOrName: number | string): Promise>; +} +export interface LoadCodecFn { + (codeOrName: number | string): Promise>; +} +export interface LoadHasherFn { + (codeOrName: number | string): Promise; +} + +export interface IPLDOptions { + loadBase: LoadBaseFn; + loadCodec: LoadCodecFn; + loadHasher: LoadHasherFn; + bases: Array>; + codecs: Array>; + hashers: MultihashHasher[]; +} + +export interface Options { + host?: string; + port?: number; + protocol?: string; + headers?: Headers | Record; + timeout?: number | string; + apiPath?: string; + url?: URL | string | Multiaddr; + ipld?: Partial; + agent?: HttpAgent | HttpsAgent; +} + +export type IPFSPath = CID | string; + +export interface StatResult { + cid: CID; + size: number; + cumulativeSize: number; + type: "directory" | "file"; + blocks: number; + withLocality: boolean; + local?: boolean; + sizeLocal?: number; + mode?: number; + mtime?: Mtime; +} + +///////////////////////////////////////////////////////// +// LikeIpfsHttpClient instead of full IpfsHttpClient +///////////////////////////////////////////////////////// + +/** + * Connector only needs these methods to work. + * More methods can be added in the future. + */ +export interface LikeIpfsHttpClientFile { + read: ( + ipfsPath: IPFSPath, + options?: Record, + ) => AsyncIterable; + + write: ( + ipfsPath: string, + content: + | string + | Uint8Array + | Blob + | AsyncIterable + | Iterable, + options?: Record, + ) => Promise; + + stat: ( + ipfsPath: IPFSPath, + options?: Record, + ) => Promise; +} + +export function isLikeIpfsHttpClientFile( + x: unknown, +): x is LikeIpfsHttpClientFile { + if (!x) { + return false; + } + return ( + typeof (x as LikeIpfsHttpClientFile).read === "function" && + typeof (x as LikeIpfsHttpClientFile).write === "function" && + typeof (x as LikeIpfsHttpClientFile).stat === "function" + ); +} + +/** + * Only files API is used + */ +export interface LikeIpfsHttpClient { + files: LikeIpfsHttpClientFile; +} + +export function isLikeIpfsHttpClient(x: unknown): x is LikeIpfsHttpClient { + if (!x) { + return false; + } + return isLikeIpfsHttpClientFile((x as LikeIpfsHttpClient).files); +} 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 185b956868..3e96dd5351 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,10 +1,13 @@ import path from "path"; import type { Express } from "express"; -import { create, IPFSHTTPClient } from "ipfs-http-client"; -import type { Options } from "ipfs-http-client"; -import { RuntimeError } from "run-time-error"; -import { Logger, Checks, LoggerProvider } from "@hyperledger/cactus-common"; -import type { LogLevelDesc } from "@hyperledger/cactus-common"; +// @ts-ignore +import { RuntimeError } from "run-time-error-cjs"; +import { + Logger, + Checks, + LoggerProvider, + LogLevelDesc, +} from "@hyperledger/cactus-common"; import type { IPluginObjectStore, ICactusPluginOptions, @@ -22,7 +25,11 @@ import OAS from "../json/openapi.json"; import { GetObjectEndpointV1 } from "./web-services/get-object-endpoint-v1"; import { SetObjectEndpointV1 } from "./web-services/set-object-endpoint-v1"; import { HasObjectEndpointV1 } from "./web-services/has-object-endpoint-v1"; -import { isIpfsHttpClientOptions } from "./i-ipfs-http-client"; +import { + LikeIpfsHttpClient, + isLikeIpfsHttpClient, + Options, +} from "./kubo-rpc-client-types"; export const K_IPFS_JS_HTTP_ERROR_FILE_DOES_NOT_EXIST = "HTTPError: file does not exist"; @@ -30,13 +37,13 @@ export const K_IPFS_JS_HTTP_ERROR_FILE_DOES_NOT_EXIST = export interface IPluginObjectStoreIpfsOptions extends ICactusPluginOptions { readonly logLevel?: LogLevelDesc; readonly parentDir: string; - readonly ipfsClientOrOptions: Options | IPFSHTTPClient; + readonly ipfsClientOrOptions: Options | LikeIpfsHttpClient; } export class PluginObjectStoreIpfs implements IPluginObjectStore { public static readonly CLASS_NAME = "PluginObjectStoreIpfs"; - private readonly ipfs: IPFSHTTPClient; + private ipfs: LikeIpfsHttpClient | undefined; private readonly log: Logger; private readonly instanceId: string; private readonly parentDir: string; @@ -45,6 +52,38 @@ export class PluginObjectStoreIpfs implements IPluginObjectStore { return PluginObjectStoreIpfs.CLASS_NAME; } + /** + * We use dynamic import for kubo-rpc-client since it's ESM and we can't import it normally. + * This methods will load the module and initialize local IPFS client based on ctor arguments. + */ + private async initIpfs(): Promise { + if (isLikeIpfsHttpClient(this.opts.ipfsClientOrOptions)) { + this.ipfs = this.opts.ipfsClientOrOptions; + } else if (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); + } + } + + /** + * Get IPFS client or initialize it from constructor args. + * @returns `LikeIpfsHttpClient` or exception + */ + private async getIpfs(): Promise { + if (!this.ipfs) { + await this.initIpfs(); + } + + if (!this.ipfs) { + throw new Error("Could not instantiate ipfs http client"); + } + + return this.ipfs; + } + constructor(public readonly opts: IPluginObjectStoreIpfsOptions) { const fnTag = `${this.className}#constructor()`; Checks.truthy(opts, `${fnTag} arg options`); @@ -52,18 +91,6 @@ export class PluginObjectStoreIpfs implements IPluginObjectStore { Checks.nonBlankString(opts.parentDir, `${fnTag} options.parentDir`); Checks.truthy(opts.ipfsClientOrOptions, `${fnTag} ipfsClientOrOptions`); - if (isIpfsHttpClientOptions(opts.ipfsClientOrOptions)) { - this.ipfs = opts.ipfsClientOrOptions; - } else if (opts.ipfsClientOrOptions) { - this.ipfs = create({ - ...(this.opts.ipfsClientOrOptions as Options), - }); - } else { - const errorMessage = `${fnTag} Need either "ipfsClient" or "ipfsClientOptions" to construct ${this.className} Neither was provided.`; - throw new RuntimeError(errorMessage); - } - Checks.truthy(this.ipfs, `${fnTag} arg options.backend`); - const level = this.opts.logLevel || "INFO"; const label = this.className; this.log = LoggerProvider.getOrCreate({ level, label }); @@ -79,7 +106,7 @@ export class PluginObjectStoreIpfs implements IPluginObjectStore { } public async onPluginInit(): Promise { - return; // no-op + return this.initIpfs(); } public async registerWebServices( @@ -130,7 +157,8 @@ export class PluginObjectStoreIpfs implements IPluginObjectStore { public async get(req: GetObjectRequestV1): Promise { const keyPath = this.getKeyPath(req); - const chunksIterable = this.ipfs.files.read(keyPath); + const ipfs = await this.getIpfs(); + const chunksIterable = ipfs.files.read(keyPath); const chunks = []; for await (const chunk of chunksIterable) { chunks.push(chunk); @@ -151,7 +179,8 @@ export class PluginObjectStoreIpfs implements IPluginObjectStore { const checkedAt = new Date().toJSON(); const keyPath = this.getKeyPath(req); try { - const statResult = await this.ipfs.files.stat(keyPath); + const ipfs = await this.getIpfs(); + const statResult = await ipfs.files.stat(keyPath); this.log.debug(`StatResult for ${req.key}: %o`, statResult); return { key: req.key, checkedAt, isPresent: true }; } catch (ex) { @@ -170,7 +199,8 @@ export class PluginObjectStoreIpfs implements IPluginObjectStore { try { this.log.debug(`Seting object ${keyPath} in IPFS...`); const buffer = Buffer.from(req.value, "base64"); - await this.ipfs.files.write(keyPath, buffer, { + const ipfs = await this.getIpfs(); + await ipfs.files.write(keyPath, buffer, { create: true, parents: true, }); diff --git a/extensions/cactus-plugin-object-store-ipfs/src/main/typescript/public-api.ts b/extensions/cactus-plugin-object-store-ipfs/src/main/typescript/public-api.ts index 46e031206d..3a2fd6d45c 100755 --- a/extensions/cactus-plugin-object-store-ipfs/src/main/typescript/public-api.ts +++ b/extensions/cactus-plugin-object-store-ipfs/src/main/typescript/public-api.ts @@ -1,5 +1,9 @@ export * from "./generated/openapi/typescript-axios/index"; -export { IIpfsHttpClient } from "./i-ipfs-http-client"; +export { + Options, + LikeIpfsHttpClientFile, + LikeIpfsHttpClient, +} from "./kubo-rpc-client-types"; import { IPluginFactoryOptions } from "@hyperledger/cactus-core-api"; export { PluginObjectStoreIpfs, diff --git a/extensions/cactus-plugin-object-store-ipfs/src/test/typescript/fixtures/mock/ipfs/ipfs-files-api-mock.ts b/extensions/cactus-plugin-object-store-ipfs/src/test/typescript/fixtures/mock/ipfs/ipfs-files-api-mock.ts deleted file mode 100644 index e0245e4a25..0000000000 --- a/extensions/cactus-plugin-object-store-ipfs/src/test/typescript/fixtures/mock/ipfs/ipfs-files-api-mock.ts +++ /dev/null @@ -1,157 +0,0 @@ -// Needed to disable the no-unused-vars check here because the file is full -// of unused method parameters given how this is a mock which doesn't do -// anything for the most part and that's by design. -/* eslint-disable @typescript-eslint/no-unused-vars */ -import { CID } from "multiformats/cid"; -import { - API as FilesAPI, - ChmodOptions, - CpOptions, - MFSEntry, - MkdirOptions, - MvOptions, - ReadOptions, - RmOptions, - StatOptions, - StatResult, - TouchOptions, - WriteOptions, -} from "ipfs-core-types/src/files"; - -import { AbortOptions } from "ipfs-core-types"; -import { IPFSPath } from "ipfs-core-types/src/utils"; -import { RuntimeError } from "run-time-error"; - -import { Logger, Checks, LogLevelDesc } from "@hyperledger/cactus-common"; -import { LoggerProvider } from "@hyperledger/cactus-common"; -import { K_IPFS_JS_HTTP_ERROR_FILE_DOES_NOT_EXIST } from "../../../../../main/typescript/plugin-object-store-ipfs"; - -export interface IFilesApiMockOptions { - logLevel?: LogLevelDesc; -} - -export class FilesApiMock implements FilesAPI { - public static readonly CLASS_NAME = "FilesApiMock"; - - private readonly log: Logger; - private readonly data: Map; - - public get className(): string { - return FilesApiMock.CLASS_NAME; - } - - constructor(public readonly options: IFilesApiMockOptions) { - const fnTag = `${this.className}#constructor()`; - Checks.truthy(options, `${fnTag} arg options`); - - this.data = new Map(); - - const level = this.options.logLevel || "INFO"; - const label = this.className; - this.log = LoggerProvider.getOrCreate({ level, label }); - this.log.debug(`Instantiated ${this.className} OK`); - } - - public async chmod( - path: string, - mode: string | number, - options?: ChmodOptions | undefined, - ): Promise { - throw new RuntimeError("Method chmod() not implemented"); - } - - public async cp( - from: IPFSPath | IPFSPath[], - to: string, - options?: CpOptions | undefined, - ): Promise { - throw new RuntimeError("Method cp() not implemented"); - } - - public async mkdir( - path: string, - options?: MkdirOptions | undefined, - ): Promise { - throw new RuntimeError("Method mkdir() not implemented"); - } - - public async stat( - ipfsPath: IPFSPath, - options?: StatOptions | undefined, - ): Promise { - if (typeof ipfsPath !== "string") { - throw new RuntimeError("Sorry, the mock only supports string IPFS paths"); - } - if (this.data.has(ipfsPath)) { - return {} as StatResult; - } else { - throw new RuntimeError(K_IPFS_JS_HTTP_ERROR_FILE_DOES_NOT_EXIST); - } - } - - public async touch( - ipfsPath: string, - options?: TouchOptions | undefined, - ): Promise { - throw new RuntimeError("Method touch() not implemented"); - } - - public async rm( - ipfsPaths: string | string[], - options?: RmOptions | undefined, - ): Promise { - throw new RuntimeError("Method rm() not implemented"); - } - - public async *read( - ipfsPath: IPFSPath, - options?: ReadOptions | undefined, - ): AsyncIterable { - if (typeof ipfsPath !== "string") { - throw new RuntimeError("Sorry, the mock only supports string IPFS paths"); - } - const buffer = this.data.get(ipfsPath); - if (!buffer) { - throw new RuntimeError(K_IPFS_JS_HTTP_ERROR_FILE_DOES_NOT_EXIST); - } - yield buffer; - } - - public async write( - ipfsPath: string, - content: - | string - | Uint8Array - | AsyncIterable - | Blob - | Iterable, - options?: WriteOptions | undefined, - ): Promise { - if (!(content instanceof Buffer)) { - throw new RuntimeError("Sorry, this mock only supports Buffer content."); - } - this.data.set(ipfsPath, content); - } - - public async mv( - from: string | string[], - to: string, - options?: MvOptions | undefined, - ): Promise { - throw new RuntimeError("Method mv() not implemented"); - } - - public async flush( - ipfsPath: string, - options?: AbortOptions | undefined, - ): Promise { - throw new RuntimeError("Method flush() not implemented"); - } - - public ls( - ipfsPath: IPFSPath, - options?: AbortOptions | undefined, - ): AsyncIterable { - throw new RuntimeError("Method ls() not implemented"); - } -} 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 4cfe3d2ee2..67a65ddaac 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 @@ -1,21 +1,23 @@ import test, { Test } from "tape-promise/tape"; -import { create } from "ipfs-http-client"; import express from "express"; import bodyParser from "body-parser"; import http from "http"; import type { AddressInfo } from "net"; - import { v4 as uuidv4 } from "uuid"; -import { IListenOptions, Servers } from "@hyperledger/cactus-common"; -import type { LogLevelDesc } from "@hyperledger/cactus-common"; +import { + IListenOptions, + Servers, + LogLevelDesc, +} from "@hyperledger/cactus-common"; import { Configuration } from "@hyperledger/cactus-core-api"; -import { GoIpfsTestContainer } from "@hyperledger/cactus-test-tooling"; -import { Containers } from "@hyperledger/cactus-test-tooling"; +import { + GoIpfsTestContainer, + Containers, +} from "@hyperledger/cactus-test-tooling"; import { PluginObjectStoreIpfs } from "../../../main/typescript"; - import { DefaultApi as ObjectStoreIpfsApi } from "../../../main/typescript/public-api"; const logLevel: LogLevelDesc = "TRACE"; @@ -58,6 +60,9 @@ test(testCase, async (t: Test) => { t.comment(`Go IPFS Test Container API URL: ${ipfsApiUrl}`); t.comment(`Go IPFS Test Container Gateway URL: ${ipfsGatewayUrl}`); + + const { create } = await import("kubo-rpc-client"); + const ipfsClientOrOptions = create({ url: ipfsApiUrl, }); 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 fd5ce1eee6..9203f376bb 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 @@ -1,9 +1,7 @@ import type { AddressInfo } from "net"; import http from "http"; import test, { Test } from "tape-promise/tape"; - import { v4 as uuidv4 } from "uuid"; -import { create } from "ipfs-http-client"; import express from "express"; import bodyParser from "body-parser"; @@ -13,12 +11,12 @@ import { Configuration } from "@hyperledger/cactus-core-api"; import { PluginObjectStoreIpfs } from "../../../main/typescript"; import type { IPluginObjectStoreIpfsOptions } from "../../../main/typescript"; - import { DefaultApi as ObjectStoreIpfsApi } from "../../../main/typescript/public-api"; -test("PluginObjectStoreIpfs", (t1: Test) => { +test("PluginObjectStoreIpfs", async (t1: Test) => { const logLevel: LogLevelDesc = "TRACE"; - const ipfsClientOrOptions = create(); + const kuboRpcModule = await import("kubo-rpc-client"); + const ipfsClientOrOptions = kuboRpcModule.create(); t1.doesNotThrow( () => new PluginObjectStoreIpfs({ @@ -50,8 +48,9 @@ test("PluginObjectStoreIpfs", (t1: Test) => { }); test.skip("get,set,has,delete alters state as expected", async (t: Test) => { + const kuboRpcModule = await import("kubo-rpc-client"); const options: IPluginObjectStoreIpfsOptions = { - ipfsClientOrOptions: create(), // FIXME: use an actual mock IPFS client + ipfsClientOrOptions: kuboRpcModule.create(), // FIXME: use an actual mock IPFS client instanceId: uuidv4(), parentDir: "/" + uuidv4(), logLevel, diff --git a/extensions/cactus-plugin-object-store-ipfs/tsconfig.json b/extensions/cactus-plugin-object-store-ipfs/tsconfig.json index 10485206c2..00f79d62a6 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", diff --git a/jest.config.js b/jest.config.js index ff19a579f6..16627785bf 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, @@ -8,6 +9,7 @@ module.exports = { testTimeout: 60 * 60 * 1000, testMatch: [ `**/cactus-*/src/test/typescript/{unit,integration,benchmark}/**/*.test.ts`, + `**/cacti-*/src/test/typescript/{unit,integration,benchmark}/**/*.test.ts`, ], // Ignore the tests that are still using tap/tape for as their test runner testPathIgnorePatterns: [ diff --git a/package.json b/package.json index 930d8eb54c..a2e22f33d8 100644 --- a/package.json +++ b/package.json @@ -69,9 +69,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", @@ -149,6 +149,7 @@ "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 a007de9995..cad1141ad5 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 21f38bce9a..1e92264324 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/cactus-api-client/package.json b/packages/cactus-api-client/package.json index 94ccc450ca..86f13028e1 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 9a1ac3dfae..d998771719 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 44a4a00a9f..7d4460f473 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 b0e9b51e29..f361180ba9 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 9197f0253f..b89bf3e88a 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 7987ddfbed..f2848b926b 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 1246f76112..3de32ec2b0 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 14b001737c..456d5554bf 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 6caaeb1afb..dad7ed4025 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 c0fd11a847..7a23254a9a 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-plugin-ledger-connector-besu/package.json b/packages/cactus-plugin-ledger-connector-besu/package.json index 240a8bafc6..e85e68d038 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 00f1da54e3..463085f681 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 5e92ba1722..4f543e8105 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 db56bf622f..60a8e570fc 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 6d58572d1f..8254f954ba 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 06309dd445..75ff90d91b 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 fbf5923074..31ab6cdcf0 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/package.json +++ b/packages/cactus-plugin-ledger-connector-fabric/package.json @@ -78,12 +78,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 1311dc57f9..c3ae330dde 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 42a2a9f815..c48517ab8f 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 b5ed3f47c2..618ab22bfa 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 67867c2be7..f48f4e62ca 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 293e67ed76..f6dacda2c7 100644 --- a/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/package.json +++ b/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/package.json @@ -77,7 +77,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 15d0d131cc..7ab383a818 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 8b9ff0a667..94c5db05be 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 7fb491742a..e54145e60f 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 00a9bd61e5..a6eeb99b88 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 711c76a9cb..f6a87ef9b0 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 ca1f68086d..5af46ce6c3 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 ed38cb60ad..528fb2a668 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 05d5ec6c6f..5737bf8b21 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 7327b75046..3a60f6d9db 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 7d7efb190b..9e8fba0be0 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 e7c06ed939..d738621eaa 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 41ab3fa7b6..58584b4133 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 f66e781c21..5b1ef80009 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 78811f4611..672f57b740 100644 --- a/packages/cactus-plugin-ledger-connector-iroha2/package.json +++ b/packages/cactus-plugin-ledger-connector-iroha2/package.json @@ -60,7 +60,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 efa6f6255c..4c37d6850b 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 8c2d3df53a..c055b4afc2 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 9f23bfbfce..32350d171b 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 7390e5fe56..aa2bad3b4c 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-odap-hermes/package.json b/packages/cactus-plugin-odap-hermes/package.json index 911fab3151..83c97ddae3 100644 --- a/packages/cactus-plugin-odap-hermes/package.json +++ b/packages/cactus-plugin-odap-hermes/package.json @@ -79,7 +79,7 @@ "body-parser": "1.20.2", "express": "4.18.2", "fabric-network": "2.2.19", - "ipfs-http-client": "60.0.1", + "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 d38dc8708d..6916fa6044 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 @@ -5,7 +5,6 @@ import { Server as SocketIoServer } from "socket.io"; import { AddressInfo } from "net"; import { v4 as uuidv4 } from "uuid"; import { PluginObjectStoreIpfs } from "@hyperledger/cactus-plugin-object-store-ipfs"; -import { create } from "ipfs-http-client"; import bodyParser from "body-parser"; import express from "express"; import { DefaultApi as ObjectStoreIpfsApi } from "@hyperledger/cactus-plugin-object-store-ipfs"; @@ -161,7 +160,8 @@ beforeAll(async () => { const ipfsApiUrl = await ipfsContainer.getApiUrl(); - const ipfsClientOrOptions = create({ + 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 7e745b4928..e152204ce9 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 @@ -5,7 +5,6 @@ import { Server as SocketIoServer } from "socket.io"; import { AddressInfo } from "net"; import { v4 as uuidv4 } from "uuid"; import { PluginObjectStoreIpfs } from "@hyperledger/cactus-plugin-object-store-ipfs"; -import { create } from "ipfs-http-client"; import bodyParser from "body-parser"; import express from "express"; import { DefaultApi as ObjectStoreIpfsApi } from "@hyperledger/cactus-plugin-object-store-ipfs"; @@ -158,7 +157,8 @@ beforeAll(async () => { const ipfsApiUrl = await ipfsContainer.getApiUrl(); - const ipfsClientOrOptions = create({ + 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 2ff164096c..06d414a8b7 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 @@ -5,7 +5,6 @@ import { Server as SocketIoServer } from "socket.io"; import { AddressInfo } from "net"; import { v4 as uuidv4 } from "uuid"; import { PluginObjectStoreIpfs } from "@hyperledger/cactus-plugin-object-store-ipfs"; -import { create } from "ipfs-http-client"; import bodyParser from "body-parser"; import express from "express"; import { DefaultApi as ObjectStoreIpfsApi } from "@hyperledger/cactus-plugin-object-store-ipfs"; @@ -158,7 +157,8 @@ beforeAll(async () => { const ipfsApiUrl = await ipfsContainer.getApiUrl(); - const ipfsClientOrOptions = create({ + 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 b8ec81571d..dff7aff312 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 @@ -3,7 +3,6 @@ import type { AddressInfo } from "net"; import { v4 as uuidv4 } from "uuid"; import "jest-extended"; import { PluginObjectStoreIpfs } from "@hyperledger/cactus-plugin-object-store-ipfs"; -import { create } from "ipfs-http-client"; import bodyParser from "body-parser"; import express, { Express } from "express"; import { DefaultApi as ObjectStoreIpfsApi } from "@hyperledger/cactus-plugin-object-store-ipfs"; @@ -93,7 +92,8 @@ beforeAll(async () => { const ipfsApiUrl = await ipfsContainer.getApiUrl(); - const ipfsClientOrOptions = create({ + 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 30f4541858..52928195bc 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 @@ -5,7 +5,6 @@ import { Server as SocketIoServer } from "socket.io"; import { AddressInfo } from "net"; import { v4 as uuidv4 } from "uuid"; import { PluginObjectStoreIpfs } from "@hyperledger/cactus-plugin-object-store-ipfs"; -import { create } from "ipfs-http-client"; import bodyParser from "body-parser"; import express from "express"; import { DefaultApi as ObjectStoreIpfsApi } from "@hyperledger/cactus-plugin-object-store-ipfs"; @@ -65,6 +64,7 @@ import { } from "../../../main/typescript/gateway/besu-odap-gateway"; import { ClientGatewayHelper } from "../../../main/typescript/gateway/client/client-helper"; import { ServerGatewayHelper } from "../../../main/typescript/gateway/server/server-helper"; + /** * Use this to debug issues with the fabric node SDK * ```sh @@ -152,7 +152,8 @@ beforeAll(async () => { const ipfsApiUrl = await ipfsContainer.getApiUrl(); - const ipfsClientOrOptions = create({ + 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 db02da69e6..4510dfad61 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 @@ -3,7 +3,6 @@ import type { AddressInfo } from "net"; import { v4 as uuidv4 } from "uuid"; import "jest-extended"; import { PluginObjectStoreIpfs } from "@hyperledger/cactus-plugin-object-store-ipfs"; -import { create } from "ipfs-http-client"; import bodyParser from "body-parser"; import express from "express"; import { DefaultApi as ObjectStoreIpfsApi } from "@hyperledger/cactus-plugin-object-store-ipfs"; @@ -18,6 +17,7 @@ import { import { Configuration } from "@hyperledger/cactus-core-api"; import { GoIpfsTestContainer } from "@hyperledger/cactus-test-tooling"; + import { PluginOdapGateway, IPluginOdapGatewayConstructorOptions, @@ -33,6 +33,7 @@ import { FabricOdapGateway } from "../../../main/typescript/gateway/fabric-odap- import { ClientGatewayHelper } from "../../../main/typescript/gateway/client/client-helper"; import { ServerGatewayHelper } from "../../../main/typescript/gateway/server/server-helper"; + const MAX_RETRIES = 5; const MAX_TIMEOUT = 5000; @@ -78,7 +79,8 @@ beforeAll(async () => { const ipfsApiUrl = await ipfsContainer.getApiUrl(); - const ipfsClientOrOptions = create({ + 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 97e7a1437b..2e3cb92993 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 @@ -5,7 +5,6 @@ import { Server as SocketIoServer } from "socket.io"; import { AddressInfo } from "net"; import { v4 as uuidv4 } from "uuid"; import { PluginObjectStoreIpfs } from "@hyperledger/cactus-plugin-object-store-ipfs"; -import { create } from "ipfs-http-client"; import bodyParser from "body-parser"; import express from "express"; import { DefaultApi as ObjectStoreIpfsApi } from "@hyperledger/cactus-plugin-object-store-ipfs"; @@ -24,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"; @@ -155,7 +157,8 @@ beforeAll(async () => { const ipfsApiUrl = await ipfsContainer.getApiUrl(); - const ipfsClientOrOptions = create({ + const kuboRpcModule = await import("kubo-rpc-client"); + const ipfsClientOrOptions = kuboRpcModule.create({ url: ipfsApiUrl, }); @@ -179,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 6c1977936e..850494b852 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 @@ -3,7 +3,6 @@ import type { AddressInfo } from "net"; import { v4 as uuidv4 } from "uuid"; import "jest-extended"; import { PluginObjectStoreIpfs } from "@hyperledger/cactus-plugin-object-store-ipfs"; -import { create } from "ipfs-http-client"; import bodyParser from "body-parser"; import express from "express"; import { DefaultApi as ObjectStoreIpfsApi } from "@hyperledger/cactus-plugin-object-store-ipfs"; @@ -16,6 +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 { AssetProfile, ClientV1Request, @@ -66,7 +66,8 @@ beforeAll(async () => { const ipfsApiUrl = await ipfsContainer.getApiUrl(); - const ipfsClientOrOptions = create({ + 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 c0b820f1c9..8b2d7c5a5f 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 @@ -5,7 +5,6 @@ import { Server as SocketIoServer } from "socket.io"; import { AddressInfo } from "net"; import { v4 as uuidv4 } from "uuid"; import { PluginObjectStoreIpfs } from "@hyperledger/cactus-plugin-object-store-ipfs"; -import { create } from "ipfs-http-client"; import bodyParser from "body-parser"; import express from "express"; import { DefaultApi as ObjectStoreIpfsApi } from "@hyperledger/cactus-plugin-object-store-ipfs"; @@ -52,6 +51,7 @@ import { ReceiptType, Web3SigningCredential, } from "@hyperledger/cactus-plugin-ledger-connector-besu"; + import Web3 from "web3"; import { makeSessionDataChecks } from "../make-checks"; @@ -157,7 +157,8 @@ beforeAll(async () => { const ipfsApiUrl = await ipfsContainer.getApiUrl(); - const ipfsClientOrOptions = create({ + 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 5846727784..3e588b34e9 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 @@ -3,7 +3,6 @@ import type { AddressInfo } from "net"; import { v4 as uuidv4 } from "uuid"; import "jest-extended"; import { PluginObjectStoreIpfs } from "@hyperledger/cactus-plugin-object-store-ipfs"; -import { create } from "ipfs-http-client"; import bodyParser from "body-parser"; import express, { Express } from "express"; import { DefaultApi as ObjectStoreIpfsApi } from "@hyperledger/cactus-plugin-object-store-ipfs"; @@ -15,6 +14,7 @@ import { } from "@hyperledger/cactus-common"; import { Configuration } from "@hyperledger/cactus-core-api"; import { GoIpfsTestContainer } from "@hyperledger/cactus-test-tooling"; + import { AssetProfile, ClientV1Request, @@ -93,7 +93,8 @@ beforeAll(async () => { const ipfsApiUrl = await ipfsContainer.getApiUrl(); - const ipfsClientOrOptions = create({ + 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 35cd56000a..1c1ba8dc55 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 @@ -3,7 +3,6 @@ import { SHA256 } from "crypto-js"; import bodyParser from "body-parser"; import { v4 as uuidv4 } from "uuid"; import http, { Server } from "http"; -import { create } from "ipfs-http-client"; import { OdapMessageType, PluginOdapGateway, @@ -21,6 +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 express from "express"; import { AddressInfo } from "net"; @@ -76,7 +76,8 @@ beforeAll(async () => { const ipfsApiUrl = await ipfsContainer.getApiUrl(); - const ipfsClientOrOptions = create({ + 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 f55d81e3ac..f57c88fccd 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 @@ -3,7 +3,6 @@ import type { AddressInfo } from "net"; import { v4 as uuidv4 } from "uuid"; import "jest-extended"; import { PluginObjectStoreIpfs } from "@hyperledger/cactus-plugin-object-store-ipfs"; -import { create } from "ipfs-http-client"; import bodyParser from "body-parser"; import express from "express"; import { DefaultApi as ObjectStoreIpfsApi } from "@hyperledger/cactus-plugin-object-store-ipfs"; @@ -17,6 +16,8 @@ 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 { OdapLocalLog, SessionData, @@ -86,7 +87,8 @@ beforeAll(async () => { const ipfsApiUrl = await ipfsContainer.getApiUrl(); - const ipfsClientOrOptions = create({ + 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 b346430d45..4c1d884654 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 @@ -3,7 +3,6 @@ import type { AddressInfo } from "net"; import { v4 as uuidv4 } from "uuid"; import "jest-extended"; import { PluginObjectStoreIpfs } from "@hyperledger/cactus-plugin-object-store-ipfs"; -import { create } from "ipfs-http-client"; import bodyParser from "body-parser"; import express from "express"; import { DefaultApi as ObjectStoreIpfsApi } from "@hyperledger/cactus-plugin-object-store-ipfs"; @@ -16,6 +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 { RecoverSuccessV1Message, SessionData, @@ -70,7 +70,8 @@ beforeAll(async () => { const ipfsApiUrl = await ipfsContainer.getApiUrl(); // t.comment(`Go IPFS Test Container API URL: ${ipfsApiUrl}`); - const ipfsClientOrOptions = create({ + 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 cb3b9b2e0a..55b4ce6106 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 @@ -3,7 +3,6 @@ import type { AddressInfo } from "net"; import { v4 as uuidv4 } from "uuid"; import "jest-extended"; import { PluginObjectStoreIpfs } from "@hyperledger/cactus-plugin-object-store-ipfs"; -import { create } from "ipfs-http-client"; import bodyParser from "body-parser"; import express from "express"; import { DefaultApi as ObjectStoreIpfsApi } from "@hyperledger/cactus-plugin-object-store-ipfs"; @@ -16,6 +15,8 @@ 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 { RecoverUpdateAckV1Message, SessionData, @@ -70,7 +71,8 @@ beforeAll(async () => { const ipfsApiUrl = await ipfsContainer.getApiUrl(); // t.comment(`Go IPFS Test Container API URL: ${ipfsApiUrl}`); - const ipfsClientOrOptions = create({ + 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 e66b318c2d..bddd607fbd 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 @@ -3,7 +3,6 @@ import type { AddressInfo } from "net"; import { v4 as uuidv4 } from "uuid"; import "jest-extended"; import { PluginObjectStoreIpfs } from "@hyperledger/cactus-plugin-object-store-ipfs"; -import { create } from "ipfs-http-client"; import bodyParser from "body-parser"; import express from "express"; import { DefaultApi as ObjectStoreIpfsApi } from "@hyperledger/cactus-plugin-object-store-ipfs"; @@ -17,6 +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 { OdapLocalLog, RecoverUpdateV1Message, @@ -81,7 +81,8 @@ beforeAll(async () => { const ipfsApiUrl = await ipfsContainer.getApiUrl(); // t.comment(`Go IPFS Test Container API URL: ${ipfsApiUrl}`); - const ipfsClientOrOptions = create({ + 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 6c0c057aa2..e0414ba4e1 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 @@ -3,7 +3,6 @@ import type { AddressInfo } from "net"; import { v4 as uuidv4 } from "uuid"; import "jest-extended"; import { PluginObjectStoreIpfs } from "@hyperledger/cactus-plugin-object-store-ipfs"; -import { create } from "ipfs-http-client"; import bodyParser from "body-parser"; import express from "express"; import { DefaultApi as ObjectStoreIpfsApi } from "@hyperledger/cactus-plugin-object-store-ipfs"; @@ -20,6 +19,7 @@ import { PluginOdapGateway, } from "../../../../main/typescript/gateway/plugin-odap-gateway"; import { GoIpfsTestContainer } from "@hyperledger/cactus-test-tooling"; + import { RecoverV1Message } from "../../../../main/typescript/public-api"; import { randomInt } from "crypto"; import { checkValidRecoverMessage } from "../../../../main/typescript/gateway/recovery/recover"; @@ -73,7 +73,8 @@ beforeAll(async () => { const ipfsApiUrl = await ipfsContainer.getApiUrl(); - const ipfsClientOrOptions = create({ + 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 8ca87559e2..65e29de27d 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 @@ -2,7 +2,6 @@ import { randomInt } from "crypto"; import { v4 as uuidv4 } from "uuid"; import bodyParser from "body-parser"; import http, { Server } from "http"; -import { create } from "ipfs-http-client"; import { SHA256 } from "crypto-js"; import { IPluginOdapGatewayConstructorOptions, @@ -22,6 +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 express from "express"; import { AddressInfo } from "net"; @@ -77,7 +77,8 @@ beforeAll(async () => { const ipfsApiUrl = await ipfsContainer.getApiUrl(); - const ipfsClientOrOptions = create({ + 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 44daece193..5ade55da59 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 @@ -2,7 +2,6 @@ import { randomInt } from "crypto"; import { v4 as uuidv4 } from "uuid"; import bodyParser from "body-parser"; import http, { Server } from "http"; -import { create } from "ipfs-http-client"; import { IPluginOdapGatewayConstructorOptions, OdapMessageType, @@ -23,6 +22,8 @@ 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 express from "express"; import { AddressInfo } from "net"; @@ -79,7 +80,8 @@ beforeAll(async () => { const ipfsApiUrl = await ipfsContainer.getApiUrl(); - const ipfsClientOrOptions = create({ + 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 061dd4e7d6..d657577343 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 diff --git a/packages/cactus-plugin-persistence-ethereum/package.json b/packages/cactus-plugin-persistence-ethereum/package.json index eac4f4b477..e9e54247b0 100644 --- a/packages/cactus-plugin-persistence-ethereum/package.json +++ b/packages/cactus-plugin-persistence-ethereum/package.json @@ -65,7 +65,7 @@ "async-mutex": "0.4.0", "axios": "1.6.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 7df10af555..0d41f41f06 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 6176f11f20..1d4c5893b4 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 d8704baebe..071667770a 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 e3da513c6c..dfde9b4e85 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 e2303ebad5..29b28dd582 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 3e711c5be6..fff04a552c 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 6d01366f0c..ef096d7d0f 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 b1d07a6d57..af27802a4f 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 4736708bf7..7e5d5f7f3b 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 3d8b13ce1e..18d776e53d 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 fc17aab274..3d4a99d8f3 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 602b980405..3aac196ee4 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 7126e57caf..2c67485473 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 5c9ce83f6b..0fd85bdffa 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 e4a5040d12..7a8fed5821 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 4b39312c12..06fd24d7ae 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 31e1ccd1e1..c4515322f7 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 967d295051..784070a1c7 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 6baf9b1055..cbdbde0226 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 30cda13773..55280ea5c1 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-pkg-npm-scope.ts b/tools/custom-checks/check-pkg-npm-scope.ts index 5406a16747..a7b3e8b3a5 100644 --- a/tools/custom-checks/check-pkg-npm-scope.ts +++ b/tools/custom-checks/check-pkg-npm-scope.ts @@ -3,7 +3,6 @@ import path from "path"; import { fileURLToPath } from "url"; import { globby, Options as GlobbyOptions } from "globby"; import { RuntimeError } from "run-time-error"; -import { sortPackageJson } from "sort-package-json"; import { hasKey } from "../has-key"; // eslint-disable-next-line prettier/prettier import lernaCfg from "../../lerna.json" assert { type: "json" }; @@ -66,7 +65,7 @@ export async function checkPkgNpmScope(req: { ignore: ["**/node_modules", ...req.excludePatterns], }; - const includeGlobs = lernaCfg.packages.map(x => x.concat("/package.json")); + const includeGlobs = lernaCfg.packages.map((x) => x.concat("/package.json")); const pkgJsonPaths = await globby(includeGlobs, globbyOpts); console.log(`${TAG} Found ${pkgJsonPaths.length} package.json files.`); diff --git a/tools/generate-sbom.ts b/tools/generate-sbom.ts index e84329196a..7ee2710dbf 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 9d3676c841..7fc367a280 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 9bcb0758e7..9798fdae23 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 bb4327796b..9cdcec2858 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 318ab009df..a3c67273d5 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -170,7 +170,7 @@ "compilerOptions": { "incremental": true, "target": "ES2017", - "module": "CommonJS", + "module": "Node16", "lib": [ "es2015", "es2016", @@ -210,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 f3201a2a6c..4ace062a6a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6862,10 +6862,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 @@ -6923,12 +6924,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 @@ -6971,7 +6972,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 @@ -7189,9 +7190,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 @@ -7503,9 +7504,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 uuid: 9.0.1 web3-eth-abi: 4.0.3 @@ -7711,10 +7712,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 uuid: 9.0.1 web3: 1.6.1 @@ -7810,11 +7811,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 uuid: 9.0.1 web3: 4.1.2 @@ -7869,13 +7870,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 @@ -7911,7 +7912,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 web3-core: 1.8.1 web3-core-subscriptions: 1.8.1 @@ -7945,7 +7946,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 @@ -7975,11 +7976,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 uuid: 9.0.1 languageName: unknown @@ -8005,11 +8006,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 uuid: 9.0.1 web3: 1.6.1 @@ -8128,15 +8129,18 @@ __metadata: "@hyperledger/cactus-core": 2.0.0-alpha.2 "@hyperledger/cactus-core-api": 2.0.0-alpha.2 "@hyperledger/cactus-test-tooling": 2.0.0-alpha.2 + "@multiformats/multiaddr": 11.6.1 "@types/body-parser": 1.19.4 "@types/express": 4.17.19 axios: 1.5.1 body-parser: 1.20.2 express: 4.18.2 ipfs-core-types: 0.14.1 - ipfs-http-client: 60.0.1 - multiformats: 9.4.9 - run-time-error: 1.4.0 + 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-cjs: 1.4.0 typescript-optional: 2.0.1 uuid: 8.3.2 languageName: unknown @@ -8167,8 +8171,8 @@ __metadata: express: 4.18.2 fabric-network: 2.2.19 fs-extra: 11.1.1 - ipfs-http-client: 60.0.1 knex: 2.4.0 + kubo-rpc-client: 3.0.1 secp256k1: 4.0.3 socket.io: 4.5.4 sqlite3: 5.1.5 @@ -8202,7 +8206,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 @@ -8284,7 +8288,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 @@ -8460,9 +8464,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 @@ -8589,6 +8593,7 @@ __metadata: 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 @@ -10186,7 +10191,7 @@ __metadata: languageName: node linkType: hard -"@multiformats/multiaddr@npm:^11.1.5": +"@multiformats/multiaddr@npm:11.6.1, @multiformats/multiaddr@npm:^11.1.5": version: 11.6.1 resolution: "@multiformats/multiaddr@npm:11.6.1" dependencies: @@ -13490,6 +13495,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" @@ -29080,7 +29094,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: @@ -29108,34 +29122,7 @@ __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.0": +"ipfs-unixfs@npm:9.0.1, ipfs-unixfs@npm:^9.0.0": version: 9.0.1 resolution: "ipfs-unixfs@npm:9.0.1" dependencies: @@ -32599,6 +32586,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" @@ -35259,14 +35273,7 @@ __metadata: languageName: node linkType: hard -"multiformats@npm:9.4.9": - version: 9.4.9 - resolution: "multiformats@npm:9.4.9" - checksum: 93dec933ef5849cab1e1cf4374f08f1943905d609cce16eb4ada2742163e5d89254fec65a380a9e2e3968affa349020ffdbf91a9813d3583c45630fa9bea71c3 - languageName: node - linkType: hard - -"multiformats@npm:^11.0.0, multiformats@npm:^11.0.2": +"multiformats@npm:11.0.2, multiformats@npm:^11.0.0, multiformats@npm:^11.0.2": version: 11.0.2 resolution: "multiformats@npm:11.0.2" checksum: e587bbe709f29e42ae3c22458c960070269027d962183afc49a83b8ba26c31525e81ce2ac71082a52ba0a75e9aed4d0d044cac68d32656fdcd5cd340fb367fac @@ -43436,6 +43443,18 @@ __metadata: languageName: node linkType: hard +"socket.io-client-fixed-types@npm:4.5.4": + version: 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: b7287454638ac6d34d5773a5bb8fb08ec555499e38fa2ee9c05f6e98cd2265a9800d8512fdba6ed5363bbd95cb30f757a1da9dfe9d1d1756b297d1743d6031f3 + languageName: node + linkType: hard + "socket.io-client@npm:4.5.4": version: 4.5.4 resolution: "socket.io-client@npm:4.5.4" @@ -47113,6 +47132,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"