From d40f68bd9eaff498df8514fe7397986b5a2f865d Mon Sep 17 00:00:00 2001 From: TonyRowntree <33454202+TonyRowntree@users.noreply.github.com> Date: Thu, 17 Jun 2021 16:33:26 +0000 Subject: [PATCH] feat(core-api): plugin interface async initializer Signed-off-by: TonyRowntree <33454202+TonyRowntree@users.noreply.github.com> --- .../business-logic-plugin/carbon-accounting-plugin.ts | 4 ++++ .../business-logic-plugin/supply-chain-cactus-plugin.ts | 4 ++++ .../plugin-ledger-connector-stub.ts | 4 ++++ .../src/test/typescript/unit/plugin-registry.test.ts | 4 ++++ .../main/typescript/plugin-keychain-vault-remote-adapter.ts | 4 ++++ 5 files changed, 20 insertions(+) diff --git a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/typescript/business-logic-plugin/carbon-accounting-plugin.ts b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/typescript/business-logic-plugin/carbon-accounting-plugin.ts index 4588b13724..56870ff65b 100644 --- a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/typescript/business-logic-plugin/carbon-accounting-plugin.ts +++ b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/typescript/business-logic-plugin/carbon-accounting-plugin.ts @@ -142,6 +142,10 @@ export class CarbonAccountingPlugin return "@hyperledger/cactus-example-carbon-accounting-backend"; } + public async onPluginInit(): Promise { + return; + } + public async enrollAdminV1( req: EnrollAdminV1Request, ): Promise { diff --git a/examples/cactus-example-supply-chain-business-logic-plugin/src/main/typescript/business-logic-plugin/supply-chain-cactus-plugin.ts b/examples/cactus-example-supply-chain-business-logic-plugin/src/main/typescript/business-logic-plugin/supply-chain-cactus-plugin.ts index e0adb0b48b..18821af91f 100644 --- a/examples/cactus-example-supply-chain-business-logic-plugin/src/main/typescript/business-logic-plugin/supply-chain-cactus-plugin.ts +++ b/examples/cactus-example-supply-chain-business-logic-plugin/src/main/typescript/business-logic-plugin/supply-chain-cactus-plugin.ts @@ -162,4 +162,8 @@ export class SupplyChainCactusPlugin public getPackageName(): string { return "@hyperledger/cactus-example-supply-chain-backend"; } + + public async onPluginInit(): Promise { + return; + } } diff --git a/packages/cactus-cmd-api-server/src/test/typescript/fixtures/plugin-ledger-connector-stub/plugin-ledger-connector-stub.ts b/packages/cactus-cmd-api-server/src/test/typescript/fixtures/plugin-ledger-connector-stub/plugin-ledger-connector-stub.ts index 636c8dd15d..3030346ead 100644 --- a/packages/cactus-cmd-api-server/src/test/typescript/fixtures/plugin-ledger-connector-stub/plugin-ledger-connector-stub.ts +++ b/packages/cactus-cmd-api-server/src/test/typescript/fixtures/plugin-ledger-connector-stub/plugin-ledger-connector-stub.ts @@ -74,6 +74,10 @@ export class PluginLedgerConnectorStub return Optional.empty(); } + public async onPluginInit(): Promise { + return; + } + public async shutdown(): Promise { return; } diff --git a/packages/cactus-core/src/test/typescript/unit/plugin-registry.test.ts b/packages/cactus-core/src/test/typescript/unit/plugin-registry.test.ts index 2b88f802ab..acd544b6a2 100644 --- a/packages/cactus-core/src/test/typescript/unit/plugin-registry.test.ts +++ b/packages/cactus-core/src/test/typescript/unit/plugin-registry.test.ts @@ -26,6 +26,10 @@ test("PluginRegistry", (tMain: Test) => { throw new Error("This is a mock. Not implemented."); }, getPackageName: () => "@hyperledger/cactus-plugin-keychain-mock", + + onPluginInit: async () => { + throw new Error("not sure how this works"); + }, }; const pluginRegistry = new PluginRegistry({ diff --git a/packages/cactus-plugin-keychain-vault/src/main/typescript/plugin-keychain-vault-remote-adapter.ts b/packages/cactus-plugin-keychain-vault/src/main/typescript/plugin-keychain-vault-remote-adapter.ts index 0cb8f1a018..069fcc5a73 100644 --- a/packages/cactus-plugin-keychain-vault/src/main/typescript/plugin-keychain-vault-remote-adapter.ts +++ b/packages/cactus-plugin-keychain-vault/src/main/typescript/plugin-keychain-vault-remote-adapter.ts @@ -149,4 +149,8 @@ export class PluginKeychainVaultRemoteAdapter public getPackageName(): string { return `@hyperledger/cactus-plugin-keychain-vault`; } + + public async onPluginInit(): Promise { + return; + } }