Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(esm): change imports to esm compatible #3018

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
28 changes: 14 additions & 14 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -407,11 +407,11 @@ jobs:
tool: 'benchmarkjs'
output-file-path: .tmp/benchmark-results/cmd-api-server/run-cmd-api-server-benchmark.ts.log
github-token: ${{ secrets.GITHUB_TOKEN }}

# Only push the benchmark results to gh-pages website if we are running on the main branch
# We do not want to clutter the benchmark results with intermediate results from PRs that could be drafts
auto-push: ${{ github.ref == 'refs/heads/main' }}

# Show alert with commit comment on detecting possible performance regression
alert-threshold: '5%'
comment-on-alert: true
Expand Down Expand Up @@ -1086,7 +1086,7 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
- run: npm run configure
- run: yarn ts-node ./packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/deploy-cc-from-javascript-source.test.ts
- run: yarn tsx ./packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/deploy-cc-from-javascript-source.test.ts

plugin-ledger-connector-fabric-2:
continue-on-error: false
Expand Down Expand Up @@ -1119,7 +1119,7 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
- run: npm run configure
- run: yarn ts-node ./packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/deploy-cc-from-typescript-source.test.ts
- run: yarn tsx ./packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/deploy-cc-from-typescript-source.test.ts

plugin-ledger-connector-fabric-3:
needs:
Expand Down Expand Up @@ -1152,7 +1152,7 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
- run: npm run configure
- run: yarn ts-node ./packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/deploy-lock-asset.test.ts
- run: yarn tsx ./packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/deploy-lock-asset.test.ts

plugin-ledger-connector-fabric-4:
continue-on-error: false
Expand Down Expand Up @@ -1185,7 +1185,7 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
- run: npm run configure
- run: yarn ts-node ./packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/openapi/openapi-validation.test.ts
- run: yarn tsx ./packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/openapi/openapi-validation.test.ts

plugin-ledger-connector-fabric-5:
continue-on-error: false
Expand Down Expand Up @@ -1218,7 +1218,7 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
- run: npm run configure
- run: yarn ts-node ./packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/openapi/openapi-validation-go.test.ts
- run: yarn tsx ./packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/openapi/openapi-validation-go.test.ts

plugin-ledger-connector-fabric-6:
continue-on-error: false
Expand Down Expand Up @@ -1251,7 +1251,7 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
- run: npm run configure
- run: yarn ts-node ./packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/unit/identity-internal-crypto-utils.test.ts
- run: yarn tsx ./packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/unit/identity-internal-crypto-utils.test.ts

plugin-ledger-connector-fabric-7:
continue-on-error: false
Expand Down Expand Up @@ -1284,7 +1284,7 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
- run: npm run configure
- run: yarn ts-node ./packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/identity-client.test.ts
- run: yarn tsx ./packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/identity-client.test.ts

plugin-ledger-connector-fabric-8:
continue-on-error: false
Expand Down Expand Up @@ -1317,7 +1317,7 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
- run: npm run configure
- run: yarn ts-node ./packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/run-transaction-with-identities.test.ts
- run: yarn tsx ./packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/run-transaction-with-identities.test.ts

plugin-ledger-connector-fabric-9:
continue-on-error: false
Expand Down Expand Up @@ -1350,7 +1350,7 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
- run: npm run configure
- run: yarn ts-node ./packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/obtain-profiles.test.ts
- run: yarn tsx ./packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/obtain-profiles.test.ts

plugin-ledger-connector-fabric-10:
needs:
Expand Down Expand Up @@ -1383,7 +1383,7 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
- run: npm run configure
- run: yarn ts-node ./packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/deploy-cc-from-golang-source.test.ts
- run: yarn tsx ./packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/deploy-cc-from-golang-source.test.ts

plugin-ledger-connector-fabric-11:
continue-on-error: false
Expand Down Expand Up @@ -1416,7 +1416,7 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
- run: npm run configure
- run: yarn ts-node ./packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/add-orgs.test.ts
- run: yarn tsx ./packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/add-orgs.test.ts

plugin-ledger-connector-fabric-12:
continue-on-error: false
Expand Down Expand Up @@ -1449,7 +1449,7 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
- run: npm run configure
- run: yarn ts-node ./packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/run-transaction-with-ws-ids.test.ts
- run: yarn tsx ./packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/run-transaction-with-ws-ids.test.ts

cactus-plugin-ledger-connector-go-ethereum-socketio:
continue-on-error: false
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ logs/
jspm_packages/
generated-sources/
coverage/
.tap/

