Skip to content

Commit

Permalink
fix(cmd-api-server): plugins interfere with API server deps hyperledg…
Browse files Browse the repository at this point in the history
…er-cacti#1192

Migrates to the live-plugin-manager package to install plugins
instead of doing it via vanilla npm which was causing problems
with conflicting dependency versions where the API server would
want semver 7.x and one of the plugins (through some transient
dependency of the plugin itself) would install semver 5.x which
would then cause the API server to break down at runtime due to
the breaking changes between semver 7 and 5.

The hope with the new live-plugin-manager package is that using
this will provide sufficient isolation so that these kind of issues
are non-existent and also that it does not introduce other different
types of issues stemming from exactly said isolation. With that said
if isolation problems do occur we'll have to fix that anyway because
the plugins should not depend on the API server and vica versa.

Fixes hyperledger-cacti#1192

Depends on hyperledger-cacti#1203

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
  • Loading branch information
petermetz authored and elenaizaguirre committed Sep 20, 2021
1 parent 63e639e commit 253b21f
Show file tree
Hide file tree
Showing 289 changed files with 1,021 additions and 844 deletions.
1 change: 1 addition & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"DockerOde",
"ealen",
"ecparams",
"elenaizaguirre",
"Errorf",
"escc",
"execa",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/hyperledger/cactus.git"
"url": "git+https://github.com/elenaizaguirre/cactus.git"
},
"keywords": [
"Hyperledger",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node

import { ConfigService } from "@hyperledger/cactus-cmd-api-server";
import { LoggerProvider } from "@hyperledger/cactus-common";
import { ConfigService } from "@elenaizaguirre/cactus-cmd-api-server";
import { LoggerProvider } from "@elenaizaguirre/cactus-common";
import {
ICarbonAccountingAppOptions,
CarbonAccountingApp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,37 @@ import { Server as SecureServer } from "https";
import { v4 as uuidv4 } from "uuid";
import exitHook, { IAsyncExitHookDoneCallback } from "async-exit-hook";

import { PluginRegistry } from "@hyperledger/cactus-core";
import { PluginRegistry } from "@elenaizaguirre/cactus-core";

import {
LogLevelDesc,
Logger,
LoggerProvider,
Servers,
} from "@hyperledger/cactus-common";
} from "@elenaizaguirre/cactus-common";

import {
ApiServer,
ConfigService,
Configuration,
ICactusApiServerOptions,
} from "@hyperledger/cactus-cmd-api-server";
} from "@elenaizaguirre/cactus-cmd-api-server";

import { PluginKeychainMemory } from "@hyperledger/cactus-plugin-keychain-memory";
import { PluginKeychainMemory } from "@elenaizaguirre/cactus-plugin-keychain-memory";

import {
PluginLedgerConnectorFabric,
DefaultApi as FabricApi,
DefaultEventHandlerStrategy,
} from "@hyperledger/cactus-plugin-ledger-connector-fabric";
} from "@elenaizaguirre/cactus-plugin-ledger-connector-fabric";

import { CarbonAccountingPlugin } from "@hyperledger/cactus-example-carbon-accounting-business-logic-plugin";
import { CarbonAccountingPlugin } from "@elenaizaguirre/cactus-example-carbon-accounting-business-logic-plugin";

import {
PluginLedgerConnectorXdai,
DefaultApi as XdaiApi,
Web3SigningCredentialType,
} from "@hyperledger/cactus-plugin-ledger-connector-xdai";
} from "@elenaizaguirre/cactus-plugin-ledger-connector-xdai";

import { CarbonAccountingAppDummyInfrastructure } from "./infrastructure/carbon-accounting-app-dummy-infrastructure";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ import {
Checks,
LogLevelDesc,
LoggerProvider,
} from "@hyperledger/cactus-common";
} from "@elenaizaguirre/cactus-common";
import {
PluginLedgerConnectorXdai,
Web3SigningCredentialType,
} from "@hyperledger/cactus-plugin-ledger-connector-xdai";
} from "@elenaizaguirre/cactus-plugin-ledger-connector-xdai";
import {
FabricTestLedgerV1,
OpenEthereumTestLedger,
} from "@hyperledger/cactus-test-tooling";
import { PluginKeychainMemory } from "@hyperledger/cactus-plugin-keychain-memory";
} from "@elenaizaguirre/cactus-test-tooling";
import { PluginKeychainMemory } from "@elenaizaguirre/cactus-plugin-keychain-memory";

