Skip to content

Commit

Permalink
chore(typescript): upgrade and switch to nodenext
Browse files Browse the repository at this point in the history
Fixes #2158

Signed-off-by: aldousalvarez <[email protected]>
  • Loading branch information
aldousalvarez committed Nov 11, 2022
1 parent 2f2fb1c commit 7f6493e
Show file tree
Hide file tree
Showing 87 changed files with 355 additions and 218 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,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": "NodeNext", /* 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'. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ export class CarbonAccountingAppDummyInfrastructure {
besuPlugin: PluginLedgerConnectorXdai,
keychainPlugin: PluginKeychainMemory,
): Promise<ICarbonAccountingXdaiContractDeploymentInfo> {
const out = [];
const out: any[] = [];
this._xdaiAccount = await this.xdai.createEthTestAccount(10000000);

{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"emitDecoratorMetadata": true,
"outDir": "dist",
"target": "es2017",
"moduleResolution": "node",
"moduleResolution": "NodeNext",
"module": "commonjs",
"declaration": true,
"sourceMap": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"files": [
"www/*"
],
"type": "module",
"scripts": {
"build": "ng build",
"build:dev:frontend": "ng build",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import { IonicModule, IonicRouteStrategy } from "@ionic/angular";
import { SplashScreen } from "@ionic-native/splash-screen/ngx";
import { StatusBar } from "@ionic-native/status-bar/ngx";

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

LoggerProvider.setLogLevel("TRACE");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ReactiveFormsModule, FormsModule } from "@angular/forms";

import { IonicModule } from "@ionic/angular";

import { PageHeadingComponent } from "./page-heading.component";
import { PageHeadingComponent } from "./page-heading.component.js";

@NgModule({
imports: [CommonModule, FormsModule, ReactiveFormsModule, IonicModule],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { enableProdMode } from "@angular/core";
import { platformBrowserDynamic } from "@angular/platform-browser-dynamic";

import { AppModule } from "./app/app.module";
import { environment } from "./environments/environment";
import { AppModule } from "./app/app.module.js";
import { environment } from "./environments/environment.js";

if (environment.production) {
enableProdMode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"downlevelIteration": true,
"experimentalDecorators": true,
"module": "esnext",
"moduleResolution": "node",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"importHelpers": true,
"target": "es2015",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"outDir": "./dist",
"sourceMap": false,
"declaration": false,
"moduleResolution": "node",
"moduleResolution": "NodeNext",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "ES2017",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"outDir": "./dist",
"sourceMap": false,
"declaration": false,
"moduleResolution": "node",
"moduleResolution": "NodeNext",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "ES2017",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ test.skip("Supply chain backend API calls can be executed", async (t: Test) => {
cwd: projectRoot,
});

const logs = [];
const logs: string[] = [];
for await (const data of child.stdout) {
console.log(`[child]: ${data}`);
logs.push(data);
Expand Down
1 change: 1 addition & 0 deletions examples/cactus-example-supply-chain-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"files": [
"www/*"
],
"type": "module",
"scripts": {
"build": "ng build --verbose",
"build:dev:frontend": "ng build",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,21 @@ const routes: Routes = [
{
path: "bamboo-harvest-list",
loadChildren: () =>
import("./bamboo-harvest/bamboo-harvest.module").then(
import("./bamboo-harvest/bamboo-harvest.module.js").then(
(m) => m.BambooHarvestPageModule,
),
},
{
path: "bookshelf-list",
loadChildren: () =>
import("./bookshelf/bookshelf.module").then((m) => m.BookshelfPageModule),
import("./bookshelf/bookshelf.module.js").then(
(m) => m.BookshelfPageModule,
),
},
{
path: "shipment-list",
loadChildren: () =>
import("./shipment/shipment.module").then((m) => m.ShipmentPageModule),
import("./shipment/shipment.module.js").then((m) => m.ShipmentPageModule),
},
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ import { IonicModule, IonicRouteStrategy } from "@ionic/angular";
import { SplashScreen } from "@ionic-native/splash-screen/ngx";
import { StatusBar } from "@ionic-native/status-bar/ngx";

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

LoggerProvider.setLogLevel("TRACE");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ModalController } from "@ionic/angular";
import { ApiClient } from "@hyperledger/cactus-api-client";
import { BambooHarvest } from "@hyperledger/cactus-example-supply-chain-business-logic-plugin";

import { QUORUM_DEMO_LEDGER_ID } from "../../../constants";
import { QUORUM_DEMO_LEDGER_ID } from "../../../constants.js";
import { Logger, LoggerProvider } from "@hyperledger/cactus-common";

@Component({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import {
DefaultApi as SupplyChainApi,
} from "@hyperledger/cactus-example-supply-chain-business-logic-plugin";

import { QUORUM_DEMO_LEDGER_ID } from "../../../constants";
import { BambooHarvestDetailPage } from "../bamboo-harvest-detail/bamboo-harvest-detail.page";
import { QUORUM_DEMO_LEDGER_ID } from "../../../constants.js";
import { BambooHarvestDetailPage } from "../bamboo-harvest-detail/bamboo-harvest-detail.page.js";
import { ModalController } from "@ionic/angular";

import { AuthConfig } from "../../common/auth-config";
import { AuthConfig } from "../../common/auth-config.js";

@Component({
selector: "app-bamboo-harvest-list",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { NgModule } from "@angular/core";
import { Routes, RouterModule } from "@angular/router";

import { BambooHarvestListPage } from "./bamboo-harvest-list/bamboo-harvest-list.page";
import { BambooHarvestListPage } from "./bamboo-harvest-list/bamboo-harvest-list.page.js";

const routes: Routes = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { FormsModule, ReactiveFormsModule } from "@angular/forms";

import { IonicModule } from "@ionic/angular";

import { BambooHarvestPageRoutingModule } from "./bamboo-harvest-routing.module";
import { BambooHarvestPageRoutingModule } from "./bamboo-harvest-routing.module.js";

import { BambooHarvestListPage } from "./bamboo-harvest-list/bamboo-harvest-list.page";
import { PageHeadingComponentModule } from "../common/page-heading/page-heading-component.module";
import { BambooHarvestDetailPage } from "./bamboo-harvest-detail/bamboo-harvest-detail.page";
import { BambooHarvestListPage } from "./bamboo-harvest-list/bamboo-harvest-list.page.js";
import { PageHeadingComponentModule } from "../common/page-heading/page-heading-component.module.js";
import { BambooHarvestDetailPage } from "./bamboo-harvest-detail/bamboo-harvest-detail.page.js";

@NgModule({
imports: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import {
} from "@hyperledger/cactus-example-supply-chain-business-logic-plugin";

import { Logger, LoggerProvider } from "@hyperledger/cactus-common";
import { QUORUM_DEMO_LEDGER_ID } from "src/constants";
import { QUORUM_DEMO_LEDGER_ID } from "src/constants.js";

import { AuthConfig } from "../../common/auth-config";
import { AuthConfig } from "../../common/auth-config.js";

@Component({
selector: "app-bookshelf-detail",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import {
DefaultApi as SupplyChainApi,
} from "@hyperledger/cactus-example-supply-chain-business-logic-plugin";

import { BESU_DEMO_LEDGER_ID } from "../../../constants";
import { BookshelfDetailPage } from "../bookshelf-detail/bookshelf-detail.page";
import { BESU_DEMO_LEDGER_ID } from "../../../constants.js";
import { BookshelfDetailPage } from "../bookshelf-detail/bookshelf-detail.page.js";
import { ModalController } from "@ionic/angular";

import { AuthConfig } from "../../common/auth-config";
import { AuthConfig } from "../../common/auth-config.js";

@Component({
selector: "app-bookshelf-list",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { NgModule } from "@angular/core";
import { Routes, RouterModule } from "@angular/router";

import { BookshelfListPage } from "./bookshelf-list/bookshelf-list.page";
import { BookshelfListPage } from "./bookshelf-list/bookshelf-list.page.js";

const routes: Routes = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { FormsModule, ReactiveFormsModule } from "@angular/forms";

import { IonicModule } from "@ionic/angular";

import { BookshelfPageRoutingModule } from "./bookshelf-routing.module";
import { BookshelfPageRoutingModule } from "./bookshelf-routing.module.js";

import { BookshelfListPage } from "./bookshelf-list/bookshelf-list.page";
import { PageHeadingComponentModule } from "../common/page-heading/page-heading-component.module";
import { BookshelfDetailPage } from "./bookshelf-detail/bookshelf-detail.page";
import { BookshelfListPage } from "./bookshelf-list/bookshelf-list.page.js";
import { PageHeadingComponentModule } from "../common/page-heading/page-heading-component.module.js";
import { BookshelfDetailPage } from "./bookshelf-detail/bookshelf-detail.page.js";

@NgModule({
imports: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ReactiveFormsModule, FormsModule } from "@angular/forms";

import { IonicModule } from "@ionic/angular";

import { PageHeadingComponent } from "./page-heading.component";
import { PageHeadingComponent } from "./page-heading.component.js";

@NgModule({
imports: [CommonModule, FormsModule, ReactiveFormsModule, IonicModule],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import {
} from "@hyperledger/cactus-example-supply-chain-business-logic-plugin";

import { Logger, LoggerProvider } from "@hyperledger/cactus-common";
import { QUORUM_DEMO_LEDGER_ID } from "src/constants";
import { QUORUM_DEMO_LEDGER_ID } from "src/constants.js";

import { AuthConfig } from "../../common/auth-config";
import { AuthConfig } from "../../common/auth-config.js";

@Component({
selector: "app-shipment-detail",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import {
DefaultApi as SupplyChainApi,
} from "@hyperledger/cactus-example-supply-chain-business-logic-plugin";

import { BESU_DEMO_LEDGER_ID } from "../../../constants";
import { ShipmentDetailPage } from "../shipment-detail/shipment-detail.page";
import { BESU_DEMO_LEDGER_ID } from "../../../constants.js";
import { ShipmentDetailPage } from "../shipment-detail/shipment-detail.page.js";
import { ModalController } from "@ionic/angular";

import { AuthConfig } from "../../common/auth-config";
import { AuthConfig } from "../../common/auth-config.js";

@Component({
selector: "app-shipment-list",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { NgModule } from "@angular/core";
import { Routes, RouterModule } from "@angular/router";

import { ShipmentListPage } from "./shipment-list/shipment-list.page";
import { ShipmentListPage } from "./shipment-list/shipment-list.page.js";

const routes: Routes = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { FormsModule, ReactiveFormsModule } from "@angular/forms";

import { IonicModule } from "@ionic/angular";

import { ShipmentPageRoutingModule } from "./shipment-routing.module";
import { ShipmentPageRoutingModule } from "./shipment-routing.module.js";

import { ShipmentListPage } from "./shipment-list/shipment-list.page";
import { PageHeadingComponentModule } from "../common/page-heading/page-heading-component.module";
import { ShipmentDetailPage } from "./shipment-detail/shipment-detail.page";
import { ShipmentListPage } from "./shipment-list/shipment-list.page.js";
import { PageHeadingComponentModule } from "../common/page-heading/page-heading-component.module.js";
import { ShipmentDetailPage } from "./shipment-detail/shipment-detail.page.js";

@NgModule({
imports: [
Expand Down
4 changes: 2 additions & 2 deletions examples/cactus-example-supply-chain-frontend/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { enableProdMode } from "@angular/core";
import { platformBrowserDynamic } from "@angular/platform-browser-dynamic";

import { AppModule } from "./app/app.module";
import { environment } from "./environments/environment";
import { AppModule } from "./app/app.module.js";
import { environment } from "./environments/environment.js";

if (environment.production) {
enableProdMode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"downlevelIteration": true,
"experimentalDecorators": true,
"module": "esnext",
"moduleResolution": "node",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"importHelpers": true,
"target": "es2015",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */

/* Module Resolution Options */
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "moduleResolution": "NodeNext", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "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'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
Expand Down
2 changes: 1 addition & 1 deletion examples/test-run-transaction/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,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": "NodeNext", /* 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'. */
Expand Down
2 changes: 1 addition & 1 deletion extensions/cactus-plugin-object-store-ipfs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"@types/express": "4.17.13",
"express": "4.17.1",
"ipfs-core-types": "0.6.1",
"multiformats": "9.4.9"
"multiformats": "9.4.10"
},
"engines": {
"node": ">=10",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import path from "path";
import type { Express } from "express";
import { create } from "ipfs-http-client";
import type { Options } from "ipfs-http-client";
import { RuntimeError } from "run-time-error";
// import { RuntimeError } from "run-time-error";
const { RuntimeError } = require("run-time-error");
import { Logger, Checks, LoggerProvider } from "@hyperledger/cactus-common";
import type { LogLevelDesc } from "@hyperledger/cactus-common";
import type {
Expand Down Expand Up @@ -132,7 +133,7 @@ export class PluginObjectStoreIpfs implements IPluginObjectStore {
public async get(req: GetObjectRequestV1): Promise<GetObjectResponseV1> {
const keyPath = this.getKeyPath(req);
const chunksIterable = this.ipfs.files.read(keyPath);
const chunks = [];
const chunks: any[] = [];
for await (const chunk of chunksIterable) {
chunks.push(chunk);
}
Expand Down
Loading

0 comments on commit 7f6493e

Please sign in to comment.