# Optional npm cache directory
.npm
Expand Down
7 changes: 5 additions & 2 deletions .taprc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
no-check-coverage: true
# vim: set filetype=yaml :
disable-coverage: true
node-arg:
- --max-old-space-size=4096
jobs: 1
timeout: 3600
ts: true
files:
- ./packages/cactus-plugin-keychain-aws-sm/src/test/typescript/integration/openapi/openapi-validation.test.ts
- ./packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/deploy-lock-asset.test.ts
Expand Down Expand Up @@ -120,3 +120,6 @@ files:
- ./examples/cactus-example-carbon-accounting-backend/src/test/typescript/integration/admin-enroll-v1-endpoint.test.ts
- ./examples/cactus-example-supply-chain-backend/src/test/typescript/integration/supply-chain-backend-api-calls.test.ts
- ./examples/cactus-example-supply-chain-backend/src/test/typescript/integration/supply-chain-cli-via-npm-script.test.ts
plugin:
- "!@tapjs/typescript"
- "@tapjs/tsx"
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { LoggerProvider } from "@hyperledger/cactus-common";
import {
ICarbonAccountingAppOptions,
CarbonAccountingApp,
} from "./carbon-accounting-app";
} from "./carbon-accounting-app.js";

export async function launchApp(): Promise<void> {
const configService = new ConfigService();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import {
Web3SigningCredentialType,
} from "@hyperledger/cactus-plugin-ledger-connector-xdai";

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

export interface ICarbonAccountingAppOptions {
logLevel?: LogLevelDesc;
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "./public-api";
export * from "./public-api.js";
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { CarbonAccountingApp } from "./carbon-accounting-app";
export { launchApp } from "./carbon-accounting-app-cli";
export { CarbonAccountingApp } from "./carbon-accounting-app.js";
export { launchApp } from "./carbon-accounting-app-cli.js";
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import {
import {
CarbonAccountingApp,
ICarbonAccountingAppOptions,
} from "../../../main/typescript/carbon-accounting-app";
} from "../../../main/typescript/carbon-accounting-app.js";

const testCase = "can enroll new admin users onto the Fabric org";
const logLevel: LogLevelDesc = "TRACE";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as apiSurface from "../../../main/typescript/public-api";
import * as apiSurface from "../../../main/typescript/public-api.js";
import "jest-extended";

test("Library can be loaded", async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as apiSurface from "../../../main/typescript/public-api";
import * as apiSurface from "../../../main/typescript/public-api.js";
import "jest-extended";

test("Library can be loaded", async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { ChaincodeResponse, ChaincodeStub, Shim } from "fabric-shim";
import { EmissionsRecordInterface } from "./lib/emissions";
import { EmissionsRecordInterface } from "./lib/emissions.js";

import { EmissionsRecordContract } from "./lib/emissionsRecordContract";
import { UtilityEmissionsFactorInterface } from "./lib/utilityEmissionsFactor";
import { EmissionsRecordContract } from "./lib/emissionsRecordContract.js";
import { UtilityEmissionsFactorInterface } from "./lib/utilityEmissionsFactor.js";
import {
DivisionsInterface,
UtilityLookupItemInterface,
} from "./lib/utilityLookupItem";
} from "./lib/utilityLookupItem.js";
import {
ErrInvalidArgument,
ErrInvalidNumberOfArgument,
ErrMethodNotSupported,
MsgSuccess,
} from "./util/const";
import { logger, stringToBytes } from "./util/util";
} from "./util/const.js";
import { logger, stringToBytes } from "./util/util.js";

export class EmissionsChaincode {
private methods: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
SPDX-License-Identifier: Apache-2.0
*/

import { ErrInvalidDateFormat, ErrUnknownUOM } from "../util/const";
import { UtilityEmissionsFactorInterface } from "./utilityEmissionsFactor";
import { ErrInvalidDateFormat, ErrUnknownUOM } from "../util/const.js";
import { UtilityEmissionsFactorInterface } from "./utilityEmissionsFactor.js";

//
const UOM_FACTORS: { [key: string]: number } = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
/* tslint:disable:max-classes-per-file */

import { ChaincodeStub } from "fabric-shim";
import { State } from "../util/state";
import { QueryResult, WorldState } from "../util/worldstate";
import { State } from "../util/state.js";
import { QueryResult, WorldState } from "../util/worldstate.js";

// EMISSION_CLASS_IDENTIFIER : identifier for emissions record inside HL Fabric
const EMISSION_CLASS_IDENTIFIER =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ import {
EmissionRecordState,
EmissionsRecord,
EmissionsRecordInterface,
} from "./emissions";
import { getCO2EmissionFactor } from "./emissions-calc";
} from "./emissions.js";
import { getCO2EmissionFactor } from "./emissions-calc.js";
import {
UtilityEmissionsFactor,
UtilityEmissionsFactorInterface,
UtilityEmissionsFactorState,
} from "./utilityEmissionsFactor";
} from "./utilityEmissionsFactor.js";
import { MD5, SHA256 } from "crypto-js";
import {
UtilityLookupItemInterface,
UtilityLookupItemState,
UtilityLookupItem,
} from "./utilityLookupItem";
} from "./utilityLookupItem.js";