import DaoTokenContract from "../../json/generated/src/main/solidity/net-emissions-token-network/Governance/DAOToken.sol/DAOToken.json";
import GovernorContract from "../../json/generated/src/main/solidity/net-emissions-token-network/Governance/Governor.sol/Governor.json";
Expand All @@ -27,7 +27,7 @@ import {
DeploymentTargetOrgFabric2x,
FileBase64,
PluginLedgerConnectorFabric,
} from "@hyperledger/cactus-plugin-ledger-connector-fabric";
} from "@elenaizaguirre/cactus-plugin-ledger-connector-fabric";
import {
ICarbonAccountingFabricContractDeploymentInfo,
ICarbonAccountingXdaiContractDeploymentInfo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ import {
ConfigService,
Configuration,
IAuthorizationConfig,
} from "@hyperledger/cactus-cmd-api-server";
} from "@elenaizaguirre/cactus-cmd-api-server";

import {
LoggerProvider,
LogLevelDesc,
Servers,
} from "@hyperledger/cactus-common";
} from "@elenaizaguirre/cactus-common";

import { pruneDockerAllIfGithubAction } from "@hyperledger/cactus-test-tooling";
import { pruneDockerAllIfGithubAction } from "@elenaizaguirre/cactus-test-tooling";

import {
AuthzScope,
DefaultApi as CarbonAccountingApi,
} from "@hyperledger/cactus-example-carbon-accounting-business-logic-plugin";
} from "@elenaizaguirre/cactus-example-carbon-accounting-business-logic-plugin";

import {
CarbonAccountingApp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/hyperledger/cactus.git"
"url": "git+https://github.com/elenaizaguirre/cactus.git"
},
"keywords": [
"Hyperledger",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,27 @@ import {
Checks,
LogLevelDesc,
LoggerProvider,
} from "@hyperledger/cactus-common";
} from "@elenaizaguirre/cactus-common";

import {
ICactusPlugin,
IPluginWebService,
IWebServiceEndpoint,
} from "@hyperledger/cactus-core-api";
} from "@elenaizaguirre/cactus-core-api";

import { PluginRegistry } from "@hyperledger/cactus-core";
import { PluginRegistry } from "@elenaizaguirre/cactus-core";

import {
DefaultApi as XdaiApi,
Web3SigningCredential,
} from "@hyperledger/cactus-plugin-ledger-connector-xdai";
} from "@elenaizaguirre/cactus-plugin-ledger-connector-xdai";

import {
DefaultApi as FabricApi,
PluginLedgerConnectorFabric,
} from "@hyperledger/cactus-plugin-ledger-connector-fabric";
} from "@elenaizaguirre/cactus-plugin-ledger-connector-fabric";

import { PluginKeychainMemory } from "@hyperledger/cactus-plugin-keychain-memory";
import { PluginKeychainMemory } from "@elenaizaguirre/cactus-plugin-keychain-memory";

import {
ICarbonAccountingFabricContractDeploymentInfo,
Expand Down Expand Up @@ -145,7 +145,7 @@ export class CarbonAccountingPlugin
}

public getPackageName(): string {
return "@hyperledger/cactus-example-carbon-accounting-backend";
return "@elenaizaguirre/cactus-example-carbon-accounting-backend";
}

public async onPluginInit(): Promise<unknown> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import {
LogLevelDesc,
LoggerProvider,
IAsyncProvider,
} from "@hyperledger/cactus-common";
} from "@elenaizaguirre/cactus-common";
import {
IEndpointAuthzOptions,
IExpressRequestHandler,
IWebServiceEndpoint,
} from "@hyperledger/cactus-core-api";
import { registerWebServiceEndpoint } from "@hyperledger/cactus-core";
} from "@elenaizaguirre/cactus-core-api";
import { registerWebServiceEndpoint } from "@elenaizaguirre/cactus-core";

import { DaoTokenGetAllowanceRequest } from "../../../generated/openapi/typescript-axios";
import { CarbonAccountingPlugin } from "../../carbon-accounting-plugin";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import {
LogLevelDesc,
LoggerProvider,
IAsyncProvider,
} from "@hyperledger/cactus-common";
} from "@elenaizaguirre/cactus-common";
import {
IEndpointAuthzOptions,
IExpressRequestHandler,
IWebServiceEndpoint,
} from "@hyperledger/cactus-core-api";
import { registerWebServiceEndpoint } from "@hyperledger/cactus-core";
} from "@elenaizaguirre/cactus-core-api";
import { registerWebServiceEndpoint } from "@elenaizaguirre/cactus-core";

