From 5402d421c8a2af1197b98d694f27bf8f446cd742 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Guti=C3=A9rrez?= Date: Tue, 19 Mar 2019 13:01:28 +0100 Subject: [PATCH] Remove default exports of Ocean modules. --- src/ocean/Ocean.ts | 19 ++++++------------- src/ocean/OceanAccounts.ts | 2 +- src/ocean/OceanAgreements.ts | 4 ++-- src/ocean/OceanAgreementsConditions.ts | 2 +- src/ocean/OceanAssets.ts | 4 ++-- src/ocean/OceanSecretStore.ts | 2 +- src/ocean/OceanTokens.ts | 2 +- src/squid.ts | 2 +- test/keeper/ContractBase.test.ts | 2 +- test/keeper/DIDRegistry.test.ts | 2 +- test/keeper/Event.test.ts | 2 +- test/keeper/EventListener.test.ts | 2 +- test/ocean/Account.test.ts | 2 +- test/ocean/Ocean.test.ts | 2 +- test/ocean/OceanAccounts.test.ts | 2 +- test/ocean/OceanSecretStore.test.ts | 4 ++-- test/ocean/ServiceAgreement.test.ts | 2 +- 17 files changed, 25 insertions(+), 32 deletions(-) diff --git a/src/ocean/Ocean.ts b/src/ocean/Ocean.ts index d715ee9..019597a 100644 --- a/src/ocean/Ocean.ts +++ b/src/ocean/Ocean.ts @@ -1,10 +1,10 @@ import deprecated from "deprecated-decorator" -import OceanAccounts from "./OceanAccounts" -import OceanAgreements from "./OceanAgreements" -import OceanAssets from "./OceanAssets" -import OceanSecretStore from "./OceanSecretStore" -import OceanTokens from "./OceanTokens" +import { OceanAccounts } from "./OceanAccounts" +import { OceanAgreements } from "./OceanAgreements" +import { OceanAssets } from "./OceanAssets" +import { OceanSecretStore } from "./OceanSecretStore" +import { OceanTokens } from "./OceanTokens" import AquariusProvider from "../aquarius/AquariusProvider" import { SearchQuery } from "../aquarius/query/SearchQuery" @@ -27,7 +27,7 @@ import EventListener from "../keeper/EventListener" /** * Main interface for Ocean Protocol. */ -export default class Ocean { +export class Ocean { /** * Returns the instance of Ocean. @@ -35,13 +35,6 @@ export default class Ocean { * @return {Promise} */ public static async getInstance(config: Config): Promise { - // Must be defined on instance level, right now, calling getInstance twice is going to rewrite that - // WARN: is called on ConfigProvider.setConfig too (to work fine on test) - Logger.setLevel( - typeof config.verbose !== "number" - ? (config.verbose ? LogLevel.Log : LogLevel.None) - : config.verbose as LogLevel, - ) ConfigProvider.setConfig(config) if (!Ocean.instance) { diff --git a/src/ocean/OceanAccounts.ts b/src/ocean/OceanAccounts.ts index a1a64c6..bde3345 100644 --- a/src/ocean/OceanAccounts.ts +++ b/src/ocean/OceanAccounts.ts @@ -5,7 +5,7 @@ import Account from "./Account" /** * Account submodule of Ocean Protocol. */ -export default class OceanAccounts { +export class OceanAccounts { /** * Returns the instance of OceanAccounts. diff --git a/src/ocean/OceanAgreements.ts b/src/ocean/OceanAgreements.ts index cc65c1a..d5c1ab4 100644 --- a/src/ocean/OceanAgreements.ts +++ b/src/ocean/OceanAgreements.ts @@ -7,7 +7,7 @@ import ServiceAgreement from "./ServiceAgreements/ServiceAgreement" import { Keeper } from "../keeper/Keeper" import { zeroX, didPrefixed } from "../utils" -import OceanAgreementsConditions from "./OceanAgreementsConditions" +import { OceanAgreementsConditions } from "./OceanAgreementsConditions" export interface AgreementPrepareResult { agreementId: string @@ -17,7 +17,7 @@ export interface AgreementPrepareResult { /** * Agreements submodule of Ocean Protocol. */ -export default class OceanAgreements { +export class OceanAgreements { /** * Returns the instance of OceanAgreements. diff --git a/src/ocean/OceanAgreementsConditions.ts b/src/ocean/OceanAgreementsConditions.ts index 68ade1a..c30589d 100644 --- a/src/ocean/OceanAgreementsConditions.ts +++ b/src/ocean/OceanAgreementsConditions.ts @@ -4,7 +4,7 @@ import Account from "./Account" /** * Agreements Conditions submodule of Ocean Protocol. */ -export default class OceanAgreementsConditions { +export class OceanAgreementsConditions { /** * Returns the instance of OceanAgreementsConditions. diff --git a/src/ocean/OceanAssets.ts b/src/ocean/OceanAssets.ts index df91987..52be535 100644 --- a/src/ocean/OceanAssets.ts +++ b/src/ocean/OceanAssets.ts @@ -11,12 +11,12 @@ import SecretStoreProvider from "../secretstore/SecretStoreProvider" import { Logger, fillConditionsWithDDO } from "../utils" import Account from "./Account" import DID from "./DID" -import OceanAgreements from "./OceanAgreements" +import { OceanAgreements } from "./OceanAgreements" /** * Assets submodule of Ocean Protocol. */ -export default class OceanAssets { +export class OceanAssets { /** * Returns the instance of OceanAssets. diff --git a/src/ocean/OceanSecretStore.ts b/src/ocean/OceanSecretStore.ts index abb88bf..202847d 100644 --- a/src/ocean/OceanSecretStore.ts +++ b/src/ocean/OceanSecretStore.ts @@ -4,7 +4,7 @@ import Account from "./Account" /** * SecretStore submodule of Ocean Protocol. */ -export default class OceanSecretStore { +export class OceanSecretStore { /** * Returns the instance of OceanSecretStore. diff --git a/src/ocean/OceanTokens.ts b/src/ocean/OceanTokens.ts index ffa7cbf..3765792 100644 --- a/src/ocean/OceanTokens.ts +++ b/src/ocean/OceanTokens.ts @@ -4,7 +4,7 @@ import Account from "./Account" /** * Tokens submodule of Ocean Protocol. */ -export default class OceanTokens { +export class OceanTokens { /** * Returns the instance of OceanTokens. diff --git a/src/squid.ts b/src/squid.ts index 1de9300..67b842f 100644 --- a/src/squid.ts +++ b/src/squid.ts @@ -1,7 +1,7 @@ import Config from "./models/Config" import Account from "./ocean/Account" import DID from "./ocean/DID" -import Ocean from "./ocean/Ocean" +import { Ocean } from "./ocean/Ocean" import Logger from "./utils/Logger" import WebServiceConnectorProvider from "./utils/WebServiceConnectorProvider" import Keeper from "./keeper/Keeper" diff --git a/test/keeper/ContractBase.test.ts b/test/keeper/ContractBase.test.ts index 296355b..bae3e1c 100644 --- a/test/keeper/ContractBase.test.ts +++ b/test/keeper/ContractBase.test.ts @@ -1,7 +1,7 @@ import {assert} from "chai" import ConfigProvider from "../../src/ConfigProvider" import Account from "../../src/ocean/Account" -import Ocean from "../../src/ocean/Ocean" +import { Ocean } from "../../src/ocean/Ocean" import config from "../config" import ContractBaseMock from "../mocks/ContractBase.Mock" import TestContractHandler from "./TestContractHandler" diff --git a/test/keeper/DIDRegistry.test.ts b/test/keeper/DIDRegistry.test.ts index 928f22d..c157499 100644 --- a/test/keeper/DIDRegistry.test.ts +++ b/test/keeper/DIDRegistry.test.ts @@ -2,7 +2,7 @@ import {assert} from "chai" import ConfigProvider from "../../src/ConfigProvider" import DIDRegistry from "../../src/keeper/contracts/DIDRegistry" import Account from "../../src/ocean/Account" -import Ocean from "../../src/ocean/Ocean" +import { Ocean } from "../../src/ocean/Ocean" import { generateId } from "../../src/utils/GeneratorHelpers" import Logger from "../../src/utils/Logger" import config from "../config" diff --git a/test/keeper/Event.test.ts b/test/keeper/Event.test.ts index cd4311e..9d2c6c3 100644 --- a/test/keeper/Event.test.ts +++ b/test/keeper/Event.test.ts @@ -3,7 +3,7 @@ import ConfigProvider from "../../src/ConfigProvider" import EventListener from "../../src/keeper/EventListener" import Keeper from "../../src/keeper/Keeper" import Account from "../../src/ocean/Account" -import Ocean from "../../src/ocean/Ocean" +import { Ocean } from "../../src/ocean/Ocean" import config from "../config" import TestContractHandler from "./TestContractHandler" diff --git a/test/keeper/EventListener.test.ts b/test/keeper/EventListener.test.ts index bc3eb88..01c0ed0 100644 --- a/test/keeper/EventListener.test.ts +++ b/test/keeper/EventListener.test.ts @@ -3,7 +3,7 @@ import ConfigProvider from "../../src/ConfigProvider" import EventListener from "../../src/keeper/EventListener" import Keeper from "../../src/keeper/Keeper" import Account from "../../src/ocean/Account" -import Ocean from "../../src/ocean/Ocean" +import { Ocean } from "../../src/ocean/Ocean" import config from "../config" import TestContractHandler from "./TestContractHandler" diff --git a/test/ocean/Account.test.ts b/test/ocean/Account.test.ts index b07b10e..ae3d2b9 100644 --- a/test/ocean/Account.test.ts +++ b/test/ocean/Account.test.ts @@ -2,7 +2,7 @@ import {assert} from "chai" import ConfigProvider from "../../src/ConfigProvider" import Web3Provider from "../../src/keeper/Web3Provider" import Account from "../../src/ocean/Account" -import Ocean from "../../src/ocean/Ocean" +import { Ocean } from "../../src/ocean/Ocean" import config from "../config" import TestContractHandler from "../keeper/TestContractHandler" diff --git a/test/ocean/Ocean.test.ts b/test/ocean/Ocean.test.ts index e4cf9f1..3040d96 100644 --- a/test/ocean/Ocean.test.ts +++ b/test/ocean/Ocean.test.ts @@ -8,7 +8,7 @@ import ConfigProvider from "../../src/ConfigProvider" import { DDO } from "../../src/ddo/DDO" import { Service } from "../../src/ddo/Service" import Account from "../../src/ocean/Account" -import Ocean from "../../src/ocean/Ocean" +import { Ocean } from "../../src/ocean/Ocean" import SecretStoreProvider from "../../src/secretstore/SecretStoreProvider" import * as signatureHelpers from "../../src/utils/SignatureHelpers" import WebServiceConnectorProvider from "../../src/utils/WebServiceConnectorProvider" diff --git a/test/ocean/OceanAccounts.test.ts b/test/ocean/OceanAccounts.test.ts index ddd0081..b3a2c4e 100644 --- a/test/ocean/OceanAccounts.test.ts +++ b/test/ocean/OceanAccounts.test.ts @@ -2,7 +2,7 @@ import { assert, /*expect,*/ spy, use } from "chai" import * as spies from "chai-spies" import Account from "../../src/ocean/Account" -import OceanAccounts from "../../src/ocean/OceanAccounts" +import { OceanAccounts } from "../../src/ocean/OceanAccounts" use(spies) diff --git a/test/ocean/OceanSecretStore.test.ts b/test/ocean/OceanSecretStore.test.ts index 5b32ed0..c698181 100644 --- a/test/ocean/OceanSecretStore.test.ts +++ b/test/ocean/OceanSecretStore.test.ts @@ -3,8 +3,8 @@ import * as spies from "chai-spies" import ConfigProvider from "../../src/ConfigProvider" import Account from "../../src/ocean/Account" -import Ocean from "../../src/ocean/Ocean" -import OceanSecretStore from "../../src/ocean/OceanSecretStore" +import { Ocean } from "../../src/ocean/Ocean" +import { OceanSecretStore } from "../../src/ocean/OceanSecretStore" import SecretStoreProvider from "../../src/secretstore/SecretStoreProvider" import config from "../config" diff --git a/test/ocean/ServiceAgreement.test.ts b/test/ocean/ServiceAgreement.test.ts index 54bde3a..7306c29 100644 --- a/test/ocean/ServiceAgreement.test.ts +++ b/test/ocean/ServiceAgreement.test.ts @@ -3,7 +3,7 @@ import ConfigProvider from "../../src/ConfigProvider" import { DDO } from "../../src/ddo/DDO" import Account from "../../src/ocean/Account" import DID from "../../src/ocean/DID" -import Ocean from "../../src/ocean/Ocean" +import { Ocean } from "../../src/ocean/Ocean" import ServiceAgreement from "../../src/ocean/ServiceAgreements/ServiceAgreement" import { generateId } from "../../src/utils/GeneratorHelpers" import config from "../config"