// EmissionsRecordContract : core bushiness logic of emissions record chaincode
export class EmissionsRecordContract {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@

/* tslint:disable:max-classes-per-file */
import { ChaincodeStub } from "fabric-shim";
import { ErrStateNotFound } from "../util/const";
import { State } from "../util/state";
import { QueryResult, WorldState } from "../util/worldstate";
import { getYearFromDate } from "./emissions-calc";
import { UtilityLookupItemInterface } from "./utilityLookupItem";
import { ErrStateNotFound } from "../util/const.js";
import { State } from "../util/state.js";
import { QueryResult, WorldState } from "../util/worldstate.js";
import { getYearFromDate } from "./emissions-calc.js";
import { UtilityLookupItemInterface } from "./utilityLookupItem.js";

const UTILITY_EMISSIONS_FACTOR_CLASS_IDENTIFIER =
"org.hyperledger.blockchain-carbon-accounting.utilityemissionsfactoritem";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
*/

import { ChaincodeStub } from "fabric-shim";
import { State } from "../util/state";
import { QueryResult, WorldState } from "../util/worldstate";
import { State } from "../util/state.js";
import { QueryResult, WorldState } from "../util/worldstate.js";

/* tslint:disable:max-classes-per-file */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
*/

import { ChaincodeStub, Iterators } from "fabric-shim";
import { State } from "./state";
import { State } from "./state.js";
import {
ErrStateNotFound,
ErrInvalidQueryString,
ErrStateAlreadyExists,
} from "./const";
} from "./const.js";
/**
* WorldState class is a wrapper around chaincode stub
* for managing lifecycle of a asset of type T (interface) on HL fabric
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ import { PluginKeychainMemory } from "@hyperledger/cactus-plugin-keychain-memory
import {
ICarbonAccountingFabricContractDeploymentInfo,
ICarbonAccountingXdaiContractDeploymentInfo,
} from "../i-carbon-accounting-contract-deployment-info";
} from "../i-carbon-accounting-contract-deployment-info.js";

import { GetAllowanceEndpoint } from "./web-services/dao-token/get-allowance-endpoint";
import { GetAllowanceEndpoint } from "./web-services/dao-token/get-allowance-endpoint.js";

import {
EnrollAdminInfo,
EnrollAdminV1Request,
EnrollAdminV1Response,
} from "../generated/openapi/typescript-axios";
import { EnrollAdminV1Endpoint } from "./web-services/utility-emissions-channel/enroll-admin-v1-endpoint";
} from "./../generated/openapi/typescript-axios/index.js";
import { EnrollAdminV1Endpoint } from "./web-services/utility-emissions-channel/enroll-admin-v1-endpoint.js";

export interface OrgEnv {
CORE_PEER_LOCALMSPID: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import {
} from "@hyperledger/cactus-core-api";
import { registerWebServiceEndpoint } from "@hyperledger/cactus-core";

import { DaoTokenGetAllowanceRequest } from "../../../generated/openapi/typescript-axios";
import { CarbonAccountingPlugin } from "../../carbon-accounting-plugin";
import { DaoTokenGetAllowanceRequest } from "./../../../generated/openapi/typescript-axios/index.js";
import { CarbonAccountingPlugin } from "../../carbon-accounting-plugin.js";
import OAS from "../../../../json/openapi.json";

export interface IGetAllowanceEndpointOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import {
} from "@hyperledger/cactus-core-api";
import { registerWebServiceEndpoint } from "@hyperledger/cactus-core";

import { EnrollAdminV1Request } from "../../../generated/openapi/typescript-axios";
import { CarbonAccountingPlugin } from "../../carbon-accounting-plugin";
import { EnrollAdminV1Request } from "./../../../generated/openapi/typescript-axios/index.js";
import { CarbonAccountingPlugin } from "../../carbon-accounting-plugin.js";
import OAS from "../../../../json/openapi.json";

export interface IEnrollAdminV1EndpointOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
*/


import type { Configuration } from './configuration';
import type { Configuration } from "./configuration.js";
import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
import globalAxios from 'axios';
// Some imports not used depending on template conditions
// @ts-ignore
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common';
import type { RequestArgs } from './base';
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from "./common.js";
import type { RequestArgs } from "./base.js";
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError } from './base';
import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError } from "./base.js";

/**
* Stores global constants related to the authorization of the application. Specifically enumerates the claims to validate for as per RFC 7519, section 4.1. See: https://tools.ietf.org/html/rfc7519#section-4.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/


import type { Configuration } from './configuration';
import type { Configuration } from "./configuration.js";
// Some imports not used depending on template conditions
// @ts-ignore
import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
*/


import type { Configuration } from "./configuration";
import type { RequestArgs } from "./base";
import type { Configuration } from "./configuration.js";
import type { RequestArgs } from "./base.js";
import type { AxiosInstance, AxiosResponse } from 'axios';
import { RequiredError } from "./base";
import { RequiredError } from "./base.js";

/**
*
Expand Down
Loading
Loading