import { EnrollAdminV1Request } from "../../../generated/openapi/typescript-axios";
import { CarbonAccountingPlugin } from "../../carbon-accounting-plugin";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/hyperledger/cactus.git"
"url": "git+https://github.com/elenaizaguirre/cactus.git"
},
"keywords": [
"Hyperledger",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import { StatusBar } from "@ionic-native/status-bar/ngx";

import { AppComponent } from "./app.component";
import { AppRoutingModule } from "./app-routing.module";
import { Logger, LoggerProvider } from "@hyperledger/cactus-common";
import { Configuration } from "@hyperledger/cactus-core-api";
import { Logger, LoggerProvider } from "@elenaizaguirre/cactus-common";
import { Configuration } from "@elenaizaguirre/cactus-core-api";
import {
BESU_DEMO_LEDGER_ID,
CACTUS_API_URL,
FABRIC_DEMO_LEDGER_ID,
} from "src/constants";
import { ApiClient } from "@hyperledger/cactus-api-client";
import { ApiClient } from "@elenaizaguirre/cactus-api-client";

LoggerProvider.setLogLevel("TRACE");

Expand Down
2 changes: 1 addition & 1 deletion examples/cactus-example-supply-chain-backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/hyperledger/cactus.git"
"url": "git+https://github.com/elenaizaguirre/cactus.git"
},
"keywords": [
"Hyperledger",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ import {
Checks,
LogLevelDesc,
LoggerProvider,
} from "@hyperledger/cactus-common";
import { PluginRegistry } from "@hyperledger/cactus-core";
import { PluginLedgerConnectorBesu } from "@hyperledger/cactus-plugin-ledger-connector-besu";
import { PluginKeychainMemory } from "@hyperledger/cactus-plugin-keychain-memory";
} from "@elenaizaguirre/cactus-common";
import { PluginRegistry } from "@elenaizaguirre/cactus-core";
import { PluginLedgerConnectorBesu } from "@elenaizaguirre/cactus-plugin-ledger-connector-besu";
import { PluginKeychainMemory } from "@elenaizaguirre/cactus-plugin-keychain-memory";
import {
PluginLedgerConnectorQuorum,
Web3SigningCredentialType,
} from "@hyperledger/cactus-plugin-ledger-connector-quorum";
} from "@elenaizaguirre/cactus-plugin-ledger-connector-quorum";
import {
BesuTestLedger,
FabricTestLedgerV1,
QuorumTestLedger,
} from "@hyperledger/cactus-test-tooling";
} from "@elenaizaguirre/cactus-test-tooling";

import BambooHarvestRepositoryJSON from "../../json/generated/BambooHarvestRepository.json";
import BookshelfRepositoryJSON from "../../json/generated/BookshelfRepository.json";
Expand All @@ -26,14 +26,14 @@ import {
ISupplyChainContractDeploymentInfo,
IFabricContractDeployment,
// OrgEnv,
} from "@hyperledger/cactus-example-supply-chain-business-logic-plugin";
} from "@elenaizaguirre/cactus-example-supply-chain-business-logic-plugin";
import {
PluginLedgerConnectorFabric,
DefaultEventHandlerStrategy,
} from "@hyperledger/cactus-plugin-ledger-connector-fabric";
} from "@elenaizaguirre/cactus-plugin-ledger-connector-fabric";
import { DiscoveryOptions } from "fabric-network";
import { SHIPMENT_CONTRACT_GO_SOURCE } from "../../go/shipment";
import { IPluginKeychain } from "@hyperledger/cactus-core-api";
import { IPluginKeychain } from "@elenaizaguirre/cactus-core-api";

export const org1Env = {
CORE_PEER_LOCALMSPID: "Org1MSP",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node

import { ConfigService } from "@hyperledger/cactus-cmd-api-server";
import { LoggerProvider } from "@hyperledger/cactus-common";
import { ConfigService } from "@elenaizaguirre/cactus-cmd-api-server";
import { LoggerProvider } from "@elenaizaguirre/cactus-common";
import { ISupplyChainAppOptions, SupplyChainApp } from "./supply-chain-app";

export async function launchApp(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
IPluginKeychain,
Ledger,
LedgerType,
} from "@hyperledger/cactus-core-api";
} from "@elenaizaguirre/cactus-core-api";

import { PluginRegistry } from "@hyperledger/cactus-core";

Expand All @@ -22,29 +22,32 @@ import {
Logger,
LoggerProvider,
Servers,
} from "@hyperledger/cactus-common";
} from "@elenaizaguirre/cactus-common";

import { ApiServer, ConfigService } from "@hyperledger/cactus-cmd-api-server";
import {
ApiServer,
ConfigService,
} from "@elenaizaguirre/cactus-cmd-api-server";

import { PluginConsortiumManual } from "@hyperledger/cactus-plugin-consortium-manual";
import { PluginKeychainMemory } from "@hyperledger/cactus-plugin-keychain-memory";
import { PluginConsortiumManual } from "@elenaizaguirre/cactus-plugin-consortium-manual";
import { PluginKeychainMemory } from "@elenaizaguirre/cactus-plugin-keychain-memory";

import {
PluginLedgerConnectorQuorum,
Web3SigningCredentialType,
DefaultApi as QuorumApi,
} from "@hyperledger/cactus-plugin-ledger-connector-quorum";
} from "@elenaizaguirre/cactus-plugin-ledger-connector-quorum";

import {
PluginLedgerConnectorBesu,
DefaultApi as BesuApi,
} from "@hyperledger/cactus-plugin-ledger-connector-besu";
} from "@elenaizaguirre/cactus-plugin-ledger-connector-besu";

import {
PluginLedgerConnectorFabric,
DefaultApi as FabricApi,
DefaultEventHandlerStrategy,
} from "@hyperledger/cactus-plugin-ledger-connector-fabric";
} from "@elenaizaguirre/cactus-plugin-ledger-connector-fabric";

import {
SupplyChainAppDummyInfrastructure,
Expand All @@ -53,8 +56,8 @@ import {
import {
Configuration,
DefaultApi as SupplyChainApi,
} from "@hyperledger/cactus-example-supply-chain-business-logic-plugin";
import { SupplyChainCactusPlugin } from "@hyperledger/cactus-example-supply-chain-business-logic-plugin";
} from "@elenaizaguirre/cactus-example-supply-chain-business-logic-plugin";
import { SupplyChainCactusPlugin } from "@elenaizaguirre/cactus-example-supply-chain-business-logic-plugin";
import { DiscoveryOptions } from "fabric-network";

export interface ISupplyChainAppOptions {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import test, { Test } from "tape-promise/tape";
import { LogLevelDesc } from "@hyperledger/cactus-common";
import { pruneDockerAllIfGithubAction } from "@hyperledger/cactus-test-tooling";
import { AuthorizationProtocol } from "@hyperledger/cactus-cmd-api-server";
import { IAuthorizationConfig } from "@hyperledger/cactus-cmd-api-server";
import { ConfigService } from "@hyperledger/cactus-cmd-api-server";
import { LogLevelDesc } from "@elenaizaguirre/cactus-common";
import { pruneDockerAllIfGithubAction } from "@elenaizaguirre/cactus-test-tooling";
import { AuthorizationProtocol } from "@elenaizaguirre/cactus-cmd-api-server";
import { IAuthorizationConfig } from "@elenaizaguirre/cactus-cmd-api-server";
import { ConfigService } from "@elenaizaguirre/cactus-cmd-api-server";

import * as publicApi from "../../../main/typescript/public-api";
import { ISupplyChainAppOptions } from "../../../main/typescript/public-api";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import path from "path";
import { spawn } from "child_process";
import test, { Test } from "tape-promise/tape";
import { LogLevelDesc } from "@hyperledger/cactus-common";
import { pruneDockerAllIfGithubAction } from "@hyperledger/cactus-test-tooling";
import { LogLevelDesc } from "@elenaizaguirre/cactus-common";
import { pruneDockerAllIfGithubAction } from "@elenaizaguirre/cactus-test-tooling";
import * as publicApi from "../../../main/typescript/public-api";

const testCase =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/hyperledger/cactus.git"
"url": "git+https://github.com/elenaizaguirre/cactus.git"
},
"keywords": [
"Hyperledger",
Expand Down
Loading

0 comments on commit 253b21f

Please sign in to comment.