diff --git a/.github/workflows/npm.yml b/.github/workflows/npm.yml index eaf557867..daab3b30a 100644 --- a/.github/workflows/npm.yml +++ b/.github/workflows/npm.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: inputs: packageName: - description: "Package Name (schemas, common, toolkit)" + description: "Package Name (schemas, types, toolkit)" required: true version: description: "Version to publish (e.g., 1.0.0)" @@ -20,7 +20,7 @@ jobs: - name: Validate package name run: | - if [[ ${{ github.event.inputs.packageName }} != "schemas" && ${{ github.event.inputs.packageName }} != "common" && ${{ github.event.inputs.packageName }} != "toolkit" ]]; then + if [[ ${{ github.event.inputs.packageName }} != "schemas" && ${{ github.event.inputs.packageName }} != "types" && ${{ github.event.inputs.packageName }} != "toolkit" ]]; then echo "Error: Invalid package name" exit 1 fi diff --git a/packages/admin-ui/package.json b/packages/admin-ui/package.json index 9092a5da0..5fdae9bdb 100644 --- a/packages/admin-ui/package.json +++ b/packages/admin-ui/package.json @@ -21,6 +21,7 @@ "dev": "nodemon --ignore \"*.json\" -e ts,tsx --watch src/ --exec \"yarn build\"" }, "dependencies": { + "@dappnode/types": "^0.1.0", "@dappnode/common": "^0.1.0", "@dappnode/dappmanager": "^0.1.0", "@dappnode/eventbus": "^0.1.0", diff --git a/packages/admin-ui/server-mock/index.ts b/packages/admin-ui/server-mock/index.ts index d39c6fe7d..37a0f5924 100644 --- a/packages/admin-ui/server-mock/index.ts +++ b/packages/admin-ui/server-mock/index.ts @@ -1,10 +1,9 @@ import path from "path"; import { calls } from "../src/__mock-backend__"; import { startHttpApi } from "@dappnode/dappmanager/src/api/startHttpApi"; -import { LoggerMiddleware } from "@dappnode/common"; +import { LoggerMiddleware } from "@dappnode/types"; import { eventBus } from "./eventBus"; import { AdminPasswordDb } from "@dappnode/dappmanager/src/api/auth/adminPasswordDb"; -import { DeviceCalls } from "@dappnode/dappmanager/src/calls/device/index.js"; const testFileDir = "test_files"; diff --git a/packages/admin-ui/server-mock/mockVpnClient.ts b/packages/admin-ui/server-mock/mockVpnClient.ts index 73a2c1385..102cb82f2 100644 --- a/packages/admin-ui/server-mock/mockVpnClient.ts +++ b/packages/admin-ui/server-mock/mockVpnClient.ts @@ -1,4 +1,4 @@ -import { VpnDevice, PackageVersionData } from "@dappnode/common"; +import { VpnDevice, PackageVersionData } from "@dappnode/types"; import { VpnApiClient } from "@dappnode/dappmanager/src/api/vpnApiClient"; const url = "link-to-otp/?id=617824#hdfuisf"; diff --git a/packages/admin-ui/src/__mock-backend__/autoUpdate.ts b/packages/admin-ui/src/__mock-backend__/autoUpdate.ts index 8aab51781..78f30907f 100644 --- a/packages/admin-ui/src/__mock-backend__/autoUpdate.ts +++ b/packages/admin-ui/src/__mock-backend__/autoUpdate.ts @@ -1,4 +1,4 @@ -import { AutoUpdateDataView, Routes } from "@dappnode/common"; +import { AutoUpdateDataView, Routes } from "@dappnode/types"; import { pause } from "./utils/pause"; export const autoUpdate: Pick< diff --git a/packages/admin-ui/src/__mock-backend__/data/directory.ts b/packages/admin-ui/src/__mock-backend__/data/directory.ts index f7512826a..000b77f02 100644 --- a/packages/admin-ui/src/__mock-backend__/data/directory.ts +++ b/packages/admin-ui/src/__mock-backend__/data/directory.ts @@ -1,6 +1,6 @@ import { MockDnp } from "./dnps/types"; import { mockDnps } from "./dnps"; -import { DirectoryItem, DirectoryItemOk } from "@dappnode/common"; +import { DirectoryItem, DirectoryItemOk } from "@dappnode/types"; function getDirectoryDnp(dnp: MockDnp, index: number): DirectoryItemOk { return { diff --git a/packages/admin-ui/src/__mock-backend__/data/dnpInstalled.ts b/packages/admin-ui/src/__mock-backend__/data/dnpInstalled.ts index 41b154232..baa89f23a 100644 --- a/packages/admin-ui/src/__mock-backend__/data/dnpInstalled.ts +++ b/packages/admin-ui/src/__mock-backend__/data/dnpInstalled.ts @@ -1,4 +1,4 @@ -import { InstalledPackageDetailData, PackageContainer } from "@dappnode/common"; +import { InstalledPackageDetailData, PackageContainer } from "@dappnode/types"; import { sampleContainer, sampleDnp } from "./sample"; import { MockDnp } from "./dnps/types"; import { mockDnps } from "./dnps"; diff --git a/packages/admin-ui/src/__mock-backend__/data/dnpRequest.ts b/packages/admin-ui/src/__mock-backend__/data/dnpRequest.ts index c3309fc44..387a3b8c6 100644 --- a/packages/admin-ui/src/__mock-backend__/data/dnpRequest.ts +++ b/packages/admin-ui/src/__mock-backend__/data/dnpRequest.ts @@ -4,7 +4,7 @@ import { UserSettingsAllDnps, SetupWizardAllDnps, CompatibleDnps -} from "@dappnode/common"; +} from "@dappnode/types"; import { sampleRequestState } from "./sample"; import { MockDnp } from "./dnps/types"; import { mockDnps } from "./dnps"; diff --git a/packages/admin-ui/src/__mock-backend__/data/dnps/lightningNetwork.ts b/packages/admin-ui/src/__mock-backend__/data/dnps/lightningNetwork.ts index 4fe937218..c5dbd8f7d 100644 --- a/packages/admin-ui/src/__mock-backend__/data/dnps/lightningNetwork.ts +++ b/packages/admin-ui/src/__mock-backend__/data/dnps/lightningNetwork.ts @@ -1,4 +1,4 @@ -import { PortProtocol } from "@dappnode/common"; +import { PortProtocol } from "@dappnode/types"; import { bitcoin } from "./bitcoin"; import { MockDnp } from "./types"; diff --git a/packages/admin-ui/src/__mock-backend__/data/dnps/multiService.ts b/packages/admin-ui/src/__mock-backend__/data/dnps/multiService.ts index effa5010a..42f7dad20 100644 --- a/packages/admin-ui/src/__mock-backend__/data/dnps/multiService.ts +++ b/packages/admin-ui/src/__mock-backend__/data/dnps/multiService.ts @@ -1,4 +1,4 @@ -import { PortProtocol } from "@dappnode/common"; +import { PortProtocol } from "@dappnode/types"; import { MockDnp } from "./types"; const dnpName = "multi-service.dnp.dappnode.eth"; diff --git a/packages/admin-ui/src/__mock-backend__/data/dnps/openEthereum.ts b/packages/admin-ui/src/__mock-backend__/data/dnps/openEthereum.ts index fe8598d05..d64fdc50d 100644 --- a/packages/admin-ui/src/__mock-backend__/data/dnps/openEthereum.ts +++ b/packages/admin-ui/src/__mock-backend__/data/dnps/openEthereum.ts @@ -1,4 +1,4 @@ -import { PortProtocol } from "@dappnode/common"; +import { PortProtocol } from "@dappnode/types"; import { MockDnp } from "./types"; const dnpName = "open-ethereum.dnp.dappnode.eth"; diff --git a/packages/admin-ui/src/__mock-backend__/data/dnps/types.ts b/packages/admin-ui/src/__mock-backend__/data/dnps/types.ts index 4841d6b98..d7744b5ef 100644 --- a/packages/admin-ui/src/__mock-backend__/data/dnps/types.ts +++ b/packages/admin-ui/src/__mock-backend__/data/dnps/types.ts @@ -3,10 +3,9 @@ import { SpecialPermission, InstalledPackageDetailData, PackageContainer, - RequestedDnp, - Manifest, - SetupWizard -} from "@dappnode/common"; + RequestedDnp +} from "@dappnode/types"; +import { Manifest, SetupWizard } from "@dappnode/types"; export interface MockDnp { manifest: Manifest; diff --git a/packages/admin-ui/src/__mock-backend__/data/publicDnps/index.ts b/packages/admin-ui/src/__mock-backend__/data/publicDnps/index.ts index 22c59f27a..b596b3455 100644 --- a/packages/admin-ui/src/__mock-backend__/data/publicDnps/index.ts +++ b/packages/admin-ui/src/__mock-backend__/data/publicDnps/index.ts @@ -1,4 +1,4 @@ -import { DirectoryItem } from "@dappnode/common"; +import { DirectoryItem } from "@dappnode/types"; // Packages from ENS public.dappnode.eth // From block 8905883 to ~ 13000000 diff --git a/packages/admin-ui/src/__mock-backend__/data/registry.ts b/packages/admin-ui/src/__mock-backend__/data/registry.ts index 2cbac72e9..c78b125fa 100644 --- a/packages/admin-ui/src/__mock-backend__/data/registry.ts +++ b/packages/admin-ui/src/__mock-backend__/data/registry.ts @@ -1,4 +1,4 @@ -import { DirectoryItem } from "@dappnode/common"; +import { DirectoryItem } from "@dappnode/types"; import { mockPublicDnps } from "./publicDnps"; export const registry: DirectoryItem[] = [ diff --git a/packages/admin-ui/src/__mock-backend__/data/sample.ts b/packages/admin-ui/src/__mock-backend__/data/sample.ts index ee9ac7734..c73525115 100644 --- a/packages/admin-ui/src/__mock-backend__/data/sample.ts +++ b/packages/admin-ui/src/__mock-backend__/data/sample.ts @@ -3,7 +3,7 @@ import { RequestedDnp, InstalledPackageDetailData, PackageContainer -} from "@dappnode/common"; +} from "@dappnode/types"; const dnpName = "test.dnp.dappnode.eth"; export const sampleRequestState: RequestedDnp = { diff --git a/packages/admin-ui/src/__mock-backend__/devices.ts b/packages/admin-ui/src/__mock-backend__/devices.ts index a812895f5..87c97874b 100644 --- a/packages/admin-ui/src/__mock-backend__/devices.ts +++ b/packages/admin-ui/src/__mock-backend__/devices.ts @@ -1,4 +1,4 @@ -import { Routes, VpnDevice } from "@dappnode/common"; +import { Routes, VpnDevice } from "@dappnode/types"; const url = "link-to-otp/?id=617824#hdfuisf"; const password = "SAMPLETEMPPASSWORD"; diff --git a/packages/admin-ui/src/__mock-backend__/fetchPkgsData.ts b/packages/admin-ui/src/__mock-backend__/fetchPkgsData.ts index b7e087a90..739223c76 100644 --- a/packages/admin-ui/src/__mock-backend__/fetchPkgsData.ts +++ b/packages/admin-ui/src/__mock-backend__/fetchPkgsData.ts @@ -1,4 +1,4 @@ -import { CoreUpdateDataAvailable, Routes } from "@dappnode/common"; +import { CoreUpdateDataAvailable, Routes } from "@dappnode/types"; import { directory, registry, dnpRequests } from "./data"; export const fetchPkgsData: Pick< diff --git a/packages/admin-ui/src/__mock-backend__/httpsPortal.ts b/packages/admin-ui/src/__mock-backend__/httpsPortal.ts index 6bdc231a5..56889c4a7 100644 --- a/packages/admin-ui/src/__mock-backend__/httpsPortal.ts +++ b/packages/admin-ui/src/__mock-backend__/httpsPortal.ts @@ -2,7 +2,7 @@ import { ExposableServiceInfo, HttpsPortalMapping, Routes -} from "@dappnode/common"; +} from "@dappnode/types"; const mappings = new Map(); diff --git a/packages/admin-ui/src/__mock-backend__/index.ts b/packages/admin-ui/src/__mock-backend__/index.ts index 537339ab7..db4130e37 100644 --- a/packages/admin-ui/src/__mock-backend__/index.ts +++ b/packages/admin-ui/src/__mock-backend__/index.ts @@ -1,4 +1,4 @@ -import { IpfsClientTarget, PortProtocol, Routes } from "@dappnode/common"; +import { IpfsClientTarget, PortProtocol, Routes } from "@dappnode/types"; import { autoUpdate } from "./autoUpdate"; import { devices } from "./devices"; import { fetchPkgsData } from "./fetchPkgsData"; diff --git a/packages/admin-ui/src/__mock-backend__/localProxying.ts b/packages/admin-ui/src/__mock-backend__/localProxying.ts index 055303f3d..9faa78aa5 100644 --- a/packages/admin-ui/src/__mock-backend__/localProxying.ts +++ b/packages/admin-ui/src/__mock-backend__/localProxying.ts @@ -1,4 +1,4 @@ -import { LocalProxyingStatus, Routes } from "@dappnode/common"; +import { LocalProxyingStatus, Routes } from "@dappnode/types"; import { pause } from "./utils/pause"; const localProxyingStatusON: LocalProxyingStatus = "running"; diff --git a/packages/admin-ui/src/__mock-backend__/notifications.ts b/packages/admin-ui/src/__mock-backend__/notifications.ts index 9a30942ca..c3281f736 100644 --- a/packages/admin-ui/src/__mock-backend__/notifications.ts +++ b/packages/admin-ui/src/__mock-backend__/notifications.ts @@ -1,4 +1,4 @@ -import { PackageNotificationDb, Routes } from "@dappnode/common"; +import { PackageNotificationDb, Routes } from "@dappnode/types"; export const notifications: Pick< Routes, diff --git a/packages/admin-ui/src/__mock-backend__/packages.ts b/packages/admin-ui/src/__mock-backend__/packages.ts index 7555b5a45..c77d4128f 100644 --- a/packages/admin-ui/src/__mock-backend__/packages.ts +++ b/packages/admin-ui/src/__mock-backend__/packages.ts @@ -1,4 +1,4 @@ -import { InstalledPackageDetailData, Routes } from "@dappnode/common"; +import { InstalledPackageDetailData, Routes } from "@dappnode/types"; import { dnpInstalled } from "./data"; import { sampleContainer, sampleDnp } from "./data/sample"; import { pause } from "./utils/pause"; diff --git a/packages/admin-ui/src/__mock-backend__/password.ts b/packages/admin-ui/src/__mock-backend__/password.ts index be569e1af..d04882e10 100644 --- a/packages/admin-ui/src/__mock-backend__/password.ts +++ b/packages/admin-ui/src/__mock-backend__/password.ts @@ -1,4 +1,4 @@ -import { Routes } from "@dappnode/common"; +import { Routes } from "@dappnode/types"; let hostPasswordIsSecureState = false; diff --git a/packages/admin-ui/src/__mock-backend__/releaseTrustedKey.ts b/packages/admin-ui/src/__mock-backend__/releaseTrustedKey.ts index c66f9b1a3..6ac036982 100644 --- a/packages/admin-ui/src/__mock-backend__/releaseTrustedKey.ts +++ b/packages/admin-ui/src/__mock-backend__/releaseTrustedKey.ts @@ -1,4 +1,4 @@ -import { Routes, TrustedReleaseKey } from "@dappnode/common"; +import { Routes, TrustedReleaseKey } from "@dappnode/types"; const initialTrustedKey: TrustedReleaseKey = { name: "DAppNode Association", diff --git a/packages/admin-ui/src/__mock-backend__/ssh.ts b/packages/admin-ui/src/__mock-backend__/ssh.ts index 92cb5a343..6961306ca 100644 --- a/packages/admin-ui/src/__mock-backend__/ssh.ts +++ b/packages/admin-ui/src/__mock-backend__/ssh.ts @@ -1,4 +1,4 @@ -import { Routes } from "@dappnode/common"; +import { Routes } from "@dappnode/types"; let sshPort = 22; let sshStatus: "enabled" | "disabled" = "enabled"; diff --git a/packages/admin-ui/src/__mock-backend__/stakerConfig.ts b/packages/admin-ui/src/__mock-backend__/stakerConfig.ts index 2c7006efc..1bcfcb732 100644 --- a/packages/admin-ui/src/__mock-backend__/stakerConfig.ts +++ b/packages/admin-ui/src/__mock-backend__/stakerConfig.ts @@ -5,7 +5,7 @@ import { Routes, Signer, Network -} from "@dappnode/common"; +} from "@dappnode/types"; export const stakerConfig: Pick< Routes, diff --git a/packages/admin-ui/src/__mock-backend__/telegram.ts b/packages/admin-ui/src/__mock-backend__/telegram.ts index 42997c94c..a6706b4a3 100644 --- a/packages/admin-ui/src/__mock-backend__/telegram.ts +++ b/packages/admin-ui/src/__mock-backend__/telegram.ts @@ -1,4 +1,4 @@ -import { Routes } from "@dappnode/common"; +import { Routes } from "@dappnode/types"; let isEnabled = false; let token: string | null = null; diff --git a/packages/admin-ui/src/__mock-backend__/userActionLogs.ts b/packages/admin-ui/src/__mock-backend__/userActionLogs.ts index 87571c661..5554f17f4 100644 --- a/packages/admin-ui/src/__mock-backend__/userActionLogs.ts +++ b/packages/admin-ui/src/__mock-backend__/userActionLogs.ts @@ -1,4 +1,4 @@ -import { Routes, UserActionLog } from "@dappnode/common"; +import { Routes, UserActionLog } from "@dappnode/types"; const userActionLogsState: UserActionLog[] = []; diff --git a/packages/admin-ui/src/__mock-backend__/volumes.ts b/packages/admin-ui/src/__mock-backend__/volumes.ts index a61e2362f..9728079ab 100644 --- a/packages/admin-ui/src/__mock-backend__/volumes.ts +++ b/packages/admin-ui/src/__mock-backend__/volumes.ts @@ -1,6 +1,6 @@ import { pause } from "./utils/pause"; import { dnpInstalled } from "./data"; -import { VolumeData, Routes } from "@dappnode/common"; +import { VolumeData, Routes } from "@dappnode/types"; const volumesState = new Map( getInitialVolumes().map(vol => [vol.name, vol]) diff --git a/packages/admin-ui/src/__mock-backend__/wifi.ts b/packages/admin-ui/src/__mock-backend__/wifi.ts index c86d2c15b..440549ec7 100644 --- a/packages/admin-ui/src/__mock-backend__/wifi.ts +++ b/packages/admin-ui/src/__mock-backend__/wifi.ts @@ -1,4 +1,4 @@ -import { Routes } from "@dappnode/common"; +import { Routes } from "@dappnode/types"; export const wifi: Pick = { wifiCredentialsGet: async () => { diff --git a/packages/admin-ui/src/__mock-backend__/wireguard.ts b/packages/admin-ui/src/__mock-backend__/wireguard.ts index 337370b99..e15176be1 100644 --- a/packages/admin-ui/src/__mock-backend__/wireguard.ts +++ b/packages/admin-ui/src/__mock-backend__/wireguard.ts @@ -1,4 +1,4 @@ -import { Routes } from "@dappnode/common"; +import { Routes } from "@dappnode/types"; const initialDevices = [ "dappnode_admin", diff --git a/packages/admin-ui/src/__tests__/pages/installer/helpers.test.ts b/packages/admin-ui/src/__tests__/pages/installer/helpers.test.ts index 184a3d31f..97324a00c 100644 --- a/packages/admin-ui/src/__tests__/pages/installer/helpers.test.ts +++ b/packages/admin-ui/src/__tests__/pages/installer/helpers.test.ts @@ -1,5 +1,5 @@ import filterDirectory from "pages/installer/helpers/filterDirectory"; -import { DirectoryItem } from "@dappnode/common"; +import { DirectoryItem } from "@dappnode/types"; import { SelectedCategories } from "pages/installer/types"; const sampleDirectoryState: DirectoryItem = { diff --git a/packages/admin-ui/src/__tests__/pages/installer/parsers/setupWizardParser.test.ts b/packages/admin-ui/src/__tests__/pages/installer/parsers/setupWizardParser.test.ts index 3350a7175..c8e27af3b 100644 --- a/packages/admin-ui/src/__tests__/pages/installer/parsers/setupWizardParser.test.ts +++ b/packages/admin-ui/src/__tests__/pages/installer/parsers/setupWizardParser.test.ts @@ -3,7 +3,7 @@ import { userSettingsToFormData } from "pages/installer/parsers/formDataParser"; import { SetupWizardFormDataReturn } from "pages/installer/types"; -import { UserSettingsAllDnps } from "@dappnode/common"; +import { UserSettingsAllDnps } from "@dappnode/types"; import deepmerge from "deepmerge"; import { SetupTargetAllDnps } from "types"; diff --git a/packages/admin-ui/src/__tests__/utils/lodashExtended.test.ts b/packages/admin-ui/src/__tests__/utils/lodashExtended.test.ts index 4e30b4190..82daa84a0 100644 --- a/packages/admin-ui/src/__tests__/utils/lodashExtended.test.ts +++ b/packages/admin-ui/src/__tests__/utils/lodashExtended.test.ts @@ -1,4 +1,4 @@ -import { UserSettingsAllDnps } from "@dappnode/common"; +import { UserSettingsAllDnps } from "@dappnode/types"; import deepmerge from "deepmerge"; import { difference, isDeepEmpty } from "utils/lodashExtended"; diff --git a/packages/admin-ui/src/api/auth.ts b/packages/admin-ui/src/api/auth.ts index 301892847..38e8e5d54 100644 --- a/packages/admin-ui/src/api/auth.ts +++ b/packages/admin-ui/src/api/auth.ts @@ -1,4 +1,4 @@ -import { LoginStatusReturn } from "@dappnode/common"; +import { LoginStatusReturn } from "@dappnode/types"; import { apiTestMode, apiUrls, diff --git a/packages/admin-ui/src/api/index.ts b/packages/admin-ui/src/api/index.ts index 8b43868ae..8e64a7ccb 100644 --- a/packages/admin-ui/src/api/index.ts +++ b/packages/admin-ui/src/api/index.ts @@ -9,10 +9,9 @@ import { SubscriptionsTypes, Routes, routesData, - ResolvedType, - parseRpcResponse, - subscriptionsFactory -} from "@dappnode/common"; + ResolvedType +} from "@dappnode/types"; +import { parseRpcResponse, subscriptionsFactory } from "@dappnode/common"; // Internal import { mapSubscriptionsToRedux } from "./subscriptions"; import { initialCallsOnOpen } from "./initialCalls"; diff --git a/packages/admin-ui/src/api/interface.ts b/packages/admin-ui/src/api/interface.ts index c2fc4f36e..3cb4598e5 100644 --- a/packages/admin-ui/src/api/interface.ts +++ b/packages/admin-ui/src/api/interface.ts @@ -1,5 +1,5 @@ import { Emitter } from "mitt"; -import { RpcPayload, RpcResponse } from "@dappnode/common"; +import { RpcPayload, RpcResponse } from "@dappnode/types"; export type LoginStatus = | { status: "logged-in"; username: string } diff --git a/packages/admin-ui/src/api/mock/rpc.ts b/packages/admin-ui/src/api/mock/rpc.ts index 55fa00d34..bd60580d6 100644 --- a/packages/admin-ui/src/api/mock/rpc.ts +++ b/packages/admin-ui/src/api/mock/rpc.ts @@ -1,4 +1,4 @@ -import { RpcPayload, RpcResponse } from "@dappnode/common"; +import { RpcPayload, RpcResponse } from "@dappnode/types"; import { calls } from "../../__mock-backend__"; import { IApiRpc } from "../interface"; diff --git a/packages/admin-ui/src/api/rpc.ts b/packages/admin-ui/src/api/rpc.ts index f8886b2a0..724503e67 100644 --- a/packages/admin-ui/src/api/rpc.ts +++ b/packages/admin-ui/src/api/rpc.ts @@ -1,9 +1,9 @@ import io, { Socket } from "socket.io-client"; import { Emitter } from "mitt"; -import { Args, RpcPayload, RpcResponse } from "@dappnode/common"; +import { Args, RpcPayload, RpcResponse } from "@dappnode/types"; import { IApiRpc } from "./interface"; import { socketIoUrl } from "params"; -import { subscriptionsData } from "@dappnode/common"; +import { subscriptionsData } from "@dappnode/types"; let socketGlobal: Socket | null = null; let apiStarted = false; diff --git a/packages/admin-ui/src/api/subscriptions.ts b/packages/admin-ui/src/api/subscriptions.ts index 30320a8ea..7a37ca891 100644 --- a/packages/admin-ui/src/api/subscriptions.ts +++ b/packages/admin-ui/src/api/subscriptions.ts @@ -9,7 +9,7 @@ import { updateVolumes, setSystemInfo } from "services/dappnodeStatus/actions"; import { setDnpInstalled } from "services/dnpInstalled/actions"; import { updateDnpDirectory } from "services/dnpDirectory/actions"; import { updateDnpRegistry } from "services/dnpRegistry/actions"; -import { Subscriptions } from "@dappnode/common"; +import { Subscriptions } from "@dappnode/types"; export function mapSubscriptionsToRedux(subscriptions: Subscriptions): void { subscriptions.directory.on(directoryDnps => { diff --git a/packages/admin-ui/src/api/utils.ts b/packages/admin-ui/src/api/utils.ts index 932023117..079291fc0 100644 --- a/packages/admin-ui/src/api/utils.ts +++ b/packages/admin-ui/src/api/utils.ts @@ -1,5 +1,5 @@ import { dappmanagerDnpName, coreDnpName } from "params"; -import { Args } from "@dappnode/common"; +import { Args } from "@dappnode/types"; /** * Restarting the DAPPMANAGER will cause this error diff --git a/packages/admin-ui/src/components/EthMultiClient.tsx b/packages/admin-ui/src/components/EthMultiClient.tsx index 4778f32d0..764214e0c 100644 --- a/packages/admin-ui/src/components/EthMultiClient.tsx +++ b/packages/admin-ui/src/components/EthMultiClient.tsx @@ -12,7 +12,7 @@ import { ConsensusClientMainnet, executionClientsMainnet, consensusClientsMainnet -} from "@dappnode/common"; +} from "@dappnode/types"; import { AiFillSafetyCertificate, AiFillClockCircle } from "react-icons/ai"; import { FaDatabase } from "react-icons/fa"; import Switch from "./Switch"; diff --git a/packages/admin-ui/src/components/IpfsClient.tsx b/packages/admin-ui/src/components/IpfsClient.tsx index 5b519d71f..a5882cf95 100644 --- a/packages/admin-ui/src/components/IpfsClient.tsx +++ b/packages/admin-ui/src/components/IpfsClient.tsx @@ -1,6 +1,6 @@ import React from "react"; import "./multiClient.scss"; -import { IpfsClientTarget } from "@dappnode/common"; +import { IpfsClientTarget } from "@dappnode/types"; import Card from "components/Card"; import { joinCssClass } from "utils/css"; import Input from "./Input"; diff --git a/packages/admin-ui/src/components/SetupWizard/EditorAdvanced.tsx b/packages/admin-ui/src/components/SetupWizard/EditorAdvanced.tsx index eaf93c39c..edcb9d01d 100644 --- a/packages/admin-ui/src/components/SetupWizard/EditorAdvanced.tsx +++ b/packages/admin-ui/src/components/SetupWizard/EditorAdvanced.tsx @@ -2,7 +2,7 @@ import React from "react"; import { orderBy, isEmpty } from "lodash-es"; // Components import Input from "components/Input"; -import { UserSettingsAllDnps } from "@dappnode/common"; +import { UserSettingsAllDnps } from "@dappnode/types"; import { prettyDnpName } from "utils/format"; import "./editorAdvanced.scss"; diff --git a/packages/admin-ui/src/components/SetupWizard/EditorV2.tsx b/packages/admin-ui/src/components/SetupWizard/EditorV2.tsx index 7692e0d04..210f7c36c 100644 --- a/packages/admin-ui/src/components/SetupWizard/EditorV2.tsx +++ b/packages/admin-ui/src/components/SetupWizard/EditorV2.tsx @@ -1,6 +1,6 @@ import React from "react"; // Components -import { SetupWizardAllDnps } from "@dappnode/common"; +import { SetupWizardAllDnps } from "@dappnode/types"; import { prettyDnpName } from "utils/format"; import RenderMarkdown from "components/RenderMarkdown"; import InputField from "./InputField"; diff --git a/packages/admin-ui/src/components/SetupWizard/InputField.tsx b/packages/admin-ui/src/components/SetupWizard/InputField.tsx index e4dbcf8bb..4278d96cc 100644 --- a/packages/admin-ui/src/components/SetupWizard/InputField.tsx +++ b/packages/admin-ui/src/components/SetupWizard/InputField.tsx @@ -1,5 +1,5 @@ import React from "react"; -import { SetupWizardField } from "@dappnode/common"; +import { SetupWizardField } from "@dappnode/types"; import Input from "components/Input"; import InputFieldSelect from "./InputFieldSelect"; import InputFieldFile from "./InputFieldFile"; diff --git a/packages/admin-ui/src/components/SetupWizard/SelectMountpoint.tsx b/packages/admin-ui/src/components/SetupWizard/SelectMountpoint.tsx index 2329bad37..9b88bb4f3 100644 --- a/packages/admin-ui/src/components/SetupWizard/SelectMountpoint.tsx +++ b/packages/admin-ui/src/components/SetupWizard/SelectMountpoint.tsx @@ -9,7 +9,7 @@ import { joinCssClass } from "utils/css"; import newTabProps from "utils/newTabProps"; import { troubleShootMountpointsGuideUrl } from "params"; import "./selectMountpoint.scss"; -import { MountpointData } from "@dappnode/common"; +import { MountpointData } from "@dappnode/types"; function renderMountpointDataSummary({ mountpoint, diff --git a/packages/admin-ui/src/components/SetupWizard/index.tsx b/packages/admin-ui/src/components/SetupWizard/index.tsx index dbbe63464..f80af1598 100644 --- a/packages/admin-ui/src/components/SetupWizard/index.tsx +++ b/packages/admin-ui/src/components/SetupWizard/index.tsx @@ -4,7 +4,7 @@ import { isEqual } from "lodash-es"; // Components import Card from "components/Card"; import Alert from "react-bootstrap/Alert"; -import { UserSettingsAllDnps, SetupWizardAllDnps } from "@dappnode/common"; +import { UserSettingsAllDnps, SetupWizardAllDnps } from "@dappnode/types"; import { prettyDnpName } from "utils/format"; import { EditorAdvanced } from "./EditorAdvanced"; import { EditorV2 } from "./EditorV2"; diff --git a/packages/admin-ui/src/components/welcome/Welcome.tsx b/packages/admin-ui/src/components/welcome/Welcome.tsx index 913d9bb9c..aa071283a 100644 --- a/packages/admin-ui/src/components/welcome/Welcome.tsx +++ b/packages/admin-ui/src/components/welcome/Welcome.tsx @@ -13,7 +13,7 @@ import RepositoryFallback from "./features/RepositoryFallback"; import EnableEthicalMetrics from "./features/EnableEthicalMetrics"; // Utils import { isEqual } from "lodash-es"; -import { NewFeatureId } from "@dappnode/common"; +import { NewFeatureId } from "@dappnode/types"; // styles import "./welcome.scss"; diff --git a/packages/admin-ui/src/components/welcome/features/Repository.tsx b/packages/admin-ui/src/components/welcome/features/Repository.tsx index 96fa4d7c1..abe6bcaba 100644 --- a/packages/admin-ui/src/components/welcome/features/Repository.tsx +++ b/packages/admin-ui/src/components/welcome/features/Repository.tsx @@ -1,7 +1,7 @@ import React, { useState, useEffect } from "react"; import { useSelector } from "react-redux"; import { EthMultiClientsAndFallback } from "components/EthMultiClient"; -import { EthClientFallback, Eth2ClientTarget } from "@dappnode/common"; +import { EthClientFallback, Eth2ClientTarget } from "@dappnode/types"; import { getEthClientTarget } from "services/dappnodeStatus/selectors"; import BottomButtons from "../BottomButtons"; import { api } from "api"; diff --git a/packages/admin-ui/src/components/welcome/features/RepositoryFallback.tsx b/packages/admin-ui/src/components/welcome/features/RepositoryFallback.tsx index 496a90c2d..1bbb51f96 100644 --- a/packages/admin-ui/src/components/welcome/features/RepositoryFallback.tsx +++ b/packages/admin-ui/src/components/welcome/features/RepositoryFallback.tsx @@ -3,7 +3,7 @@ import { fallbackToBoolean, booleanToFallback } from "components/EthMultiClient"; -import { EthClientFallback } from "@dappnode/common"; +import { EthClientFallback } from "@dappnode/types"; import BottomButtons from "../BottomButtons"; import { api } from "api"; import Alert from "react-bootstrap/Alert"; diff --git a/packages/admin-ui/src/hooks/chainData.ts b/packages/admin-ui/src/hooks/chainData.ts index 11835bb70..0841a098b 100644 --- a/packages/admin-ui/src/hooks/chainData.ts +++ b/packages/admin-ui/src/hooks/chainData.ts @@ -1,5 +1,5 @@ import { useApi } from "api"; -import { ChainData } from "@dappnode/common"; +import { ChainData } from "@dappnode/types"; import { useEffect } from "react"; import { useSelector } from "react-redux"; import { getRepositorySourceChainItem } from "services/dappnodeStatus/selectors"; diff --git a/packages/admin-ui/src/pages/dashboard/components/ChainCard.tsx b/packages/admin-ui/src/pages/dashboard/components/ChainCard.tsx index 6ba72b5c8..0053ffd0f 100644 --- a/packages/admin-ui/src/pages/dashboard/components/ChainCard.tsx +++ b/packages/admin-ui/src/pages/dashboard/components/ChainCard.tsx @@ -4,7 +4,7 @@ import ProgressBar from "react-bootstrap/ProgressBar"; import Card from "components/Card"; import RenderMarkdown from "components/RenderMarkdown"; import { prettyDnpName } from "utils/format"; -import { ChainData } from "@dappnode/common"; +import { ChainData } from "@dappnode/types"; import { HelpTo } from "components/Help"; import { Link } from "react-router-dom"; import { relativePath as packagesRelativePath } from "pages/packages"; diff --git a/packages/admin-ui/src/pages/dashboard/components/PackageUpdates.tsx b/packages/admin-ui/src/pages/dashboard/components/PackageUpdates.tsx index a27a679df..3ab5e7d05 100644 --- a/packages/admin-ui/src/pages/dashboard/components/PackageUpdates.tsx +++ b/packages/admin-ui/src/pages/dashboard/components/PackageUpdates.tsx @@ -2,7 +2,7 @@ import React from "react"; import Alert from "react-bootstrap/esm/Alert"; import { useApi } from "api"; import { getInstallerPath } from "pages/installer"; -import { UpdateAvailable } from "@dappnode/common"; +import { UpdateAvailable } from "@dappnode/types"; import { useNavigate } from "react-router-dom"; import Button from "components/Button"; import ErrorView from "components/ErrorView"; diff --git a/packages/admin-ui/src/pages/installer/components/DnpStore.tsx b/packages/admin-ui/src/pages/installer/components/DnpStore.tsx index 647cdc894..4f7707932 100644 --- a/packages/admin-ui/src/pages/installer/components/DnpStore.tsx +++ b/packages/admin-ui/src/pages/installer/components/DnpStore.tsx @@ -10,7 +10,7 @@ import { DirectoryItem, DirectoryItemOk, DirectoryItemError -} from "@dappnode/common"; +} from "@dappnode/types"; import "./dnpStore.scss"; function getTag({ diff --git a/packages/admin-ui/src/pages/installer/components/InstallCardComponents/Dependencies.tsx b/packages/admin-ui/src/pages/installer/components/InstallCardComponents/Dependencies.tsx index 5c79f02c0..ae0f8661a 100644 --- a/packages/admin-ui/src/pages/installer/components/InstallCardComponents/Dependencies.tsx +++ b/packages/admin-ui/src/pages/installer/components/InstallCardComponents/Dependencies.tsx @@ -5,7 +5,7 @@ import SubTitle from "components/SubTitle"; import Ok from "components/Ok"; import DependencyList from "./DependencyList"; import ProgressBar from "react-bootstrap/ProgressBar"; -import { CompatibleDnps, DependencyListItem } from "@dappnode/common"; +import { CompatibleDnps, DependencyListItem } from "@dappnode/types"; interface DependenciesProps { noCard?: boolean; diff --git a/packages/admin-ui/src/pages/installer/components/InstallCardComponents/DependencyList.tsx b/packages/admin-ui/src/pages/installer/components/InstallCardComponents/DependencyList.tsx index 4a55517c0..b9a7c8f4c 100644 --- a/packages/admin-ui/src/pages/installer/components/InstallCardComponents/DependencyList.tsx +++ b/packages/admin-ui/src/pages/installer/components/InstallCardComponents/DependencyList.tsx @@ -5,7 +5,7 @@ import computeSemverUpdateType from "utils/computeSemverUpdateType"; import RenderMarkdown from "components/RenderMarkdown"; import styled from "styled-components"; import { prettyDnpName } from "utils/format"; -import { DependencyListItem } from "@dappnode/common"; +import { DependencyListItem } from "@dappnode/types"; const InfoContainer = styled.div` display: grid; diff --git a/packages/admin-ui/src/pages/installer/components/InstallDnpView.tsx b/packages/admin-ui/src/pages/installer/components/InstallDnpView.tsx index 3049c88e6..30b99e353 100644 --- a/packages/admin-ui/src/pages/installer/components/InstallDnpView.tsx +++ b/packages/admin-ui/src/pages/installer/components/InstallDnpView.tsx @@ -30,7 +30,7 @@ import { clearIsInstallingLog } from "services/isInstallingLogs/actions"; import { continueIfCalleDisconnected } from "api/utils"; import { enableAutoUpdatesForPackageWithConfirm } from "pages/system/components/AutoUpdates"; import Warnings from "./Steps/Warnings"; -import { RequestedDnp, UserSettingsAllDnps } from "@dappnode/common"; +import { RequestedDnp, UserSettingsAllDnps } from "@dappnode/types"; interface InstallDnpViewProps { dnp: RequestedDnp; diff --git a/packages/admin-ui/src/pages/installer/components/Steps/Info.tsx b/packages/admin-ui/src/pages/installer/components/Steps/Info.tsx index 34f23de67..d6518f115 100644 --- a/packages/admin-ui/src/pages/installer/components/Steps/Info.tsx +++ b/packages/admin-ui/src/pages/installer/components/Steps/Info.tsx @@ -17,7 +17,7 @@ import DnpNameVerified from "components/DnpNameVerified"; import Ok from "components/Ok"; import defaultAvatar from "img/defaultAvatar.png"; import { MdExpandMore, MdClose, MdExpandLess } from "react-icons/md"; -import { RequestedDnp } from "@dappnode/common"; +import { RequestedDnp } from "@dappnode/types"; import { SignedStatus } from "./SignedStatus"; // Styles import "./info.scss"; diff --git a/packages/admin-ui/src/pages/installer/components/Steps/Permissions.tsx b/packages/admin-ui/src/pages/installer/components/Steps/Permissions.tsx index 2b0ed05e4..4453c1977 100644 --- a/packages/admin-ui/src/pages/installer/components/Steps/Permissions.tsx +++ b/packages/admin-ui/src/pages/installer/components/Steps/Permissions.tsx @@ -4,7 +4,7 @@ import RenderMarkdown from "components/RenderMarkdown"; import Card from "components/Card"; import Button from "components/Button"; import StatusIcon from "components/StatusIcon"; -import { SpecialPermissionAllDnps } from "@dappnode/common"; +import { SpecialPermissionAllDnps } from "@dappnode/types"; import { prettyDnpName } from "utils/format"; import "./permissions.scss"; diff --git a/packages/admin-ui/src/pages/installer/components/Steps/SignedStatus.tsx b/packages/admin-ui/src/pages/installer/components/Steps/SignedStatus.tsx index d7518fed0..cb3e50b26 100644 --- a/packages/admin-ui/src/pages/installer/components/Steps/SignedStatus.tsx +++ b/packages/admin-ui/src/pages/installer/components/Steps/SignedStatus.tsx @@ -2,7 +2,7 @@ import React from "react"; import Ok from "components/Ok"; import { prettyDnpName } from "utils/format"; import "./signedStatus.scss"; -import { RequestedDnp } from "@dappnode/common"; +import { RequestedDnp } from "@dappnode/types"; export function SignedStatus({ signedSafe diff --git a/packages/admin-ui/src/pages/installer/components/Steps/Warnings.tsx b/packages/admin-ui/src/pages/installer/components/Steps/Warnings.tsx index c064f0020..dd058bfc7 100644 --- a/packages/admin-ui/src/pages/installer/components/Steps/Warnings.tsx +++ b/packages/admin-ui/src/pages/installer/components/Steps/Warnings.tsx @@ -1,6 +1,7 @@ import React from "react"; import Card from "components/Card"; -import { RequestedDnp, Manifest } from "@dappnode/common"; +import { RequestedDnp } from "@dappnode/types"; +import { Manifest } from "@dappnode/types"; import RenderMarkdown from "components/RenderMarkdown"; import Button from "components/Button"; diff --git a/packages/admin-ui/src/pages/installer/helpers/filterDirectory.ts b/packages/admin-ui/src/pages/installer/helpers/filterDirectory.ts index 214aa20ec..c56e365b0 100644 --- a/packages/admin-ui/src/pages/installer/helpers/filterDirectory.ts +++ b/packages/admin-ui/src/pages/installer/helpers/filterDirectory.ts @@ -1,4 +1,4 @@ -import { DirectoryItem } from "@dappnode/common"; +import { DirectoryItem } from "@dappnode/types"; import { SelectedCategories } from "../types"; /** diff --git a/packages/admin-ui/src/pages/installer/parsers/formDataErrors.ts b/packages/admin-ui/src/pages/installer/parsers/formDataErrors.ts index 855162caf..f0877ad03 100644 --- a/packages/admin-ui/src/pages/installer/parsers/formDataErrors.ts +++ b/packages/admin-ui/src/pages/installer/parsers/formDataErrors.ts @@ -1,4 +1,4 @@ -import { UserSettingsAllDnps, SetupWizardAllDnps } from "@dappnode/common"; +import { UserSettingsAllDnps, SetupWizardAllDnps } from "@dappnode/types"; import { SetupWizardFormDataReturn } from "../types"; type SetupWizardErrorType = "empty" | "pattern" | "enum"; diff --git a/packages/admin-ui/src/pages/installer/parsers/formDataParser.ts b/packages/admin-ui/src/pages/installer/parsers/formDataParser.ts index 1ede31d02..798ded0d8 100644 --- a/packages/admin-ui/src/pages/installer/parsers/formDataParser.ts +++ b/packages/admin-ui/src/pages/installer/parsers/formDataParser.ts @@ -5,9 +5,9 @@ import { UserSettingsAllDnps, UserSettings, SetupWizardAllDnps -} from "@dappnode/common"; +} from "@dappnode/types"; import { SetupWizardFormDataReturn } from "../types"; -import { SetupSchema } from "@dappnode/common"; +import { SetupSchema } from "@dappnode/types"; import { SetupTargetAllDnps } from "types"; const ajv = new Ajv({ allErrors: true }); diff --git a/packages/admin-ui/src/pages/packages/actions.ts b/packages/admin-ui/src/pages/packages/actions.ts index 9fa86ee88..8749b56ca 100644 --- a/packages/admin-ui/src/pages/packages/actions.ts +++ b/packages/admin-ui/src/pages/packages/actions.ts @@ -4,11 +4,8 @@ import { prettyDnpName, prettyFullName } from "utils/format"; import { api } from "api"; // Selectors import { withToastNoThrow } from "components/toast/Toast"; -import { - InstalledPackageData, - PackageContainer, - PackageEnvs -} from "@dappnode/common"; +import { InstalledPackageData, PackageContainer } from "@dappnode/types"; +import { PackageEnvs } from "@dappnode/types"; import { continueIfCalleDisconnected } from "api/utils"; // Used in package interface / envs diff --git a/packages/admin-ui/src/pages/packages/components/AlertPackageUpdateAvailable.tsx b/packages/admin-ui/src/pages/packages/components/AlertPackageUpdateAvailable.tsx index d16ade075..37b146205 100644 --- a/packages/admin-ui/src/pages/packages/components/AlertPackageUpdateAvailable.tsx +++ b/packages/admin-ui/src/pages/packages/components/AlertPackageUpdateAvailable.tsx @@ -4,7 +4,7 @@ import { getInstallerPath } from "pages/installer"; import Alert from "react-bootstrap/esm/Alert"; import Button from "components/Button"; import { prettyDnpName } from "utils/format"; -import { UpdateAvailable } from "@dappnode/common"; +import { UpdateAvailable } from "@dappnode/types"; export function AlertPackageUpdateAvailable({ dnpName, diff --git a/packages/admin-ui/src/pages/packages/components/Backup/Download.tsx b/packages/admin-ui/src/pages/packages/components/Backup/Download.tsx index 7e3e4444d..d3ba40658 100644 --- a/packages/admin-ui/src/pages/packages/components/Backup/Download.tsx +++ b/packages/admin-ui/src/pages/packages/components/Backup/Download.tsx @@ -9,7 +9,7 @@ import ErrorView from "components/ErrorView"; // Utils import { prettyDnpName } from "utils/format"; import newTabProps from "utils/newTabProps"; -import { PackageBackup } from "@dappnode/common"; +import { PackageBackup } from "@dappnode/types"; import { ReqStatus } from "types"; export function BackupDownload({ diff --git a/packages/admin-ui/src/pages/packages/components/Backup/Restore.tsx b/packages/admin-ui/src/pages/packages/components/Backup/Restore.tsx index 1a6786ecd..c310a0a48 100644 --- a/packages/admin-ui/src/pages/packages/components/Backup/Restore.tsx +++ b/packages/admin-ui/src/pages/packages/components/Backup/Restore.tsx @@ -10,7 +10,7 @@ import ErrorView from "components/ErrorView"; import { prettyDnpName } from "utils/format"; import humanFS from "utils/humanFileSize"; import { ReqStatus } from "types"; -import { PackageBackup } from "@dappnode/common"; +import { PackageBackup } from "@dappnode/types"; type ProgressType = { label: string; percent?: number }; type UploadReqStatus = ReqStatus; diff --git a/packages/admin-ui/src/pages/packages/components/Backup/index.tsx b/packages/admin-ui/src/pages/packages/components/Backup/index.tsx index 1948ea4e6..e6d227de2 100644 --- a/packages/admin-ui/src/pages/packages/components/Backup/index.tsx +++ b/packages/admin-ui/src/pages/packages/components/Backup/index.tsx @@ -4,7 +4,7 @@ import Columns from "components/Columns"; import { BackupDownload } from "./Download"; import { BackupRestore } from "./Restore"; import "./backup.scss"; -import { PackageBackup } from "@dappnode/common"; +import { PackageBackup } from "@dappnode/types"; export function Backup({ dnpName, diff --git a/packages/admin-ui/src/pages/packages/components/Config.tsx b/packages/admin-ui/src/pages/packages/components/Config.tsx index 81b1286a2..65e8349ad 100644 --- a/packages/admin-ui/src/pages/packages/components/Config.tsx +++ b/packages/admin-ui/src/pages/packages/components/Config.tsx @@ -3,12 +3,8 @@ import { packageSetEnvironment } from "../actions"; // Components import { SetupWizard } from "components/SetupWizard"; // Utils -import { - UserSettingsAllDnps, - UserSettings, - SetupWizard as SetupWizardType, - PackageEnvs -} from "@dappnode/common"; +import { UserSettingsAllDnps, UserSettings } from "@dappnode/types"; +import { PackageEnvs, SetupWizard as SetupWizardType } from "@dappnode/types"; import { difference } from "utils/lodashExtended"; export function Config({ diff --git a/packages/admin-ui/src/pages/packages/components/FileManager/From.tsx b/packages/admin-ui/src/pages/packages/components/FileManager/From.tsx index cd7e18208..51effc53b 100644 --- a/packages/admin-ui/src/pages/packages/components/FileManager/From.tsx +++ b/packages/admin-ui/src/pages/packages/components/FileManager/From.tsx @@ -3,7 +3,7 @@ import { apiRoutes } from "api"; import Input from "components/Input"; import Button from "components/Button"; import newTabProps from "utils/newTabProps"; -import { PackageContainer } from "@dappnode/common"; +import { PackageContainer } from "@dappnode/types"; export function CopyFileFrom({ container, diff --git a/packages/admin-ui/src/pages/packages/components/FileManager/To.tsx b/packages/admin-ui/src/pages/packages/components/FileManager/To.tsx index fedbc675a..21ae47e38 100644 --- a/packages/admin-ui/src/pages/packages/components/FileManager/To.tsx +++ b/packages/admin-ui/src/pages/packages/components/FileManager/To.tsx @@ -8,7 +8,7 @@ import fileToDataUri from "utils/fileToDataUri"; import humanFileSize from "utils/humanFileSize"; import { prettyFullName } from "utils/format"; import { withToast } from "components/toast/Toast"; -import { PackageContainer } from "@dappnode/common"; +import { PackageContainer } from "@dappnode/types"; const fileSizeWarning = 1e6; diff --git a/packages/admin-ui/src/pages/packages/components/FileManager/index.tsx b/packages/admin-ui/src/pages/packages/components/FileManager/index.tsx index a572682dc..ec3ff73ed 100644 --- a/packages/admin-ui/src/pages/packages/components/FileManager/index.tsx +++ b/packages/admin-ui/src/pages/packages/components/FileManager/index.tsx @@ -4,7 +4,7 @@ import { useLocation } from "react-router-dom"; import Card from "components/Card"; import { CopyFileTo } from "./To"; import { CopyFileFrom } from "./From"; -import { PackageContainer } from "@dappnode/common"; +import { PackageContainer } from "@dappnode/types"; import { ServiceSelector } from "../ServiceSelector"; import SubTitle from "components/SubTitle"; diff --git a/packages/admin-ui/src/pages/packages/components/Info/ContainerList.tsx b/packages/admin-ui/src/pages/packages/components/Info/ContainerList.tsx index eebfe3519..ee19aae39 100644 --- a/packages/admin-ui/src/pages/packages/components/Info/ContainerList.tsx +++ b/packages/admin-ui/src/pages/packages/components/Info/ContainerList.tsx @@ -11,7 +11,7 @@ import { MdPlayCircleOutline } from "react-icons/md"; import { BsChevronExpand, BsChevronContract } from "react-icons/bs"; -import { InstalledPackageData, PackageContainer } from "@dappnode/common"; +import { InstalledPackageData, PackageContainer } from "@dappnode/types"; import { withToastNoThrow } from "components/toast/Toast"; import { api } from "api"; import { prettyDnpName, prettyFullName } from "utils/format"; diff --git a/packages/admin-ui/src/pages/packages/components/Info/Links.tsx b/packages/admin-ui/src/pages/packages/components/Info/Links.tsx index 5dc32a75e..0baf987fb 100644 --- a/packages/admin-ui/src/pages/packages/components/Info/Links.tsx +++ b/packages/admin-ui/src/pages/packages/components/Info/Links.tsx @@ -2,7 +2,7 @@ import React from "react"; import newTabProps from "utils/newTabProps"; import { MdHome, MdSettingsRemote, MdSettings, MdInfo } from "react-icons/md"; import { AiFillBug } from "react-icons/ai"; -import { Manifest } from "@dappnode/common"; +import { Manifest } from "@dappnode/types"; export function Links({ links, diff --git a/packages/admin-ui/src/pages/packages/components/Info/RemovePackage.tsx b/packages/admin-ui/src/pages/packages/components/Info/RemovePackage.tsx index aea5f4770..41eea6ad3 100644 --- a/packages/admin-ui/src/pages/packages/components/Info/RemovePackage.tsx +++ b/packages/admin-ui/src/pages/packages/components/Info/RemovePackage.tsx @@ -8,7 +8,7 @@ import { withToast } from "components/toast/Toast"; import { BsTrash } from "react-icons/bs"; // Utils import { prettyDnpName } from "utils/format"; -import { InstalledPackageDetailData } from "@dappnode/common"; +import { InstalledPackageDetailData } from "@dappnode/types"; import { relativePath as packagesRelativePath } from "../../data"; import { markdownList } from "utils/markdown"; import "./removePackage.scss"; diff --git a/packages/admin-ui/src/pages/packages/components/Info/Vols.tsx b/packages/admin-ui/src/pages/packages/components/Info/Vols.tsx index 776721980..d45553451 100644 --- a/packages/admin-ui/src/pages/packages/components/Info/Vols.tsx +++ b/packages/admin-ui/src/pages/packages/components/Info/Vols.tsx @@ -3,7 +3,7 @@ import { useSelector } from "react-redux"; import { getVolumes } from "services/dappnodeStatus/selectors"; import { DataList } from "./DataList"; import { prettyVolumeName, prettyBytes } from "utils/format"; -import { VolumeMapping } from "@dappnode/common"; +import { VolumeMapping } from "@dappnode/types"; export function Vols({ dnpName, diff --git a/packages/admin-ui/src/pages/packages/components/Info/VolumesList.tsx b/packages/admin-ui/src/pages/packages/components/Info/VolumesList.tsx index 6dcd6ebe7..ea3d9d9df 100644 --- a/packages/admin-ui/src/pages/packages/components/Info/VolumesList.tsx +++ b/packages/admin-ui/src/pages/packages/components/Info/VolumesList.tsx @@ -8,7 +8,7 @@ import { BsChevronExpand, BsChevronContract } from "react-icons/bs"; import { confirm } from "components/ConfirmDialog"; import { withToastNoThrow } from "components/toast/Toast"; import { prettyVolumeName, prettyBytes, prettyDnpName } from "utils/format"; -import { InstalledPackageDetailData } from "@dappnode/common"; +import { InstalledPackageDetailData } from "@dappnode/types"; import "./volumesList.scss"; interface WarningItem { diff --git a/packages/admin-ui/src/pages/packages/components/Info/index.tsx b/packages/admin-ui/src/pages/packages/components/Info/index.tsx index 9893bbeea..23466dec4 100644 --- a/packages/admin-ui/src/pages/packages/components/Info/index.tsx +++ b/packages/admin-ui/src/pages/packages/components/Info/index.tsx @@ -8,7 +8,8 @@ import { MdClose } from "react-icons/md"; // This import { Links } from "./Links"; import newTabProps from "utils/newTabProps"; -import { InstalledPackageDetailData, Manifest } from "@dappnode/common"; +import { InstalledPackageDetailData } from "@dappnode/types"; +import { Manifest } from "@dappnode/types"; import { ipfsGatewayUrl } from "pages/system/data"; import { RemovePackage } from "./RemovePackage"; import { VolumesList } from "./VolumesList"; diff --git a/packages/admin-ui/src/pages/packages/components/Logs.tsx b/packages/admin-ui/src/pages/packages/components/Logs.tsx index d67a87e36..56e68fbc4 100644 --- a/packages/admin-ui/src/pages/packages/components/Logs.tsx +++ b/packages/admin-ui/src/pages/packages/components/Logs.tsx @@ -10,7 +10,7 @@ import { ServiceSelector } from "./ServiceSelector"; // Utils import newTabProps from "utils/newTabProps"; import { stringIncludes, stringSplit } from "utils/strings"; -import { PackageContainer } from "@dappnode/common"; +import { PackageContainer } from "@dappnode/types"; import "./logs.scss"; const refreshInterval = 2 * 1000; diff --git a/packages/admin-ui/src/pages/packages/components/Network/HttpsMappings.tsx b/packages/admin-ui/src/pages/packages/components/Network/HttpsMappings.tsx index 64e484607..0a3305ca0 100644 --- a/packages/admin-ui/src/pages/packages/components/Network/HttpsMappings.tsx +++ b/packages/admin-ui/src/pages/packages/components/Network/HttpsMappings.tsx @@ -20,7 +20,7 @@ import ErrorView from "components/ErrorView"; import Ok from "components/Ok"; import { prettyFullName } from "utils/format"; import newTabProps from "utils/newTabProps"; -import { HttpsPortalMapping } from "@dappnode/common"; +import { HttpsPortalMapping } from "@dappnode/types"; import { httpsPortalDnpName } from "params"; import "./https-mapping.scss"; import { urlJoin } from "utils/url"; diff --git a/packages/admin-ui/src/pages/packages/components/Network/PortsByService.tsx b/packages/admin-ui/src/pages/packages/components/Network/PortsByService.tsx index 08867a84d..995665c4f 100644 --- a/packages/admin-ui/src/pages/packages/components/Network/PortsByService.tsx +++ b/packages/admin-ui/src/pages/packages/components/Network/PortsByService.tsx @@ -14,7 +14,7 @@ import { InstalledPackageData, PortMapping, PortProtocol -} from "@dappnode/common"; +} from "@dappnode/types"; const maxPortNumber = 32768 - 1; const maxEphemeralPortNumber = 65535; diff --git a/packages/admin-ui/src/pages/packages/components/Network/index.tsx b/packages/admin-ui/src/pages/packages/components/Network/index.tsx index 9ee7750c9..a36bee50a 100644 --- a/packages/admin-ui/src/pages/packages/components/Network/index.tsx +++ b/packages/admin-ui/src/pages/packages/components/Network/index.tsx @@ -2,7 +2,7 @@ import React from "react"; import { useState } from "react"; import Card from "components/Card"; import SubTitle from "components/SubTitle"; -import { PackageContainer } from "@dappnode/common"; +import { PackageContainer } from "@dappnode/types"; import { ServiceSelector } from "../ServiceSelector"; import { PortsByService } from "./PortsByService"; import { HttpsMappings } from "./HttpsMappings"; diff --git a/packages/admin-ui/src/pages/packages/components/ServiceSelector.tsx b/packages/admin-ui/src/pages/packages/components/ServiceSelector.tsx index d6503d8f5..13298c912 100644 --- a/packages/admin-ui/src/pages/packages/components/ServiceSelector.tsx +++ b/packages/admin-ui/src/pages/packages/components/ServiceSelector.tsx @@ -1,6 +1,6 @@ import React from "react"; import Select from "components/Select"; -import { PackageContainer } from "@dappnode/common"; +import { PackageContainer } from "@dappnode/types"; export function ServiceSelector({ serviceName, diff --git a/packages/admin-ui/src/pages/packages/components/StateBadge/StateBadgeDnp.tsx b/packages/admin-ui/src/pages/packages/components/StateBadge/StateBadgeDnp.tsx index 44a2380fc..a955650e3 100644 --- a/packages/admin-ui/src/pages/packages/components/StateBadge/StateBadgeDnp.tsx +++ b/packages/admin-ui/src/pages/packages/components/StateBadge/StateBadgeDnp.tsx @@ -1,5 +1,5 @@ import React from "react"; -import { InstalledPackageData } from "@dappnode/common"; +import { InstalledPackageData } from "@dappnode/types"; import { StateBadgeContainer } from "./StateBadgeContainer"; import { allContainersHaveSameVariant, parseContainerState } from "./utils"; import "./stateBadge.scss"; diff --git a/packages/admin-ui/src/pages/packages/components/StateBadge/StateBadgeLegend.tsx b/packages/admin-ui/src/pages/packages/components/StateBadge/StateBadgeLegend.tsx index 89b2f8662..cfebcc775 100644 --- a/packages/admin-ui/src/pages/packages/components/StateBadge/StateBadgeLegend.tsx +++ b/packages/admin-ui/src/pages/packages/components/StateBadge/StateBadgeLegend.tsx @@ -1,5 +1,5 @@ import React from "react"; -import { InstalledPackageData } from "@dappnode/common"; +import { InstalledPackageData } from "@dappnode/types"; import { allContainersHaveSameVariant, BadgeVariant, diff --git a/packages/admin-ui/src/pages/packages/components/StateBadge/utils.ts b/packages/admin-ui/src/pages/packages/components/StateBadge/utils.ts index cec9727cd..de1f2f345 100644 --- a/packages/admin-ui/src/pages/packages/components/StateBadge/utils.ts +++ b/packages/admin-ui/src/pages/packages/components/StateBadge/utils.ts @@ -1,4 +1,4 @@ -import { PackageContainer } from "@dappnode/common"; +import { PackageContainer } from "@dappnode/types"; export type SimpleState = | "stopped" diff --git a/packages/admin-ui/src/pages/repository/components/Eth.tsx b/packages/admin-ui/src/pages/repository/components/Eth.tsx index 548a03f57..47b197172 100644 --- a/packages/admin-ui/src/pages/repository/components/Eth.tsx +++ b/packages/admin-ui/src/pages/repository/components/Eth.tsx @@ -5,7 +5,7 @@ import { getEthClientStatus, getEthClientFallback } from "services/dappnodeStatus/selectors"; -import { EthClientFallback, Eth2ClientTarget } from "@dappnode/common"; +import { EthClientFallback, Eth2ClientTarget } from "@dappnode/types"; import { changeEthClientTarget } from "pages/system/actions"; import { withToastNoThrow } from "components/toast/Toast"; import { api } from "api"; diff --git a/packages/admin-ui/src/pages/repository/components/Ipfs.tsx b/packages/admin-ui/src/pages/repository/components/Ipfs.tsx index 2fefd9010..757226ba1 100644 --- a/packages/admin-ui/src/pages/repository/components/Ipfs.tsx +++ b/packages/admin-ui/src/pages/repository/components/Ipfs.tsx @@ -1,6 +1,6 @@ import React, { useState, useEffect } from "react"; import { useApi, api } from "api"; -import { IpfsClientTarget } from "@dappnode/common"; +import { IpfsClientTarget } from "@dappnode/types"; import { withToast } from "components/toast/Toast"; import SubTitle from "components/SubTitle"; import { IpfsClient } from "components/IpfsClient"; diff --git a/packages/admin-ui/src/pages/rollups/components/columns/ExecutionClient.tsx b/packages/admin-ui/src/pages/rollups/components/columns/ExecutionClient.tsx index 5515ab7d1..aab178837 100644 --- a/packages/admin-ui/src/pages/rollups/components/columns/ExecutionClient.tsx +++ b/packages/admin-ui/src/pages/rollups/components/columns/ExecutionClient.tsx @@ -2,7 +2,7 @@ import React from "react"; import Card from "components/Card"; import { prettyDnpName } from "utils/format"; import { joinCssClass } from "utils/css"; -import { OptimismItem, OptimismItemOk } from "@dappnode/common"; +import { OptimismItem, OptimismItemOk } from "@dappnode/types"; import defaultAvatar from "img/defaultAvatar.png"; import errorAvatar from "img/errorAvatarTrim.png"; import Button from "components/Button"; diff --git a/packages/admin-ui/src/pages/rollups/components/columns/LegacyGeth.tsx b/packages/admin-ui/src/pages/rollups/components/columns/LegacyGeth.tsx index 98e866e01..ac3ead043 100644 --- a/packages/admin-ui/src/pages/rollups/components/columns/LegacyGeth.tsx +++ b/packages/admin-ui/src/pages/rollups/components/columns/LegacyGeth.tsx @@ -1,5 +1,5 @@ import React from "react"; -import { OptimismItem, OptimismItemOk } from "@dappnode/common"; +import { OptimismItem, OptimismItemOk } from "@dappnode/types"; import Card from "components/Card"; import { prettyDnpName } from "utils/format"; import { joinCssClass } from "utils/css"; diff --git a/packages/admin-ui/src/pages/rollups/components/columns/OptimismNode.tsx b/packages/admin-ui/src/pages/rollups/components/columns/OptimismNode.tsx index c2299897d..a94cbab04 100644 --- a/packages/admin-ui/src/pages/rollups/components/columns/OptimismNode.tsx +++ b/packages/admin-ui/src/pages/rollups/components/columns/OptimismNode.tsx @@ -1,5 +1,5 @@ import React from "react"; -import { OptimismItem, OptimismItemOk } from "@dappnode/common"; +import { OptimismItem, OptimismItemOk } from "@dappnode/types"; import Card from "components/Card"; import { prettyDnpName } from "utils/format"; import { joinCssClass } from "utils/css"; diff --git a/packages/admin-ui/src/pages/rollups/components/useOptimismConfig.ts b/packages/admin-ui/src/pages/rollups/components/useOptimismConfig.ts index d2c4f7748..911b840e2 100644 --- a/packages/admin-ui/src/pages/rollups/components/useOptimismConfig.ts +++ b/packages/admin-ui/src/pages/rollups/components/useOptimismConfig.ts @@ -6,7 +6,7 @@ import { OptimismItemOk, OptimismType, OptimismItem -} from "@dappnode/common"; +} from "@dappnode/types"; import { responseInterface } from "swr"; export const useOptimismConfig = ( @@ -162,7 +162,7 @@ function getChanges({ }; // Not allowed if mainnet RPC is modified and there is no Rollup - if ((rollup?.mainnetRpcUrl !== customMainnetRpcUrl) && !newRollup) + if (rollup?.mainnetRpcUrl !== customMainnetRpcUrl && !newRollup) return { isAllowed: false, reason: "Mainnet RPC modified without OP Node", diff --git a/packages/admin-ui/src/pages/stakers/components/StakerNetwork.tsx b/packages/admin-ui/src/pages/stakers/components/StakerNetwork.tsx index 18bf9a0a4..761ccbb68 100644 --- a/packages/admin-ui/src/pages/stakers/components/StakerNetwork.tsx +++ b/packages/admin-ui/src/pages/stakers/components/StakerNetwork.tsx @@ -4,7 +4,7 @@ import { withToast } from "components/toast/Toast"; import Card from "components/Card"; import Col from "react-bootstrap/Col"; import Row from "react-bootstrap/Row"; -import { StakerConfigGet, StakerConfigGetOk } from "@dappnode/common"; +import { StakerConfigGet, StakerConfigGetOk } from "@dappnode/types"; import { api, useApi } from "api"; import ErrorView from "components/ErrorView"; import { confirm } from "components/ConfirmDialog"; @@ -21,7 +21,7 @@ import "./columns.scss"; import { AppContext } from "App"; import LaunchpadValidators from "./launchpad/LaunchpadValidators"; import { FaEthereum } from "react-icons/fa"; -import { Network } from "@dappnode/common"; +import { Network } from "@dappnode/types"; import { useStakerConfig } from "./useStakerConfig"; import { AlertDismissible } from "components/AlertDismissible"; diff --git a/packages/admin-ui/src/pages/stakers/components/columns/ConsensusClient.tsx b/packages/admin-ui/src/pages/stakers/components/columns/ConsensusClient.tsx index 8e24330fc..e14a9b611 100644 --- a/packages/admin-ui/src/pages/stakers/components/columns/ConsensusClient.tsx +++ b/packages/admin-ui/src/pages/stakers/components/columns/ConsensusClient.tsx @@ -2,7 +2,7 @@ import React, { useState } from "react"; import Card from "components/Card"; import { prettyDnpName } from "utils/format"; import { joinCssClass } from "utils/css"; -import { StakerItem, StakerItemOk, Network } from "@dappnode/common"; +import { StakerItem, StakerItemOk, Network } from "@dappnode/types"; import defaultAvatar from "img/defaultAvatar.png"; import errorAvatar from "img/errorAvatarTrim.png"; import Button from "components/Button"; diff --git a/packages/admin-ui/src/pages/stakers/components/columns/ExecutionClient.tsx b/packages/admin-ui/src/pages/stakers/components/columns/ExecutionClient.tsx index 148900a82..aa04b734f 100644 --- a/packages/admin-ui/src/pages/stakers/components/columns/ExecutionClient.tsx +++ b/packages/admin-ui/src/pages/stakers/components/columns/ExecutionClient.tsx @@ -2,7 +2,7 @@ import React from "react"; import Card from "components/Card"; import { prettyDnpName } from "utils/format"; import { joinCssClass } from "utils/css"; -import { StakerItem, StakerItemOk, Network } from "@dappnode/common"; +import { StakerItem, StakerItemOk, Network } from "@dappnode/types"; import defaultAvatar from "img/defaultAvatar.png"; import errorAvatar from "img/errorAvatarTrim.png"; import Button from "components/Button"; diff --git a/packages/admin-ui/src/pages/stakers/components/columns/MevBoost.tsx b/packages/admin-ui/src/pages/stakers/components/columns/MevBoost.tsx index 1b61e63d0..8ab21a747 100644 --- a/packages/admin-ui/src/pages/stakers/components/columns/MevBoost.tsx +++ b/packages/admin-ui/src/pages/stakers/components/columns/MevBoost.tsx @@ -2,7 +2,7 @@ import React, { useState } from "react"; import Card from "components/Card"; import { prettyDnpName } from "utils/format"; import { joinCssClass } from "utils/css"; -import { StakerItem, StakerItemOk, Network } from "@dappnode/common"; +import { StakerItem, StakerItemOk, Network } from "@dappnode/types"; import defaultAvatar from "img/defaultAvatar.png"; import errorAvatar from "img/errorAvatarTrim.png"; import Button from "components/Button"; diff --git a/packages/admin-ui/src/pages/stakers/components/columns/RemoteSigner.tsx b/packages/admin-ui/src/pages/stakers/components/columns/RemoteSigner.tsx index 063c69ce4..4ea6221ca 100644 --- a/packages/admin-ui/src/pages/stakers/components/columns/RemoteSigner.tsx +++ b/packages/admin-ui/src/pages/stakers/components/columns/RemoteSigner.tsx @@ -4,7 +4,7 @@ import { prettyDnpName } from "utils/format"; import { joinCssClass } from "utils/css"; import defaultAvatar from "img/defaultAvatar.png"; import errorAvatar from "img/errorAvatarTrim.png"; -import { StakerItem, Network } from "@dappnode/common"; +import { StakerItem, Network } from "@dappnode/types"; import Button from "components/Button"; import { getInstallerPath } from "pages/installer"; import { useNavigate } from "react-router-dom"; diff --git a/packages/admin-ui/src/pages/stakers/components/launchpad/LaunchpadSteps.tsx b/packages/admin-ui/src/pages/stakers/components/launchpad/LaunchpadSteps.tsx index 80a919c5d..b689037de 100644 --- a/packages/admin-ui/src/pages/stakers/components/launchpad/LaunchpadSteps.tsx +++ b/packages/admin-ui/src/pages/stakers/components/launchpad/LaunchpadSteps.tsx @@ -3,7 +3,7 @@ import React from "react"; import ConsensusClient from "../columns/ConsensusClient"; import ExecutionClient from "../columns/ExecutionClient"; import MevBoost from "../columns/MevBoost"; -import { StakerConfigGetOk, StakerItemOk, Network } from "@dappnode/common"; +import { StakerConfigGetOk, StakerItemOk, Network } from "@dappnode/types"; import { disclaimer } from "pages/stakers/data"; import RenderMarkdown from "components/RenderMarkdown"; export const launchpadSteps = ({ diff --git a/packages/admin-ui/src/pages/stakers/components/launchpad/LaunchpadValidators.tsx b/packages/admin-ui/src/pages/stakers/components/launchpad/LaunchpadValidators.tsx index 10e7dcad8..c59c7ac29 100644 --- a/packages/admin-ui/src/pages/stakers/components/launchpad/LaunchpadValidators.tsx +++ b/packages/admin-ui/src/pages/stakers/components/launchpad/LaunchpadValidators.tsx @@ -1,8 +1,8 @@ import React, { useEffect, useState } from "react"; import "./launchpad-validators.scss"; import Button from "components/Button"; -import { StakerItemOk } from "@dappnode/common"; -import { StakerConfigGetOk, Network } from "@dappnode/common"; +import { StakerItemOk } from "@dappnode/types"; +import { StakerConfigGetOk, Network } from "@dappnode/types"; import { launchpadSteps } from "./LaunchpadSteps"; export default function LaunchpadValidators({ diff --git a/packages/admin-ui/src/pages/stakers/components/useStakerConfig.ts b/packages/admin-ui/src/pages/stakers/components/useStakerConfig.ts index e0b5b70ea..6395ab60c 100644 --- a/packages/admin-ui/src/pages/stakers/components/useStakerConfig.ts +++ b/packages/admin-ui/src/pages/stakers/components/useStakerConfig.ts @@ -7,7 +7,7 @@ import { StakerType, StakerItem, Network -} from "@dappnode/common"; +} from "@dappnode/types"; import { responseInterface } from "swr"; export const useStakerConfig = ( @@ -169,7 +169,9 @@ function getChanges({ const isExecAndConsDeSelected = Boolean(!newExecClient && !newConsClient); // Order and compare relays, returns true if changes were made - const mevBoostRelaysChanged = (newMevBoost?.relays || []).sort().join(',') !== (mevBoost?.relays || []).sort().join(','); + const mevBoostRelaysChanged = + (newMevBoost?.relays || []).sort().join(",") !== + (mevBoost?.relays || []).sort().join(","); // Not allowed if no changes if ( @@ -216,7 +218,6 @@ function getChanges({ return { isAllowed: true }; } - function isOkSelectedInstalledAndRunning< T extends Network, P extends StakerType diff --git a/packages/admin-ui/src/pages/support/components/Activity.tsx b/packages/admin-ui/src/pages/support/components/Activity.tsx index c15adb859..4f32c3fbe 100644 --- a/packages/admin-ui/src/pages/support/components/Activity.tsx +++ b/packages/admin-ui/src/pages/support/components/Activity.tsx @@ -1,6 +1,6 @@ import React, { useState, useEffect, useMemo } from "react"; import { useSubscription, useApi, apiRoutes } from "api"; -import { UserActionLog } from "@dappnode/common"; +import { UserActionLog } from "@dappnode/types"; // Components import CardList from "components/CardList"; import ErrorView from "components/ErrorView"; diff --git a/packages/admin-ui/src/pages/support/components/PortsStatusTable.tsx b/packages/admin-ui/src/pages/support/components/PortsStatusTable.tsx index ad09bf2bf..8253e0a27 100644 --- a/packages/admin-ui/src/pages/support/components/PortsStatusTable.tsx +++ b/packages/admin-ui/src/pages/support/components/PortsStatusTable.tsx @@ -14,7 +14,7 @@ import { ApiTablePortStatus, PortToOpen, UpnpTablePortStatus -} from "@dappnode/common"; +} from "@dappnode/types"; import Switch from "components/Switch"; function RenderApiStatus({ diff --git a/packages/admin-ui/src/pages/support/components/Report.tsx b/packages/admin-ui/src/pages/support/components/Report.tsx index 323b06ce6..0a7df1e59 100644 --- a/packages/admin-ui/src/pages/support/components/Report.tsx +++ b/packages/admin-ui/src/pages/support/components/Report.tsx @@ -6,7 +6,7 @@ import Card from "components/Card"; import RenderMarkdown from "components/RenderMarkdown"; import { formatTopicBody, formatTopicUrl } from "../formaters/discourseTopic"; import { topicBaseUrl, dappnodeForumUrl } from "params"; -import { PackageVersionData, HostDiagnoseItem } from "@dappnode/common"; +import { PackageVersionData, HostDiagnoseItem } from "@dappnode/types"; import Ok from "components/Ok"; import { FaDiscourse } from "react-icons/fa"; import { MdChevronRight } from "react-icons/md"; diff --git a/packages/admin-ui/src/pages/support/formaters/autoDiagnoseTexts.ts b/packages/admin-ui/src/pages/support/formaters/autoDiagnoseTexts.ts index 56efb62af..978d18b83 100644 --- a/packages/admin-ui/src/pages/support/formaters/autoDiagnoseTexts.ts +++ b/packages/admin-ui/src/pages/support/formaters/autoDiagnoseTexts.ts @@ -4,7 +4,7 @@ import { InstalledPackageData, HostStatDisk, PublicIpResponse -} from "@dappnode/common"; +} from "@dappnode/types"; import { mandatoryCoreDnps } from "params"; import { responseInterface } from "swr"; diff --git a/packages/admin-ui/src/pages/support/formaters/discourseTopic.ts b/packages/admin-ui/src/pages/support/formaters/discourseTopic.ts index 0a8765ab4..4182ed17b 100644 --- a/packages/admin-ui/src/pages/support/formaters/discourseTopic.ts +++ b/packages/admin-ui/src/pages/support/formaters/discourseTopic.ts @@ -1,4 +1,4 @@ -import { PackageVersionData, HostDiagnoseItem } from "@dappnode/common"; +import { PackageVersionData, HostDiagnoseItem } from "@dappnode/types"; import { topicBaseUrl } from "params"; /** diff --git a/packages/admin-ui/src/pages/system/actions.ts b/packages/admin-ui/src/pages/system/actions.ts index 7e5a8ff5f..479709ed0 100644 --- a/packages/admin-ui/src/pages/system/actions.ts +++ b/packages/admin-ui/src/pages/system/actions.ts @@ -7,7 +7,7 @@ import { fetchPasswordIsSecure } from "services/dappnodeStatus/actions"; import { getEthClientTarget } from "services/dappnodeStatus/selectors"; import { withToastNoThrow } from "components/toast/Toast"; import { AppThunk } from "store"; -import { Eth2ClientTarget } from "@dappnode/common"; +import { Eth2ClientTarget } from "@dappnode/types"; import { isEqual } from "lodash-es"; // Redux Thunk actions diff --git a/packages/admin-ui/src/pages/system/components/Advanced/ReleaseTrustedKeysEditor.tsx b/packages/admin-ui/src/pages/system/components/Advanced/ReleaseTrustedKeysEditor.tsx index f2784acc2..7bb5e2aae 100644 --- a/packages/admin-ui/src/pages/system/components/Advanced/ReleaseTrustedKeysEditor.tsx +++ b/packages/admin-ui/src/pages/system/components/Advanced/ReleaseTrustedKeysEditor.tsx @@ -11,7 +11,7 @@ import { TrustedReleaseKey, ReleaseSignatureProtocol, releaseSignatureProtocols -} from "@dappnode/common"; +} from "@dappnode/types"; import "./releaseTrustedKeysEditor.scss"; import { MdClose } from "react-icons/md"; diff --git a/packages/admin-ui/src/pages/system/components/Advanced/SshManager/ChangeStatus.tsx b/packages/admin-ui/src/pages/system/components/Advanced/SshManager/ChangeStatus.tsx index 9de9c5678..f9cf9a7af 100644 --- a/packages/admin-ui/src/pages/system/components/Advanced/SshManager/ChangeStatus.tsx +++ b/packages/admin-ui/src/pages/system/components/Advanced/SshManager/ChangeStatus.tsx @@ -8,7 +8,7 @@ import { confirm } from "components/ConfirmDialog"; import { ReqStatus } from "types"; import "./sshManager.scss"; import { withToast } from "components/toast/Toast"; -import { ShhStatus } from "@dappnode/common"; +import { ShhStatus } from "@dappnode/types"; export function SshManagerChangeStatus() { const [reqGetStatus, setReqGetStatus] = useState>({}); diff --git a/packages/admin-ui/src/pages/system/components/Hardware/Lvm.tsx b/packages/admin-ui/src/pages/system/components/Hardware/Lvm.tsx index 26f14e35e..110a375b4 100644 --- a/packages/admin-ui/src/pages/system/components/Hardware/Lvm.tsx +++ b/packages/admin-ui/src/pages/system/components/Hardware/Lvm.tsx @@ -3,7 +3,7 @@ import { HostLogicalVolume, HostHardDisk, HostVolumeGroup -} from "@dappnode/common"; +} from "@dappnode/types"; import { api } from "api"; import Button from "components/Button"; import Ok from "components/Ok"; diff --git a/packages/admin-ui/src/pages/system/components/Network/HttpsMappings.tsx b/packages/admin-ui/src/pages/system/components/Network/HttpsMappings.tsx index bf99745ef..a1a80ce11 100644 --- a/packages/admin-ui/src/pages/system/components/Network/HttpsMappings.tsx +++ b/packages/admin-ui/src/pages/system/components/Network/HttpsMappings.tsx @@ -18,7 +18,7 @@ import { ReqStatus } from "types"; import { httpsPortalDnpName } from "params"; import "./https-mapping.scss"; import Button from "components/Button"; -import { ExposableServiceInfo, HttpsPortalMapping } from "@dappnode/common"; +import { ExposableServiceInfo, HttpsPortalMapping } from "@dappnode/types"; export function HttpsMappings() { const navigate = useNavigate(); diff --git a/packages/admin-ui/src/pages/system/components/SystemUpdate/SystemUpdateDetails.tsx b/packages/admin-ui/src/pages/system/components/SystemUpdate/SystemUpdateDetails.tsx index 9c4765878..0c19e4b1e 100644 --- a/packages/admin-ui/src/pages/system/components/SystemUpdate/SystemUpdateDetails.tsx +++ b/packages/admin-ui/src/pages/system/components/SystemUpdate/SystemUpdateDetails.tsx @@ -11,7 +11,7 @@ import Card from "components/Card"; import Button from "components/Button"; // Icons import { FaArrowRight } from "react-icons/fa"; -import { DependencyListItem } from "@dappnode/common"; +import { DependencyListItem } from "@dappnode/types"; export default function SystemUpdateDetails() { const coreUpdateData = useSelector(getCoreUpdateData); diff --git a/packages/admin-ui/src/pages/system/components/VolumesGrid.tsx b/packages/admin-ui/src/pages/system/components/VolumesGrid.tsx index 282577713..a9416deac 100644 --- a/packages/admin-ui/src/pages/system/components/VolumesGrid.tsx +++ b/packages/admin-ui/src/pages/system/components/VolumesGrid.tsx @@ -15,7 +15,7 @@ import { } from "utils/format"; import { parseStaticDate } from "utils/dates"; import { joinCssClass } from "utils/css"; -import { VolumeData } from "@dappnode/common"; +import { VolumeData } from "@dappnode/types"; // Selectors import { getVolumes } from "services/dappnodeStatus/selectors"; // Actions diff --git a/packages/admin-ui/src/pages/vpn/components/openvpn/OpenVpnDeviceDetails.tsx b/packages/admin-ui/src/pages/vpn/components/openvpn/OpenVpnDeviceDetails.tsx index b4dd92ad5..a6e676e8b 100755 --- a/packages/admin-ui/src/pages/vpn/components/openvpn/OpenVpnDeviceDetails.tsx +++ b/packages/admin-ui/src/pages/vpn/components/openvpn/OpenVpnDeviceDetails.tsx @@ -19,7 +19,7 @@ import Title from "components/Title"; import { MdOpenInNew } from "react-icons/md"; import { GoCopy } from "react-icons/go"; import { urlJoin } from "utils/url"; -import { VpnDeviceCredentials } from "@dappnode/common"; +import { VpnDeviceCredentials } from "@dappnode/types"; function OpenVpnDeviceDetailsLoaded({ device diff --git a/packages/admin-ui/src/pages/vpn/components/wireguard/WireguardDeviceDetails.tsx b/packages/admin-ui/src/pages/vpn/components/wireguard/WireguardDeviceDetails.tsx index c5e754582..10108bbdf 100755 --- a/packages/admin-ui/src/pages/vpn/components/wireguard/WireguardDeviceDetails.tsx +++ b/packages/admin-ui/src/pages/vpn/components/wireguard/WireguardDeviceDetails.tsx @@ -17,7 +17,7 @@ import { apiRoutes } from "api"; import { FiDownload } from "react-icons/fi"; import { GoCopy } from "react-icons/go"; import { FaQrcode } from "react-icons/fa"; -import { WireguardDeviceCredentials } from "@dappnode/common"; +import { WireguardDeviceCredentials } from "@dappnode/types"; // Utils import { urlJoin } from "utils/url"; diff --git a/packages/admin-ui/src/pages/wifi/components/localProxying/LocalProxying.tsx b/packages/admin-ui/src/pages/wifi/components/localProxying/LocalProxying.tsx index 01d0dfe77..5b252a7e5 100644 --- a/packages/admin-ui/src/pages/wifi/components/localProxying/LocalProxying.tsx +++ b/packages/admin-ui/src/pages/wifi/components/localProxying/LocalProxying.tsx @@ -19,7 +19,7 @@ import { StateBadge } from "pages/packages/components/StateBadge"; import { MdWifi } from "react-icons/md"; import { parseContainerState } from "pages/packages/components/StateBadge/utils"; import Alert from "react-bootstrap/esm/Alert"; -import { LocalProxyingStatus } from "@dappnode/common"; +import { LocalProxyingStatus } from "@dappnode/types"; import { useNavigate } from "react-router-dom"; import LinkDocs from "components/LinkDocs"; diff --git a/packages/admin-ui/src/pages/wifi/components/wifi/WifiStatus.tsx b/packages/admin-ui/src/pages/wifi/components/wifi/WifiStatus.tsx index 2c72669ee..b43f6e18f 100644 --- a/packages/admin-ui/src/pages/wifi/components/wifi/WifiStatus.tsx +++ b/packages/admin-ui/src/pages/wifi/components/wifi/WifiStatus.tsx @@ -14,7 +14,7 @@ import { api, useApi } from "api"; import { continueIfCalleDisconnected } from "api/utils"; import { getDappnodeIdentityClean } from "services/dappnodeStatus/selectors"; // Types -import { ContainerState, WifiReport } from "@dappnode/common"; +import { ContainerState, WifiReport } from "@dappnode/types"; import { docsUrl, wifiDnpName } from "./../../../../params"; import { StateBadgeContainer } from "pages/packages/components/StateBadge"; diff --git a/packages/admin-ui/src/services/coreUpdate/reducer.ts b/packages/admin-ui/src/services/coreUpdate/reducer.ts index b5cb8555c..8904c39ab 100644 --- a/packages/admin-ui/src/services/coreUpdate/reducer.ts +++ b/packages/admin-ui/src/services/coreUpdate/reducer.ts @@ -1,6 +1,6 @@ import { mapValues } from "lodash-es"; import { PayloadAction, createSlice } from "@reduxjs/toolkit"; -import { CoreUpdateData, RequestStatus } from "@dappnode/common"; +import { CoreUpdateData, RequestStatus } from "@dappnode/types"; // Service > coreUpdate diff --git a/packages/admin-ui/src/services/dappnodeStatus/reducer.ts b/packages/admin-ui/src/services/dappnodeStatus/reducer.ts index 11961c9c1..66afbeed2 100644 --- a/packages/admin-ui/src/services/dappnodeStatus/reducer.ts +++ b/packages/admin-ui/src/services/dappnodeStatus/reducer.ts @@ -1,5 +1,5 @@ import { mapValues } from "lodash-es"; -import { RebootRequiredScript, SystemInfo, VolumeData } from "@dappnode/common"; +import { RebootRequiredScript, SystemInfo, VolumeData } from "@dappnode/types"; import { createSlice, PayloadAction } from "@reduxjs/toolkit"; import { WifiCredentials } from "types"; diff --git a/packages/admin-ui/src/services/dappnodeStatus/selectors.ts b/packages/admin-ui/src/services/dappnodeStatus/selectors.ts index 9b04c831d..9ff2baf3f 100644 --- a/packages/admin-ui/src/services/dappnodeStatus/selectors.ts +++ b/packages/admin-ui/src/services/dappnodeStatus/selectors.ts @@ -3,7 +3,7 @@ import { getEthClientPrettyStatusError, getEthClientType } from "components/EthMultiClient"; -import { ChainData } from "@dappnode/common"; +import { ChainData } from "@dappnode/types"; import { activateFallbackPath } from "pages/system/data"; import { getDnpInstalled } from "services/dnpInstalled/selectors"; import { wifiDnpName } from "params"; diff --git a/packages/admin-ui/src/services/dnpDirectory/actions.ts b/packages/admin-ui/src/services/dnpDirectory/actions.ts index 085f6621f..6dcdecbf5 100644 --- a/packages/admin-ui/src/services/dnpDirectory/actions.ts +++ b/packages/admin-ui/src/services/dnpDirectory/actions.ts @@ -1,6 +1,6 @@ import { createAction } from "@reduxjs/toolkit"; import { api } from "api"; -import { DirectoryItem, RequestStatus } from "@dappnode/common"; +import { DirectoryItem, RequestStatus } from "@dappnode/types"; import { AppThunk } from "store"; // Service > dnpDirectory diff --git a/packages/admin-ui/src/services/dnpDirectory/reducer.ts b/packages/admin-ui/src/services/dnpDirectory/reducer.ts index 55f0c78a0..98dbd8a36 100644 --- a/packages/admin-ui/src/services/dnpDirectory/reducer.ts +++ b/packages/admin-ui/src/services/dnpDirectory/reducer.ts @@ -1,7 +1,7 @@ import { keyBy } from "lodash-es"; import { createReducer } from "@reduxjs/toolkit"; import { setDnpDirectory, updateDnpDirectory, updateStatus } from "./actions"; -import { DirectoryItem, RequestStatus } from "@dappnode/common"; +import { DirectoryItem, RequestStatus } from "@dappnode/types"; // Service > dnpDirectory diff --git a/packages/admin-ui/src/services/dnpInstalled/reducer.ts b/packages/admin-ui/src/services/dnpInstalled/reducer.ts index c16b92926..2f7f0d57a 100644 --- a/packages/admin-ui/src/services/dnpInstalled/reducer.ts +++ b/packages/admin-ui/src/services/dnpInstalled/reducer.ts @@ -1,5 +1,5 @@ import { createSlice, PayloadAction } from "@reduxjs/toolkit"; -import { InstalledPackageData } from "@dappnode/common"; +import { InstalledPackageData } from "@dappnode/types"; // Service > dnpInstalled diff --git a/packages/admin-ui/src/services/dnpInstalled/selectors.ts b/packages/admin-ui/src/services/dnpInstalled/selectors.ts index a92439268..4503db079 100644 --- a/packages/admin-ui/src/services/dnpInstalled/selectors.ts +++ b/packages/admin-ui/src/services/dnpInstalled/selectors.ts @@ -1,5 +1,5 @@ import { RootState } from "rootReducer"; -import { InstalledPackageData } from "@dappnode/common"; +import { InstalledPackageData } from "@dappnode/types"; // Service > dnpInstalled diff --git a/packages/admin-ui/src/services/dnpRegistry/actions.ts b/packages/admin-ui/src/services/dnpRegistry/actions.ts index 6ed42cd3b..6a6d8f186 100644 --- a/packages/admin-ui/src/services/dnpRegistry/actions.ts +++ b/packages/admin-ui/src/services/dnpRegistry/actions.ts @@ -1,6 +1,6 @@ import { createAction } from "@reduxjs/toolkit"; import { api } from "api"; -import { DirectoryItem, RequestStatus } from "@dappnode/common"; +import { DirectoryItem, RequestStatus } from "@dappnode/types"; import { AppThunk } from "store"; // Service > dnpRegistry diff --git a/packages/admin-ui/src/services/dnpRegistry/reducer.ts b/packages/admin-ui/src/services/dnpRegistry/reducer.ts index e7d6be837..7a0703daf 100644 --- a/packages/admin-ui/src/services/dnpRegistry/reducer.ts +++ b/packages/admin-ui/src/services/dnpRegistry/reducer.ts @@ -1,7 +1,7 @@ import { keyBy } from "lodash-es"; import { createReducer } from "@reduxjs/toolkit"; import { setDnpRegistry, updateDnpRegistry, updateStatus } from "./actions"; -import { DirectoryItem, RequestStatus } from "@dappnode/common"; +import { DirectoryItem, RequestStatus } from "@dappnode/types"; // Service > dnpRegistry diff --git a/packages/admin-ui/src/services/notifications/reducer.ts b/packages/admin-ui/src/services/notifications/reducer.ts index 2e8758033..54364dd6a 100644 --- a/packages/admin-ui/src/services/notifications/reducer.ts +++ b/packages/admin-ui/src/services/notifications/reducer.ts @@ -1,6 +1,6 @@ import { mapValues } from "lodash-es"; import { createSlice, PayloadAction } from "@reduxjs/toolkit"; -import { PackageNotificationDb, PackageNotification } from "@dappnode/common"; +import { PackageNotificationDb, PackageNotification } from "@dappnode/types"; export const notificationsSlice = createSlice({ name: "notifications", diff --git a/packages/admin-ui/src/types.ts b/packages/admin-ui/src/types.ts index 17da4efe0..219b7c704 100644 --- a/packages/admin-ui/src/types.ts +++ b/packages/admin-ui/src/types.ts @@ -1,4 +1,5 @@ -import { PackageVersionData, SetupTarget } from "@dappnode/common"; +import { PackageVersionData } from "@dappnode/types"; +import { SetupTarget } from "@dappnode/types"; export interface WifiCredentials { ssid: string; diff --git a/packages/admin-ui/src/utils/format.ts b/packages/admin-ui/src/utils/format.ts index a752f1fd6..cd29842e4 100644 --- a/packages/admin-ui/src/utils/format.ts +++ b/packages/admin-ui/src/utils/format.ts @@ -1,7 +1,7 @@ import { capitalize, stringEndsWith } from "utils/strings"; import { stringSplit } from "./strings"; import prettyBytesLib from "pretty-bytes"; -import { VolumeData } from "@dappnode/common"; +import { VolumeData } from "@dappnode/types"; export function prettyFullName({ dnpName, diff --git a/packages/admin-ui/src/utils/getRepoSlugFromManifest.ts b/packages/admin-ui/src/utils/getRepoSlugFromManifest.ts index b01bf3d27..540a5590b 100644 --- a/packages/admin-ui/src/utils/getRepoSlugFromManifest.ts +++ b/packages/admin-ui/src/utils/getRepoSlugFromManifest.ts @@ -1,5 +1,5 @@ import { stringSplit, stringIncludes } from "./strings"; -import { Manifest } from "@dappnode/common"; +import { Manifest } from "@dappnode/types"; const githubBaseUrl = "https://github.com/"; diff --git a/packages/chains/package.json b/packages/chains/package.json index d901fd3c0..194b43125 100644 --- a/packages/chains/package.json +++ b/packages/chains/package.json @@ -19,7 +19,7 @@ "lint": "eslint . --ext .ts --fix src" }, "dependencies": { - "@dappnode/common": "^0.1.0", + "@dappnode/types": "^0.1.0", "@dappnode/dockerapi": "^0.1.0", "@dappnode/logger": "^0.1.0", "@dappnode/utils": "^0.1.0", diff --git a/packages/chains/src/drivers/bitcoin.ts b/packages/chains/src/drivers/bitcoin.ts index 786993863..924328071 100644 --- a/packages/chains/src/drivers/bitcoin.ts +++ b/packages/chains/src/drivers/bitcoin.ts @@ -1,6 +1,6 @@ // @ts-ignore import Client from "bitcoin-core"; -import { InstalledPackageData } from "@dappnode/common"; +import { InstalledPackageData } from "@dappnode/types"; import { dockerContainerInspect } from "@dappnode/dockerapi"; import { buildNetworkAlias, parseEnvironment } from "@dappnode/utils"; import { ChainDataResult } from "../types.js"; @@ -40,7 +40,7 @@ export async function bitcoin( const containerDomain = buildNetworkAlias({ dnpName, serviceName, - isMainOrMonoservice: true + isMainOrMonoservice: true, }); const apiUrl = containerDomain; // 'bitcoin.dappnode' @@ -59,7 +59,7 @@ export async function bitcoin( host: apiUrl, username, password, - port // If port is falsy, it will take the default value. From source code: `this.port = port || networks[network];` + port, // If port is falsy, it will take the default value. From source code: `this.port = port || networks[network];` }); const blockIndex = await client.getBlockCount(); @@ -80,13 +80,13 @@ export async function bitcoin( syncing: true, error: false, message: `Blocks synced: ${blockIndex} / ${blockDiffAprox + blockIndex}`, - progress: blockIndex / (blockDiffAprox + blockIndex) + progress: blockIndex / (blockDiffAprox + blockIndex), }; else return { syncing: false, error: false, - message: `Synced #${blockIndex}` + message: `Synced #${blockIndex}`, }; } @@ -113,9 +113,9 @@ export function parseCredentialsFromEnvs(envsArray: string[]): { const keys = Object.keys(envs); // Find keys for both bitcoin and zcash packages - const userKey = keys.find(key => key.includes("_RPCUSER")); - const passKey = keys.find(key => key.includes("_RPCPASSWORD")); - const portKey = keys.find(key => key.includes("_RPCPORT")); + const userKey = keys.find((key) => key.includes("_RPCUSER")); + const passKey = keys.find((key) => key.includes("_RPCPASSWORD")); + const portKey = keys.find((key) => key.includes("_RPCPORT")); if (!userKey) throw Error("RPCUSER not defined"); if (!passKey) throw Error("RPCPASSWORD not defined"); diff --git a/packages/chains/src/drivers/ethereum.ts b/packages/chains/src/drivers/ethereum.ts index cb22ffb50..82ff609ef 100644 --- a/packages/chains/src/drivers/ethereum.ts +++ b/packages/chains/src/drivers/ethereum.ts @@ -1,5 +1,5 @@ import fetch from "node-fetch"; -import { InstalledPackageData, ChainDriverSpecs } from "@dappnode/common"; +import { ChainDriverSpecs, InstalledPackageData } from "@dappnode/types"; import { buildNetworkAlias, EthSyncing, diff --git a/packages/chains/src/drivers/ethereum2.ts b/packages/chains/src/drivers/ethereum2.ts index 3a80a783a..ad0505083 100644 --- a/packages/chains/src/drivers/ethereum2.ts +++ b/packages/chains/src/drivers/ethereum2.ts @@ -1,6 +1,6 @@ import fetch from "node-fetch"; import { buildNetworkAlias, urlJoin } from "@dappnode/utils"; -import { InstalledPackageData, ChainDriverSpecs } from "@dappnode/common"; +import { ChainDriverSpecs, InstalledPackageData } from "@dappnode/types"; import { ChainDataResult } from "../types.js"; import { safeProgress } from "../utils.js"; diff --git a/packages/chains/src/drivers/index.ts b/packages/chains/src/drivers/index.ts index 6b1603319..05a1bd3c5 100644 --- a/packages/chains/src/drivers/index.ts +++ b/packages/chains/src/drivers/index.ts @@ -1,8 +1,8 @@ import { - InstalledPackageData, ChainDriver, ChainDriverSpecs, -} from "@dappnode/common"; + InstalledPackageData, +} from "@dappnode/types"; import { ChainDataResult } from "../types.js"; // Drivers import { bitcoin } from "./bitcoin.js"; diff --git a/packages/chains/src/drivers/monero.ts b/packages/chains/src/drivers/monero.ts index f1a17f410..21c134ee1 100644 --- a/packages/chains/src/drivers/monero.ts +++ b/packages/chains/src/drivers/monero.ts @@ -1,6 +1,6 @@ // @ts-ignore import { Daemon } from "monero-rpc"; -import { InstalledPackageData } from "@dappnode/common"; +import { InstalledPackageData } from "@dappnode/types"; import { buildNetworkAlias } from "@dappnode/utils"; import { ChainDataResult } from "../types.js"; @@ -31,7 +31,7 @@ export async function monero( const containerDomain = buildNetworkAlias({ dnpName, serviceName, - isMainOrMonoservice: true + isMainOrMonoservice: true, }); // http://monero.dappnode:18081 @@ -54,13 +54,13 @@ export async function monero( syncing: true, error: false, message: `Blocks synced: ${currentBlock} / ${highestBlock}`, - progress: currentBlock / highestBlock + progress: currentBlock / highestBlock, }; } else { return { syncing: false, error: false, - message: `Synced #${currentBlock}` + message: `Synced #${currentBlock}`, }; } } diff --git a/packages/chains/src/getChainDriverName.ts b/packages/chains/src/getChainDriverName.ts index 88cf1e6ab..92328680d 100644 --- a/packages/chains/src/getChainDriverName.ts +++ b/packages/chains/src/getChainDriverName.ts @@ -1,4 +1,4 @@ -import { InstalledPackageData, ChainDriver } from "@dappnode/common"; +import { ChainDriver, InstalledPackageData } from "@dappnode/types"; /** * Get ChainDriver for a given dnp diff --git a/packages/chains/src/index.ts b/packages/chains/src/index.ts index b7e5c9797..701669bfb 100644 --- a/packages/chains/src/index.ts +++ b/packages/chains/src/index.ts @@ -1,4 +1,4 @@ -import { ChainData } from "@dappnode/common"; +import { ChainData } from "@dappnode/types"; import { logs } from "@dappnode/logger"; import { listPackages } from "@dappnode/dockerapi"; import { parseChainErrors } from "./utils.js"; @@ -19,14 +19,14 @@ export async function getChainsData(): Promise { const chainsData: ChainData[] = []; await Promise.all( - dnpList.map(async dnp => { + dnpList.map(async (dnp) => { try { const chainDriverName = getChainDriverName(dnp); if (!chainDriverName) return; // Ignore packages where all containers are not running // Ethereum 2.0 multiservice should be handled in the driver - if (dnp.containers.every(container => !container.running)) return; + if (dnp.containers.every((container) => !container.running)) return; const chainData = await runWithChainDriver(dnp, chainDriverName); loggedErrors.delete(dnp.dnpName); // Reset last seen error @@ -34,7 +34,7 @@ export async function getChainsData(): Promise { if (chainData) chainsData.push({ dnpName: dnp.dnpName, - ...chainData + ...chainData, }); } catch (e) { // Only log chain errors the first time they are seen @@ -46,7 +46,7 @@ export async function getChainsData(): Promise { dnpName: dnp.dnpName, syncing: false, error: true, - message: parseChainErrors(e) + message: parseChainErrors(e), }); } }) diff --git a/packages/chains/src/types.ts b/packages/chains/src/types.ts index 0f62a8749..ba99d0377 100644 --- a/packages/chains/src/types.ts +++ b/packages/chains/src/types.ts @@ -1,4 +1,4 @@ -import { ChainData, ChainDriver } from "@dappnode/common"; +import { ChainDriver, ChainData } from "@dappnode/types"; export interface Chain { dnpName: string; // geth.dnp.dappnode.eth diff --git a/packages/common/package.json b/packages/common/package.json index 700bb3ee0..a7b0cc959 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -19,7 +19,7 @@ "lint": "eslint . --ext .ts --fix src" }, "dependencies": { - "@dappnode/params": "^0.1.0", + "@dappnode/types": "^0.1.0", "lodash-es": "^4.17.21" }, "devDependencies": { diff --git a/packages/common/src/dockerComposeSafeKeys.ts b/packages/common/src/dockerComposeSafeKeys.ts deleted file mode 100644 index 5ac0567b2..000000000 --- a/packages/common/src/dockerComposeSafeKeys.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { ComposeService } from "./types/index.js"; - -export const dockerComposeSafeKeys: (keyof ComposeService)[] = [ - "cap_add", - "cap_drop", - "command", - "depends_on", - "devices", - "entrypoint", - "environment", - "expose", - "extra_hosts", - "healthcheck", - "labels", - "logging", - "network_mode", - "networks", - "ports", - "privileged", - "restart", - "stop_grace_period", - "stop_signal", - "user", - "volumes", - "working_dir", - "security_opt", - "image", - "build", - "volumes", - "environment", - "pid", - "container_name", - "dns", - "ulimits", - "deploy", -]; diff --git a/packages/common/src/index.ts b/packages/common/src/index.ts index 28eb3f207..d1a771e19 100644 --- a/packages/common/src/index.ts +++ b/packages/common/src/index.ts @@ -1,11 +1,5 @@ -export * from "./types/index.js"; -export * from "./routes.js"; -export * from "./subscriptions.js"; export * from "./transport/jsonRpc/index.js"; export * from "./transport/socketIo/index.js"; -export * from "./errors.js"; -export * from "./releaseFiles/index.js"; -export { dockerComposeSafeKeys } from "./dockerComposeSafeKeys.js"; // Schemas diff --git a/packages/common/src/releaseFiles/defaultArch.ts b/packages/common/src/releaseFiles/defaultArch.ts deleted file mode 100644 index 4762ffe81..000000000 --- a/packages/common/src/releaseFiles/defaultArch.ts +++ /dev/null @@ -1 +0,0 @@ -export const defaultArch = "linux/amd64" as const; diff --git a/packages/common/src/releaseFiles/index.ts b/packages/common/src/releaseFiles/index.ts deleted file mode 100644 index 6960be1d5..000000000 --- a/packages/common/src/releaseFiles/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { defaultArch } from "./defaultArch.js"; -export { releaseFiles } from "./releaseFiles.js"; -export { releaseFilesToDownload } from "./releaseFilesToDownload.js"; diff --git a/packages/common/src/releaseFiles/releaseFilesToDownload.ts b/packages/common/src/releaseFiles/releaseFilesToDownload.ts deleted file mode 100644 index a0bfb4c98..000000000 --- a/packages/common/src/releaseFiles/releaseFilesToDownload.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { releaseFiles } from "./releaseFiles.js"; - -export const releaseFilesToDownload = { - manifest: releaseFiles.manifest, - compose: releaseFiles.compose, - signature: releaseFiles.signature, - setupWizard: releaseFiles.setupWizard, - disclaimer: releaseFiles.disclaimer, - gettingStarted: releaseFiles.gettingStarted, - prometheusTargets: releaseFiles.prometheusTargets, - grafanaDashboards: releaseFiles.grafanaDashboards, -}; diff --git a/packages/common/src/transport/jsonRpc/index.ts b/packages/common/src/transport/jsonRpc/index.ts index 2e52afc3f..8136d7dc8 100644 --- a/packages/common/src/transport/jsonRpc/index.ts +++ b/packages/common/src/transport/jsonRpc/index.ts @@ -1,4 +1,4 @@ -import { RpcResponse } from "../../types/index.js"; +import { RpcResponse } from "@dappnode/types"; /** * Parse RPC response, to be used in the client @@ -13,7 +13,7 @@ export async function parseRpcResponse(body: RpcResponse): Promise { } throw error; } else { - return (body.result as unknown) as R; + return body.result as unknown as R; } } diff --git a/packages/common/src/transport/socketIo/index.ts b/packages/common/src/transport/socketIo/index.ts index 699e0db76..2e91eb68b 100644 --- a/packages/common/src/transport/socketIo/index.ts +++ b/packages/common/src/transport/socketIo/index.ts @@ -1,7 +1,11 @@ import Ajv, { ErrorObject } from "ajv"; import { mapValues } from "lodash-es"; -import { Args, LoggerMiddleware } from "../../types/index.js"; -import { Subscriptions, subscriptionsData } from "../../subscriptions.js"; +import { + Args, + LoggerMiddleware, + Subscriptions, + subscriptionsData, +} from "@dappnode/types"; const ajv = new Ajv({ allErrors: true, strict: false }); diff --git a/packages/daemons/package.json b/packages/daemons/package.json index 591f73689..bc929c8fd 100644 --- a/packages/daemons/package.json +++ b/packages/daemons/package.json @@ -19,7 +19,8 @@ "lint": "eslint . --ext .ts --fix src" }, "dependencies": { - "@dappnode/common": "^0.1.0", + "@dappnode/types": "^0.1.0", + "@dappnode/upnpc": "^0.1.0", "@dappnode/db": "^0.1.0", "@dappnode/dockerapi": "^0.1.0", "@dappnode/dockercompose": "^0.1.0", @@ -31,14 +32,12 @@ "@dappnode/logger": "^0.1.0", "@dappnode/params": "^0.1.0", "@dappnode/utils": "^0.1.0", - "async-retry": "^1.3.1", "is-ip": "^3.0.0", "lodash-es": "^4.17.21", "node-telegram-bot-api": "^0.50.0", "semver": "^7.3.8" }, "devDependencies": { - "@types/async-retry": "^1.4.2", "@types/lodash-es": "^4.17.6", "@types/node": "^20.6.2", "@types/node-telegram-bot-api": "^0.50.4", diff --git a/packages/daemons/src/autoUpdates/flagCompletedUpdate.ts b/packages/daemons/src/autoUpdates/flagCompletedUpdate.ts index 44f74de9a..8d328bdca 100644 --- a/packages/daemons/src/autoUpdates/flagCompletedUpdate.ts +++ b/packages/daemons/src/autoUpdates/flagCompletedUpdate.ts @@ -1,4 +1,4 @@ -import { AutoUpdateRegistryEntry } from "@dappnode/common"; +import { AutoUpdateRegistryEntry } from "@dappnode/types"; import { eventBus } from "@dappnode/eventbus"; import * as db from "@dappnode/db"; import { omit } from "lodash-es"; @@ -18,7 +18,7 @@ export function flagCompletedUpdate( ): void { setRegistry(dnpName, version, { updated: timestamp || Date.now(), - successful: true + successful: true, }); clearPendingUpdatesOfDnp(dnpName); @@ -45,9 +45,9 @@ function setRegistry( ...(registry[dnpName] || {}), [version]: { ...((registry[dnpName] || {})[version] || {}), - ...data - } - } + ...data, + }, + }, }); eventBus.requestAutoUpdateData.emit(); diff --git a/packages/daemons/src/autoUpdates/formatNotificationBody.ts b/packages/daemons/src/autoUpdates/formatNotificationBody.ts index 95743c70f..7cdff9ea6 100644 --- a/packages/daemons/src/autoUpdates/formatNotificationBody.ts +++ b/packages/daemons/src/autoUpdates/formatNotificationBody.ts @@ -1,4 +1,4 @@ -import { CoreUpdateDataAvailable } from "@dappnode/common"; +import { CoreUpdateDataAvailable } from "@dappnode/types"; import { urlJoin, prettyDnpName } from "@dappnode/utils"; import { enableAutoUpdatesCmd } from "../telegramBot/commands.js"; @@ -10,7 +10,7 @@ export function formatPackageUpdateNotification({ currentVersion, newVersion, upstreamVersion, - autoUpdatesEnabled + autoUpdatesEnabled, }: { dnpName: string; currentVersion: string; @@ -31,13 +31,13 @@ export function formatPackageUpdateNotification({ `Connect to your DAppNode to install this new version [install / ${prettyName}](${installUrl}).`, autoUpdatesEnabled ? `You may also wait for auto-updates to automatically install this version for you` - : `You can also enable auto-updates so packages are updated automatically by responding with the command: \n\n ${enableAutoUpdatesCmd}` + : `You can also enable auto-updates so packages are updated automatically by responding with the command: \n\n ${enableAutoUpdatesCmd}`, ].join("\n\n"); } export function formatSystemUpdateNotification({ packages, - autoUpdatesEnabled + autoUpdatesEnabled, }: { packages: CoreUpdateDataAvailable["packages"]; autoUpdatesEnabled: boolean; @@ -45,7 +45,7 @@ export function formatSystemUpdateNotification({ return [ "New system version ready to install", packages.map( - p => + (p) => ` - ${prettyDnpName(p.name)}: ${p.to} ${ p.from ? `(current: ${p.from})` : "" }` @@ -54,6 +54,6 @@ export function formatSystemUpdateNotification({ `Connect to your DAppNode to install this [system / update](${adminUiUpdateCoreUrl}).`, autoUpdatesEnabled ? `You may also wait for auto-updates to automatically install this version for you` - : `You can also enable auto-updates so packages are updated automatically by responding with the command: \n\n ${enableAutoUpdatesCmd}` + : `You can also enable auto-updates so packages are updated automatically by responding with the command: \n\n ${enableAutoUpdatesCmd}`, ].join("\n\n"); } diff --git a/packages/daemons/src/autoUpdates/getCoreUpdateData.ts b/packages/daemons/src/autoUpdates/getCoreUpdateData.ts index 56beacce7..f94024d71 100644 --- a/packages/daemons/src/autoUpdates/getCoreUpdateData.ts +++ b/packages/daemons/src/autoUpdates/getCoreUpdateData.ts @@ -1,6 +1,6 @@ import { valid, satisfies } from "semver"; import { params } from "@dappnode/params"; -import { CoreUpdateData, PackageRelease } from "@dappnode/common"; +import { CoreUpdateData, PackageRelease } from "@dappnode/types"; import { listPackages } from "@dappnode/dockerapi"; import { getCoreVersionId, computeSemverUpdateType } from "@dappnode/utils"; import { DappnodeInstaller, ErrorDappGetDowngrade } from "@dappnode/installer"; diff --git a/packages/daemons/src/autoUpdates/sendUpdateNotification.ts b/packages/daemons/src/autoUpdates/sendUpdateNotification.ts index d7716f294..711a1701c 100644 --- a/packages/daemons/src/autoUpdates/sendUpdateNotification.ts +++ b/packages/daemons/src/autoUpdates/sendUpdateNotification.ts @@ -4,7 +4,7 @@ import * as db from "@dappnode/db"; import { eventBus } from "@dappnode/eventbus"; import { DappnodeInstaller } from "@dappnode/installer"; import { prettyDnpName } from "@dappnode/utils"; -import { CoreUpdateDataAvailable } from "@dappnode/common"; +import { CoreUpdateDataAvailable } from "@dappnode/types"; import { formatPackageUpdateNotification, formatSystemUpdateNotification, diff --git a/packages/daemons/src/autoUpdates/setPending.ts b/packages/daemons/src/autoUpdates/setPending.ts index 86a20965f..8f8acd98c 100644 --- a/packages/daemons/src/autoUpdates/setPending.ts +++ b/packages/daemons/src/autoUpdates/setPending.ts @@ -1,4 +1,4 @@ -import { AutoUpdatePendingEntry } from "@dappnode/common"; +import { AutoUpdatePendingEntry } from "@dappnode/types"; import * as db from "@dappnode/db"; import { eventBus } from "@dappnode/eventbus"; @@ -18,8 +18,8 @@ export function setPending( ...pending, [dnpName]: { ...(pending[dnpName] || {}), - ...data - } + ...data, + }, }); eventBus.requestAutoUpdateData.emit(); diff --git a/packages/daemons/src/autoUpdates/startAutoUpdatesDaemon.ts b/packages/daemons/src/autoUpdates/startAutoUpdatesDaemon.ts index fd95256be..9b30693d9 100644 --- a/packages/daemons/src/autoUpdates/startAutoUpdatesDaemon.ts +++ b/packages/daemons/src/autoUpdates/startAutoUpdatesDaemon.ts @@ -6,7 +6,7 @@ import { runAtMostEvery } from "@dappnode/utils"; import { logs } from "@dappnode/logger"; import { checkNewPackagesVersion } from "./updateMyPackages.js"; import { checkSystemPackagesVersion } from "./updateSystemPackages.js"; -import { EthProviderError } from "@dappnode/common"; +import { EthProviderError } from "@dappnode/types"; import { clearPendingUpdates } from "./clearPendingUpdates.js"; import { clearCompletedCoreUpdatesIfAny } from "./clearCompletedCoreUpdatesIfAny.js"; import { clearRegistry } from "./clearRegistry.js"; diff --git a/packages/daemons/src/autoUpdates/updateSystemPackages.ts b/packages/daemons/src/autoUpdates/updateSystemPackages.ts index e953e8d88..930c27f7e 100644 --- a/packages/daemons/src/autoUpdates/updateSystemPackages.ts +++ b/packages/daemons/src/autoUpdates/updateSystemPackages.ts @@ -3,7 +3,7 @@ import { params } from "@dappnode/params"; import { DappnodeInstaller, packageInstall } from "@dappnode/installer"; import { logs } from "@dappnode/logger"; import { getCoreUpdateData } from "./getCoreUpdateData.js"; -import { CoreUpdateDataAvailable } from "@dappnode/common"; +import { CoreUpdateDataAvailable } from "@dappnode/types"; import { sendUpdateSystemNotificationMaybe } from "./sendUpdateNotification.js"; import { flagErrorUpdate } from "./flagErrorUpdate.js"; import { isUpdateDelayCompleted } from "./isUpdateDelayCompleted.js"; diff --git a/packages/daemons/src/ethMultiClient/index.ts b/packages/daemons/src/ethMultiClient/index.ts index a28ad69db..e7d023264 100644 --- a/packages/daemons/src/ethMultiClient/index.ts +++ b/packages/daemons/src/ethMultiClient/index.ts @@ -13,7 +13,7 @@ import { EthClientInstallStatus, ExecutionClientMainnet, ConsensusClientMainnet, -} from "@dappnode/common"; +} from "@dappnode/types"; import { ethereumClient, getLocalFallbackContentHash, diff --git a/packages/daemons/src/ethicalMetrics/checkEthicalMetricsStatus.ts b/packages/daemons/src/ethicalMetrics/checkEthicalMetricsStatus.ts index 44ecb98fd..5e4c69369 100644 --- a/packages/daemons/src/ethicalMetrics/checkEthicalMetricsStatus.ts +++ b/packages/daemons/src/ethicalMetrics/checkEthicalMetricsStatus.ts @@ -3,7 +3,7 @@ import { DappnodeInstaller, packageInstall } from "@dappnode/installer"; import { dockerContainerStart, listPackageNoThrow } from "@dappnode/dockerapi"; import * as db from "@dappnode/db"; import { ethicalMetricsDnpName, register } from "@dappnode/ethicalmetrics"; -import { InstalledPackageData } from "@dappnode/common"; +import { InstalledPackageData } from "@dappnode/types"; /** * Make sure that on Ethical metrics enabled and existing email, diff --git a/packages/daemons/src/natRenewal/getPortsToOpen.ts b/packages/daemons/src/natRenewal/getPortsToOpen.ts index 488be0006..b0d4c05b2 100644 --- a/packages/daemons/src/natRenewal/getPortsToOpen.ts +++ b/packages/daemons/src/natRenewal/getPortsToOpen.ts @@ -1,4 +1,4 @@ -import { PackageContainer, PortToOpen, PortMapping } from "@dappnode/common"; +import { PackageContainer, PortToOpen, PortMapping } from "@dappnode/types"; import { logs } from "@dappnode/logger"; import { ComposeFileEditor } from "@dappnode/dockercompose"; diff --git a/packages/daemons/src/natRenewal/index.ts b/packages/daemons/src/natRenewal/index.ts index 4b449980c..691ea36f9 100644 --- a/packages/daemons/src/natRenewal/index.ts +++ b/packages/daemons/src/natRenewal/index.ts @@ -9,7 +9,7 @@ import { runAtMostEveryIntervals, runOnlyOneSequentially, } from "@dappnode/utils"; -import { PackagePort } from "@dappnode/common"; +import { PackagePort } from "@dappnode/types"; import { logs } from "@dappnode/logger"; import { listPackageContainers } from "@dappnode/dockerapi"; diff --git a/packages/daemons/src/telegramBot/formatNotification.ts b/packages/daemons/src/telegramBot/formatNotification.ts index 360a81cf2..6235aa40e 100644 --- a/packages/daemons/src/telegramBot/formatNotification.ts +++ b/packages/daemons/src/telegramBot/formatNotification.ts @@ -1,4 +1,4 @@ -import { NotificationType, PackageNotification } from "@dappnode/common"; +import { NotificationType, PackageNotification } from "@dappnode/types"; import { bold } from "./markdown.js"; // TELEGRAM DAPPNODE NOTIFICATIONS MESSAGES @@ -10,7 +10,7 @@ import { bold } from "./markdown.js"; export function formatNotification(notification: PackageNotification): string { return [ `${typeToEmoji(notification.type)} ${bold(notification.title)}`, - notification.body + notification.body, ].join("\n\n"); } diff --git a/packages/daemons/test/testUtils.ts b/packages/daemons/test/testUtils.ts index f706a4b04..94cb874cb 100644 --- a/packages/daemons/test/testUtils.ts +++ b/packages/daemons/test/testUtils.ts @@ -1,4 +1,4 @@ -import { PackageContainer, InstalledPackageData } from "@dappnode/common"; +import { PackageContainer, InstalledPackageData } from "@dappnode/types"; import { DappnodeInstaller } from "@dappnode/installer"; export const dappnodeInstaller = new DappnodeInstaller( diff --git a/packages/daemons/test/unit/ethMultiClient.test.ts b/packages/daemons/test/unit/ethMultiClient.test.ts index f57cf10d8..0e244812d 100644 --- a/packages/daemons/test/unit/ethMultiClient.test.ts +++ b/packages/daemons/test/unit/ethMultiClient.test.ts @@ -12,7 +12,7 @@ import { EthClientInstallStatus, ExecutionClientMainnet, ConsensusClientMainnet, -} from "@dappnode/common"; +} from "@dappnode/types"; import { mockDnp, mockContainer, dappnodeInstaller } from "../testUtils.js"; interface State { diff --git a/packages/daemons/test/unit/natRenewal.test.ts b/packages/daemons/test/unit/natRenewal.test.ts index 68635561b..5f532a4fe 100644 --- a/packages/daemons/test/unit/natRenewal.test.ts +++ b/packages/daemons/test/unit/natRenewal.test.ts @@ -1,6 +1,6 @@ import "mocha"; import { expect } from "chai"; -import { PackageContainer, PortProtocol } from "@dappnode/common"; +import { PackageContainer, PortProtocol } from "@dappnode/types"; // imports for typings import { mockContainer } from "../testUtils.js"; import { getPortsToOpen } from "../../src/natRenewal/getPortsToOpen.js"; diff --git a/packages/daemons/test/unit/telegramBot.test.ts b/packages/daemons/test/unit/telegramBot.test.ts index 4643f1abd..a874ffa35 100644 --- a/packages/daemons/test/unit/telegramBot.test.ts +++ b/packages/daemons/test/unit/telegramBot.test.ts @@ -1,7 +1,7 @@ import "mocha"; import { expect } from "chai"; import { formatNotification } from "../../src/telegramBot/formatNotification.js"; -import { PackageNotification } from "@dappnode/common"; +import { PackageNotification } from "@dappnode/types"; describe("daemons > telegramBot > formatNotification", () => { it("Format notification for Telegram", () => { diff --git a/packages/dappmanager/package.json b/packages/dappmanager/package.json index 0e54b6478..39a51e426 100644 --- a/packages/dappmanager/package.json +++ b/packages/dappmanager/package.json @@ -21,6 +21,7 @@ }, "license": "GPL-3.0", "dependencies": { + "@dappnode/types": "^0.1.0", "@dappnode/chains": "^0.1.0", "@dappnode/common": "^0.1.0", "@dappnode/daemons": "^0.1.0", diff --git a/packages/dappmanager/src/api/auth/sessionAuth.ts b/packages/dappmanager/src/api/auth/sessionAuth.ts index d695f269b..6524e07b8 100644 --- a/packages/dappmanager/src/api/auth/sessionAuth.ts +++ b/packages/dappmanager/src/api/auth/sessionAuth.ts @@ -3,7 +3,7 @@ import { PlainTextFileDb } from "@dappnode/utils"; import { getRandomAlphanumericToken } from "./token.js"; import { wrapHandler } from "../utils.js"; import { SessionData, SessionsManager } from "../sessions/index.js"; -import { LoginStatusReturn } from "@dappnode/common"; +import { LoginStatusReturn } from "@dappnode/types"; import { AlreadyRegisteredError, MissingCredentialsError, diff --git a/packages/dappmanager/src/api/handler/index.ts b/packages/dappmanager/src/api/handler/index.ts index 22bcf1180..9bafe0195 100644 --- a/packages/dappmanager/src/api/handler/index.ts +++ b/packages/dappmanager/src/api/handler/index.ts @@ -1,11 +1,11 @@ import Ajv from "ajv"; import { routesArgumentsSchema } from "@dappnode/common"; import { - Routes, LoggerMiddleware, RpcPayload, + Routes, RpcResponse -} from "@dappnode/common"; +} from "@dappnode/types"; const ajv = new Ajv({ allErrors: true }); diff --git a/packages/dappmanager/src/api/middlewares/ethForward/ipfsProxy.ts b/packages/dappmanager/src/api/middlewares/ethForward/ipfsProxy.ts index e3aa4260c..919cbd3fe 100644 --- a/packages/dappmanager/src/api/middlewares/ethForward/ipfsProxy.ts +++ b/packages/dappmanager/src/api/middlewares/ethForward/ipfsProxy.ts @@ -12,7 +12,7 @@ import { NotFoundError, Content } from "./types.js"; -import { EthProviderError } from "@dappnode/common"; +import { EthProviderError } from "@dappnode/types"; export enum ProxyType { ETHFORWARD = "ETHFORWARD", diff --git a/packages/dappmanager/src/api/routes/globalEnvs.ts b/packages/dappmanager/src/api/routes/globalEnvs.ts index 721512d11..acdd59cc5 100644 --- a/packages/dappmanager/src/api/routes/globalEnvs.ts +++ b/packages/dappmanager/src/api/routes/globalEnvs.ts @@ -1,4 +1,4 @@ -import { GlobalEnvs } from "@dappnode/common"; +import { GlobalEnvs } from "@dappnode/types"; import { computeGlobalEnvsFromDb } from "@dappnode/db"; import { wrapHandler } from "../utils.js"; diff --git a/packages/dappmanager/src/api/routes/metrics.ts b/packages/dappmanager/src/api/routes/metrics.ts index 710f7df2a..8058cd964 100644 --- a/packages/dappmanager/src/api/routes/metrics.ts +++ b/packages/dappmanager/src/api/routes/metrics.ts @@ -4,7 +4,7 @@ import * as db from "@dappnode/db"; import { getStakerConfigByNetwork } from "@dappnode/stakers"; import { listPackageNoThrow } from "@dappnode/dockerapi"; import { isEmpty } from "lodash-es"; -import { Network } from "@dappnode/common"; +import { Network } from "@dappnode/types"; import { getHostInfoMemoized } from "@dappnode/hostscriptsservices"; /** diff --git a/packages/dappmanager/src/api/routes/publicPackagesData.ts b/packages/dappmanager/src/api/routes/publicPackagesData.ts index 1b00dfe5b..351dad0a3 100644 --- a/packages/dappmanager/src/api/routes/publicPackagesData.ts +++ b/packages/dappmanager/src/api/routes/publicPackagesData.ts @@ -2,7 +2,7 @@ import { listPackageContainers, listPackageContainerNoThrow } from "@dappnode/dockerapi"; -import { PackageContainer } from "@dappnode/common"; +import { PackageContainer } from "@dappnode/types"; import { wrapHandler } from "../utils.js"; interface Params { diff --git a/packages/dappmanager/src/api/routes/sign.ts b/packages/dappmanager/src/api/routes/sign.ts index b04e45e5b..7399541ae 100644 --- a/packages/dappmanager/src/api/routes/sign.ts +++ b/packages/dappmanager/src/api/routes/sign.ts @@ -1,4 +1,4 @@ -import { PackageContainer } from "@dappnode/common"; +import { PackageContainer } from "@dappnode/types"; import * as db from "@dappnode/db"; import { listPackageContainers } from "@dappnode/dockerapi"; import { diff --git a/packages/dappmanager/src/api/startHttpApi.ts b/packages/dappmanager/src/api/startHttpApi.ts index 1fef0be88..c43ce9fed 100644 --- a/packages/dappmanager/src/api/startHttpApi.ts +++ b/packages/dappmanager/src/api/startHttpApi.ts @@ -20,13 +20,13 @@ import { import { mapSubscriptionsToEventBus } from "./subscriptions.js"; import { Logs } from "@dappnode/logger"; import { EventBus } from "@dappnode/eventbus"; +import { subscriptionsFactory } from "@dappnode/common"; import { - Routes, RpcPayload, RpcResponse, LoggerMiddleware, - subscriptionsFactory -} from "@dappnode/common"; + Routes +} from "@dappnode/types"; import { getRpcHandler } from "./handler/index.js"; export interface HttpApiParams diff --git a/packages/dappmanager/src/api/subscriptions.ts b/packages/dappmanager/src/api/subscriptions.ts index 2e0543693..9a9767454 100644 --- a/packages/dappmanager/src/api/subscriptions.ts +++ b/packages/dappmanager/src/api/subscriptions.ts @@ -1,5 +1,5 @@ import { EventBus } from "@dappnode/eventbus"; -import { Routes, Subscriptions } from "@dappnode/common"; +import { Routes, Subscriptions } from "@dappnode/types"; export function mapSubscriptionsToEventBus( subscriptions: Subscriptions, diff --git a/packages/dappmanager/src/api/vpnApiClient.ts b/packages/dappmanager/src/api/vpnApiClient.ts index 4bb4160f9..571da79ba 100644 --- a/packages/dappmanager/src/api/vpnApiClient.ts +++ b/packages/dappmanager/src/api/vpnApiClient.ts @@ -1,10 +1,7 @@ import fetch from "node-fetch"; import { mapValues } from "lodash-es"; -import { - PackageVersionData, - RpcResponse, - parseRpcResponse -} from "@dappnode/common"; +import { parseRpcResponse } from "@dappnode/common"; +import { PackageVersionData, RpcResponse } from "@dappnode/types"; export interface VpnApiClient { addDevice: (kwargs: { id: string }) => Promise; diff --git a/packages/dappmanager/src/calls/autoUpdateDataGet.ts b/packages/dappmanager/src/calls/autoUpdateDataGet.ts index 7c7e00f0b..3868f1ad1 100644 --- a/packages/dappmanager/src/calls/autoUpdateDataGet.ts +++ b/packages/dappmanager/src/calls/autoUpdateDataGet.ts @@ -9,7 +9,7 @@ import { AutoUpdateRegistry, AutoUpdatePending, AutoUpdateFeedback -} from "@dappnode/common"; +} from "@dappnode/types"; import * as db from "@dappnode/db"; import { params } from "@dappnode/params"; import { diff --git a/packages/dappmanager/src/calls/backupGet.ts b/packages/dappmanager/src/calls/backupGet.ts index 199a6ed6b..c5ea76aea 100644 --- a/packages/dappmanager/src/calls/backupGet.ts +++ b/packages/dappmanager/src/calls/backupGet.ts @@ -9,7 +9,7 @@ import { listPackage } from "@dappnode/dockerapi"; // Utils import { shell } from "@dappnode/utils"; import { validateBackupArray } from "../utils/index.js"; -import { PackageBackup } from "@dappnode/common"; +import { PackageBackup } from "@dappnode/types"; const tempTransferDir = params.TEMP_TRANSFER_DIR; diff --git a/packages/dappmanager/src/calls/backupRestore.ts b/packages/dappmanager/src/calls/backupRestore.ts index 29c6e72f7..bba2b54a2 100644 --- a/packages/dappmanager/src/calls/backupRestore.ts +++ b/packages/dappmanager/src/calls/backupRestore.ts @@ -7,7 +7,7 @@ import { listPackage } from "@dappnode/dockerapi"; import { packageRestart } from "./packageRestart.js"; import { shell } from "@dappnode/utils"; import { validateBackupArray } from "../utils/index.js"; -import { PackageBackup } from "@dappnode/common"; +import { PackageBackup } from "@dappnode/types"; const tempTransferDir = params.TEMP_TRANSFER_DIR; diff --git a/packages/dappmanager/src/calls/chainDataGet.ts b/packages/dappmanager/src/calls/chainDataGet.ts index 276b1f7e4..bdf993e2d 100644 --- a/packages/dappmanager/src/calls/chainDataGet.ts +++ b/packages/dappmanager/src/calls/chainDataGet.ts @@ -1,5 +1,5 @@ import { getChainsData } from "@dappnode/chains"; -import { ChainData } from "@dappnode/common"; +import { ChainData } from "@dappnode/types"; export async function chainDataGet(): Promise { return await getChainsData(); diff --git a/packages/dappmanager/src/calls/device/index.ts b/packages/dappmanager/src/calls/device/index.ts index b2f4fd2e5..7b865b963 100644 --- a/packages/dappmanager/src/calls/device/index.ts +++ b/packages/dappmanager/src/calls/device/index.ts @@ -7,7 +7,7 @@ import { VpnDeviceCredentials, VpnDevice, VpnDeviceAdminPassword -} from "@dappnode/common"; +} from "@dappnode/types"; // Temporal solution until eventBus is properly typed interface EventBusDevices { diff --git a/packages/dappmanager/src/calls/diagnose.ts b/packages/dappmanager/src/calls/diagnose.ts index 09e5b3ffb..d9eff15e8 100644 --- a/packages/dappmanager/src/calls/diagnose.ts +++ b/packages/dappmanager/src/calls/diagnose.ts @@ -1,5 +1,5 @@ import { getHostInfoMemoized } from "@dappnode/hostscriptsservices"; -import { HostDiagnoseItem } from "@dappnode/common"; +import { HostDiagnoseItem } from "@dappnode/types"; /** * Returns a list of checks done as a diagnose diff --git a/packages/dappmanager/src/calls/ethClientFallbackSet.ts b/packages/dappmanager/src/calls/ethClientFallbackSet.ts index b60cab68d..3a5972ad7 100644 --- a/packages/dappmanager/src/calls/ethClientFallbackSet.ts +++ b/packages/dappmanager/src/calls/ethClientFallbackSet.ts @@ -1,5 +1,5 @@ import * as db from "@dappnode/db"; -import { EthClientFallback } from "@dappnode/common"; +import { EthClientFallback } from "@dappnode/types"; /** * Sets if a fallback should be used diff --git a/packages/dappmanager/src/calls/ethClientTargetSet.ts b/packages/dappmanager/src/calls/ethClientTargetSet.ts index 689462d9a..46a2160b5 100644 --- a/packages/dappmanager/src/calls/ethClientTargetSet.ts +++ b/packages/dappmanager/src/calls/ethClientTargetSet.ts @@ -1,4 +1,4 @@ -import { Eth2ClientTarget } from "@dappnode/common"; +import { Eth2ClientTarget } from "@dappnode/types"; import { ethereumClient } from "@dappnode/installer"; import { dappnodeInstaller } from "../index.js"; diff --git a/packages/dappmanager/src/calls/ethicalMetrics.ts b/packages/dappmanager/src/calls/ethicalMetrics.ts index 7120105e3..be063465b 100644 --- a/packages/dappmanager/src/calls/ethicalMetrics.ts +++ b/packages/dappmanager/src/calls/ethicalMetrics.ts @@ -1,4 +1,4 @@ -import { EthicalMetricsConfig } from "@dappnode/common"; +import { EthicalMetricsConfig } from "@dappnode/types"; import { eventBus } from "@dappnode/eventbus"; import { listPackageNoThrow } from "@dappnode/dockerapi"; import { packageRestart } from "./packageRestart.js"; diff --git a/packages/dappmanager/src/calls/fetchCoreUpdateData.ts b/packages/dappmanager/src/calls/fetchCoreUpdateData.ts index 87176b225..7f9e63813 100644 --- a/packages/dappmanager/src/calls/fetchCoreUpdateData.ts +++ b/packages/dappmanager/src/calls/fetchCoreUpdateData.ts @@ -1,4 +1,4 @@ -import { CoreUpdateData } from "@dappnode/common"; +import { CoreUpdateData } from "@dappnode/types"; import { getCoreUpdateData } from "@dappnode/daemons"; import { dappnodeInstaller } from "../index.js"; diff --git a/packages/dappmanager/src/calls/fetchDirectory.ts b/packages/dappmanager/src/calls/fetchDirectory.ts index a641e4f8c..8a6c5fd5f 100644 --- a/packages/dappmanager/src/calls/fetchDirectory.ts +++ b/packages/dappmanager/src/calls/fetchDirectory.ts @@ -1,5 +1,5 @@ import { eventBus } from "@dappnode/eventbus"; -import { DirectoryItem, DirectoryItemOk } from "@dappnode/common"; +import { DirectoryItem, DirectoryItemOk } from "@dappnode/types"; import { logs } from "@dappnode/logger"; import { listPackages } from "@dappnode/dockerapi"; import { diff --git a/packages/dappmanager/src/calls/fetchDnpRequest.ts b/packages/dappmanager/src/calls/fetchDnpRequest.ts index 6e257fe1b..63625331c 100644 --- a/packages/dappmanager/src/calls/fetchDnpRequest.ts +++ b/packages/dappmanager/src/calls/fetchDnpRequest.ts @@ -22,10 +22,9 @@ import { PackageRelease, CompatibleDnps, InstalledPackageData, - ReleaseSignatureStatusCode, - Manifest, - SetupWizardField -} from "@dappnode/common"; + ReleaseSignatureStatusCode +} from "@dappnode/types"; +import { Manifest, SetupWizardField } from "@dappnode/types"; export async function fetchDnpRequest({ id diff --git a/packages/dappmanager/src/calls/fetchRegistry.ts b/packages/dappmanager/src/calls/fetchRegistry.ts index 886441c78..25792f400 100644 --- a/packages/dappmanager/src/calls/fetchRegistry.ts +++ b/packages/dappmanager/src/calls/fetchRegistry.ts @@ -1,6 +1,6 @@ import { listPackages } from "@dappnode/dockerapi"; import { logs } from "@dappnode/logger"; -import { DirectoryItem } from "@dappnode/common"; +import { DirectoryItem } from "@dappnode/types"; import { fileToGatewayUrl, getIsInstalled, diff --git a/packages/dappmanager/src/calls/getUserActionLogs.ts b/packages/dappmanager/src/calls/getUserActionLogs.ts index fbf2ebac6..68df18d14 100644 --- a/packages/dappmanager/src/calls/getUserActionLogs.ts +++ b/packages/dappmanager/src/calls/getUserActionLogs.ts @@ -1,5 +1,5 @@ import { logUserAction } from "@dappnode/logger"; -import { UserActionLog } from "@dappnode/common"; +import { UserActionLog } from "@dappnode/types"; /** * Returns the user action logs. This logs are stored in a different diff --git a/packages/dappmanager/src/calls/httpsPortal.ts b/packages/dappmanager/src/calls/httpsPortal.ts index d233bee9e..ea3ee09ad 100644 --- a/packages/dappmanager/src/calls/httpsPortal.ts +++ b/packages/dappmanager/src/calls/httpsPortal.ts @@ -1,4 +1,4 @@ -import { HttpsPortalMapping, ExposableServiceMapping } from "@dappnode/common"; +import { HttpsPortalMapping, ExposableServiceMapping } from "@dappnode/types"; import { httpsPortal, getExposableServices } from "@dappnode/httpsportal"; /** diff --git a/packages/dappmanager/src/calls/ipPublicGet.ts b/packages/dappmanager/src/calls/ipPublicGet.ts index ef49c7a27..58b81748b 100644 --- a/packages/dappmanager/src/calls/ipPublicGet.ts +++ b/packages/dappmanager/src/calls/ipPublicGet.ts @@ -1,4 +1,4 @@ -import { PublicIpResponse } from "@dappnode/common"; +import { PublicIpResponse } from "@dappnode/types"; import { getPublicIpFromUrls } from "@dappnode/utils"; export async function ipPublicGet(): Promise { diff --git a/packages/dappmanager/src/calls/ipfsClientTargetGet.ts b/packages/dappmanager/src/calls/ipfsClientTargetGet.ts index 88b73d3b4..b355643f0 100644 --- a/packages/dappmanager/src/calls/ipfsClientTargetGet.ts +++ b/packages/dappmanager/src/calls/ipfsClientTargetGet.ts @@ -1,5 +1,5 @@ import * as db from "@dappnode/db"; -import { IpfsRepository } from "@dappnode/common"; +import { IpfsRepository } from "@dappnode/types"; export async function ipfsClientTargetGet(): Promise { return { diff --git a/packages/dappmanager/src/calls/ipfsClientTargetSet.ts b/packages/dappmanager/src/calls/ipfsClientTargetSet.ts index 2a9a9cc14..eb320d950 100644 --- a/packages/dappmanager/src/calls/ipfsClientTargetSet.ts +++ b/packages/dappmanager/src/calls/ipfsClientTargetSet.ts @@ -1,4 +1,4 @@ -import { IpfsRepository, IpfsClientTarget } from "@dappnode/common"; +import { IpfsRepository, IpfsClientTarget } from "@dappnode/types"; import { params } from "@dappnode/params"; import * as db from "@dappnode/db"; import { dappnodeInstaller } from "../index.js"; diff --git a/packages/dappmanager/src/calls/localProxy.ts b/packages/dappmanager/src/calls/localProxy.ts index 9868aa3ac..fb47b438a 100644 --- a/packages/dappmanager/src/calls/localProxy.ts +++ b/packages/dappmanager/src/calls/localProxy.ts @@ -5,7 +5,7 @@ import { getAvahiDaemonStatus } from "@dappnode/hostscriptsservices"; import { params } from "@dappnode/params"; -import { AvahiDaemonStatus, LocalProxyingStatus } from "@dappnode/common"; +import { AvahiDaemonStatus, LocalProxyingStatus } from "@dappnode/types"; import { packageSetEnvironment } from "./packageSetEnvironment.js"; import { listPackageNoThrow } from "@dappnode/dockerapi"; diff --git a/packages/dappmanager/src/calls/manageLvm.ts b/packages/dappmanager/src/calls/manageLvm.ts index b7b95557a..f198e7016 100644 --- a/packages/dappmanager/src/calls/manageLvm.ts +++ b/packages/dappmanager/src/calls/manageLvm.ts @@ -8,7 +8,7 @@ import { HostHardDisk, HostVolumeGroup, HostLogicalVolume -} from "@dappnode/common"; +} from "@dappnode/types"; export async function lvmhardDisksGet(): Promise { return await getHostHardDisks(); diff --git a/packages/dappmanager/src/calls/mountpointsGet.ts b/packages/dappmanager/src/calls/mountpointsGet.ts index 16a0772d1..740c3cedd 100644 --- a/packages/dappmanager/src/calls/mountpointsGet.ts +++ b/packages/dappmanager/src/calls/mountpointsGet.ts @@ -1,5 +1,5 @@ import { detectMountpoints } from "@dappnode/hostscriptsservices"; -import { MountpointData } from "@dappnode/common"; +import { MountpointData } from "@dappnode/types"; /** * Returns the list of current mountpoints in the host, diff --git a/packages/dappmanager/src/calls/newFeatureStatusSet.ts b/packages/dappmanager/src/calls/newFeatureStatusSet.ts index 887f45ebf..0059a642d 100644 --- a/packages/dappmanager/src/calls/newFeatureStatusSet.ts +++ b/packages/dappmanager/src/calls/newFeatureStatusSet.ts @@ -1,6 +1,6 @@ import * as db from "@dappnode/db"; import { eventBus } from "@dappnode/eventbus"; -import { NewFeatureId, NewFeatureStatus } from "@dappnode/common"; +import { NewFeatureId, NewFeatureStatus } from "@dappnode/types"; /** * Flag the UI welcome flow as completed diff --git a/packages/dappmanager/src/calls/notificationsGet.ts b/packages/dappmanager/src/calls/notificationsGet.ts index 6c63393d9..18ec7b345 100644 --- a/packages/dappmanager/src/calls/notificationsGet.ts +++ b/packages/dappmanager/src/calls/notificationsGet.ts @@ -1,5 +1,5 @@ import * as db from "@dappnode/db"; -import { PackageNotificationDb } from "@dappnode/common"; +import { PackageNotificationDb } from "@dappnode/types"; /** * Returns not viewed notifications. diff --git a/packages/dappmanager/src/calls/notificationsTest.ts b/packages/dappmanager/src/calls/notificationsTest.ts index 322bc789d..70ffcde9d 100644 --- a/packages/dappmanager/src/calls/notificationsTest.ts +++ b/packages/dappmanager/src/calls/notificationsTest.ts @@ -1,5 +1,5 @@ import { eventBus } from "@dappnode/eventbus"; -import { PackageNotification, NotificationType } from "@dappnode/common"; +import { PackageNotification, NotificationType } from "@dappnode/types"; /** * Adds a notification to be shown the UI. * Set the notification param to null (or send none) to generate diff --git a/packages/dappmanager/src/calls/optimismConfig.ts b/packages/dappmanager/src/calls/optimismConfig.ts index 239c8678d..3db1b9d8f 100644 --- a/packages/dappmanager/src/calls/optimismConfig.ts +++ b/packages/dappmanager/src/calls/optimismConfig.ts @@ -1,4 +1,4 @@ -import { OptimismConfigGet, OptimismConfigSet } from "@dappnode/common"; +import { OptimismConfigGet, OptimismConfigSet } from "@dappnode/types"; import { getOptimismConfig, setOptimismConfig } from "@dappnode/optimism"; import { dappnodeInstaller } from "../index.js"; diff --git a/packages/dappmanager/src/calls/packageGet.ts b/packages/dappmanager/src/calls/packageGet.ts index 64258b256..5891109c3 100644 --- a/packages/dappmanager/src/calls/packageGet.ts +++ b/packages/dappmanager/src/calls/packageGet.ts @@ -1,4 +1,4 @@ -import { InstalledPackageDetailData } from "@dappnode/common"; +import { InstalledPackageDetailData } from "@dappnode/types"; import { packageGet as _packageGet } from "@dappnode/installer"; /** diff --git a/packages/dappmanager/src/calls/packageInstall.ts b/packages/dappmanager/src/calls/packageInstall.ts index b2162dd01..e938c19d2 100644 --- a/packages/dappmanager/src/calls/packageInstall.ts +++ b/packages/dappmanager/src/calls/packageInstall.ts @@ -1,4 +1,4 @@ -import { Routes } from "@dappnode/common"; +import { Routes } from "@dappnode/types"; import { packageInstall as pkgInstall } from "@dappnode/installer"; import { dappnodeInstaller } from "../index.js"; diff --git a/packages/dappmanager/src/calls/packageRestart.ts b/packages/dappmanager/src/calls/packageRestart.ts index c51b78292..9d7672462 100644 --- a/packages/dappmanager/src/calls/packageRestart.ts +++ b/packages/dappmanager/src/calls/packageRestart.ts @@ -5,7 +5,7 @@ import { dockerContainerRestart, listPackage } from "@dappnode/dockerapi"; import { restartDappmanagerPatch } from "@dappnode/installer"; import { getServicesSharingPid } from "@dappnode/utils"; import { ComposeFileEditor } from "@dappnode/dockercompose"; -import { PackageContainer } from "@dappnode/common"; +import { PackageContainer } from "@dappnode/types"; import { getDockerComposePathSmart } from "@dappnode/utils"; /** diff --git a/packages/dappmanager/src/calls/packageSetEnvironment.ts b/packages/dappmanager/src/calls/packageSetEnvironment.ts index 603316eeb..dad88db8e 100644 --- a/packages/dappmanager/src/calls/packageSetEnvironment.ts +++ b/packages/dappmanager/src/calls/packageSetEnvironment.ts @@ -1,4 +1,4 @@ -import { PackageEnvs } from "@dappnode/common"; +import { PackageEnvs } from "@dappnode/types"; import { packageSetEnvironment as _packageSetEnvironment } from "@dappnode/installer"; /** diff --git a/packages/dappmanager/src/calls/packageSetPortMappings.ts b/packages/dappmanager/src/calls/packageSetPortMappings.ts index 1c98e221d..0ea74720b 100644 --- a/packages/dappmanager/src/calls/packageSetPortMappings.ts +++ b/packages/dappmanager/src/calls/packageSetPortMappings.ts @@ -1,7 +1,7 @@ import { eventBus } from "@dappnode/eventbus"; import { params } from "@dappnode/params"; import { ComposeFileEditor } from "@dappnode/dockercompose"; -import { PortMapping } from "@dappnode/common"; +import { PortMapping } from "@dappnode/types"; import { mapValues } from "lodash-es"; import { getContainersStatus, diff --git a/packages/dappmanager/src/calls/packageStartStop.ts b/packages/dappmanager/src/calls/packageStartStop.ts index cda59f8bc..67306170b 100644 --- a/packages/dappmanager/src/calls/packageStartStop.ts +++ b/packages/dappmanager/src/calls/packageStartStop.ts @@ -4,7 +4,7 @@ import { eventBus } from "@dappnode/eventbus"; import { params } from "@dappnode/params"; import { getServicesSharingPid } from "@dappnode/utils"; import { ComposeFileEditor } from "@dappnode/dockercompose"; -import { PackageContainer } from "@dappnode/common"; +import { PackageContainer } from "@dappnode/types"; const dnpsAllowedToStop = [ params.ipfsDnpName, diff --git a/packages/dappmanager/src/calls/packagesGet.ts b/packages/dappmanager/src/calls/packagesGet.ts index 8ffee3f4c..83c7d290f 100644 --- a/packages/dappmanager/src/calls/packagesGet.ts +++ b/packages/dappmanager/src/calls/packagesGet.ts @@ -1,4 +1,4 @@ -import { InstalledPackageDataApiReturn } from "@dappnode/common"; +import { InstalledPackageDataApiReturn } from "@dappnode/types"; import { packagesGet as _packagesGet } from "@dappnode/installer"; /** diff --git a/packages/dappmanager/src/calls/portsStatusGet.ts b/packages/dappmanager/src/calls/portsStatusGet.ts index f2ca77ed9..b90b8320b 100644 --- a/packages/dappmanager/src/calls/portsStatusGet.ts +++ b/packages/dappmanager/src/calls/portsStatusGet.ts @@ -7,7 +7,7 @@ import { ApiTablePortStatus, UpnpPortMapping, PackagePort -} from "@dappnode/common"; +} from "@dappnode/types"; import { params } from "@dappnode/params"; import Ajv from "ajv"; diff --git a/packages/dappmanager/src/calls/portsToOpenGet.ts b/packages/dappmanager/src/calls/portsToOpenGet.ts index 1fc9d2b45..dabe02162 100644 --- a/packages/dappmanager/src/calls/portsToOpenGet.ts +++ b/packages/dappmanager/src/calls/portsToOpenGet.ts @@ -1,6 +1,6 @@ import { getPortsToOpen } from "@dappnode/daemons"; import { listPackageContainers } from "@dappnode/dockerapi"; -import { PackageContainer, PortToOpen } from "@dappnode/common"; +import { PackageContainer, PortToOpen } from "@dappnode/types"; /** * Returns ports to be opened diff --git a/packages/dappmanager/src/calls/rebootHostIsRequiredGet.ts b/packages/dappmanager/src/calls/rebootHostIsRequiredGet.ts index 9930d7262..7466f2539 100644 --- a/packages/dappmanager/src/calls/rebootHostIsRequiredGet.ts +++ b/packages/dappmanager/src/calls/rebootHostIsRequiredGet.ts @@ -1,4 +1,4 @@ -import { RebootRequiredScript } from "@dappnode/common"; +import { RebootRequiredScript } from "@dappnode/types"; import { getRebootRequiredMemoized } from "@dappnode/hostscriptsservices"; /** diff --git a/packages/dappmanager/src/calls/releaseTrustedKey.ts b/packages/dappmanager/src/calls/releaseTrustedKey.ts index d9862233d..4f6fac4be 100644 --- a/packages/dappmanager/src/calls/releaseTrustedKey.ts +++ b/packages/dappmanager/src/calls/releaseTrustedKey.ts @@ -1,5 +1,5 @@ import * as db from "@dappnode/db"; -import { TrustedReleaseKey, releaseSignatureProtocols } from "@dappnode/common"; +import { TrustedReleaseKey, releaseSignatureProtocols } from "@dappnode/types"; /** * Add a release key to trusted keys db diff --git a/packages/dappmanager/src/calls/sshManager.ts b/packages/dappmanager/src/calls/sshManager.ts index 2067493b2..54b35eab6 100644 --- a/packages/dappmanager/src/calls/sshManager.ts +++ b/packages/dappmanager/src/calls/sshManager.ts @@ -1,4 +1,4 @@ -import { ShhStatus } from "@dappnode/common"; +import { ShhStatus } from "@dappnode/types"; import { ShellError, shellHost } from "@dappnode/utils"; type ShellHost = (cmd: string) => Promise; diff --git a/packages/dappmanager/src/calls/stakerConfig.ts b/packages/dappmanager/src/calls/stakerConfig.ts index f4060c26e..dc8b7ffa6 100644 --- a/packages/dappmanager/src/calls/stakerConfig.ts +++ b/packages/dappmanager/src/calls/stakerConfig.ts @@ -1,5 +1,5 @@ import { getStakerConfig, setStakerConfig } from "@dappnode/stakers"; -import { StakerConfigGet, StakerConfigSet, Network } from "@dappnode/common"; +import { StakerConfigGet, StakerConfigSet, Network } from "@dappnode/types"; import { dappnodeInstaller } from "../index.js"; /** diff --git a/packages/dappmanager/src/calls/statsCpuGet.ts b/packages/dappmanager/src/calls/statsCpuGet.ts index 437be8623..b3f387cfd 100644 --- a/packages/dappmanager/src/calls/statsCpuGet.ts +++ b/packages/dappmanager/src/calls/statsCpuGet.ts @@ -1,5 +1,5 @@ import osu from "node-os-utils"; -import { HostStatCpu } from "@dappnode/common"; +import { HostStatCpu } from "@dappnode/types"; /** * Returns the cpu use percentage in string diff --git a/packages/dappmanager/src/calls/statsDiskGet.ts b/packages/dappmanager/src/calls/statsDiskGet.ts index a5504b8d8..01e3205b5 100644 --- a/packages/dappmanager/src/calls/statsDiskGet.ts +++ b/packages/dappmanager/src/calls/statsDiskGet.ts @@ -1,4 +1,4 @@ -import { HostStatDisk } from "@dappnode/common"; +import { HostStatDisk } from "@dappnode/types"; import { shell } from "@dappnode/utils"; /** diff --git a/packages/dappmanager/src/calls/statsMemoryGet.ts b/packages/dappmanager/src/calls/statsMemoryGet.ts index efd63d4e1..8ff368ec8 100644 --- a/packages/dappmanager/src/calls/statsMemoryGet.ts +++ b/packages/dappmanager/src/calls/statsMemoryGet.ts @@ -1,4 +1,4 @@ -import { HostStatMemory } from "@dappnode/common"; +import { HostStatMemory } from "@dappnode/types"; import osu from "node-os-utils"; /** diff --git a/packages/dappmanager/src/calls/systemInfoGet.ts b/packages/dappmanager/src/calls/systemInfoGet.ts index 8016bb5d8..de4727ae6 100644 --- a/packages/dappmanager/src/calls/systemInfoGet.ts +++ b/packages/dappmanager/src/calls/systemInfoGet.ts @@ -1,6 +1,6 @@ import * as db from "@dappnode/db"; import { getVersionData } from "../utils/getVersionData.js"; -import { NewFeatureId, SystemInfo } from "@dappnode/common"; +import { NewFeatureId, SystemInfo } from "@dappnode/types"; import { ethereumClient } from "@dappnode/installer"; import { isCoreUpdateEnabled } from "@dappnode/daemons"; diff --git a/packages/dappmanager/src/calls/volumesGet.ts b/packages/dappmanager/src/calls/volumesGet.ts index 9606994b7..abf2ad412 100644 --- a/packages/dappmanager/src/calls/volumesGet.ts +++ b/packages/dappmanager/src/calls/volumesGet.ts @@ -1,5 +1,5 @@ import { getVolumeSystemData } from "@dappnode/dockerapi"; -import { VolumeData } from "@dappnode/common"; +import { VolumeData } from "@dappnode/types"; /** * Returns volume data diff --git a/packages/dappmanager/src/calls/wifi.ts b/packages/dappmanager/src/calls/wifi.ts index 9402519db..9c083f890 100644 --- a/packages/dappmanager/src/calls/wifi.ts +++ b/packages/dappmanager/src/calls/wifi.ts @@ -1,6 +1,6 @@ import { ComposeFileEditor } from "@dappnode/dockercompose"; import { listContainer, logContainer } from "@dappnode/dockerapi"; -import { CurrentWifiCredentials, WifiReport } from "@dappnode/common"; +import { CurrentWifiCredentials, WifiReport } from "@dappnode/types"; import { params } from "@dappnode/params"; /** diff --git a/packages/dappmanager/src/calls/wireguard.ts b/packages/dappmanager/src/calls/wireguard.ts index 2d50120d7..98946dbd9 100644 --- a/packages/dappmanager/src/calls/wireguard.ts +++ b/packages/dappmanager/src/calls/wireguard.ts @@ -3,7 +3,7 @@ import { urlJoin } from "@dappnode/utils"; import { params } from "@dappnode/params"; import { packageSetEnvironment } from "./packageSetEnvironment.js"; import { ComposeFileEditor } from "@dappnode/dockercompose"; -import { WireguardDeviceCredentials } from "@dappnode/common"; +import { WireguardDeviceCredentials } from "@dappnode/types"; const { WIREGUARD_API_URL, diff --git a/packages/dappmanager/src/initializeDb.ts b/packages/dappmanager/src/initializeDb.ts index 270c24bcc..2cbd4668e 100644 --- a/packages/dappmanager/src/initializeDb.ts +++ b/packages/dappmanager/src/initializeDb.ts @@ -11,10 +11,9 @@ import { import { getExternalUpnpIp, isUpnpAvailable } from "@dappnode/upnpc"; import { writeGlobalEnvsToEnvFile } from "@dappnode/db"; import { params } from "@dappnode/params"; -import { IdentityInterface } from "@dappnode/common"; +import { IdentityInterface, IpfsClientTarget } from "@dappnode/types"; import { logs } from "@dappnode/logger"; import { localProxyingEnableDisable } from "./calls/index.js"; -import { IpfsClientTarget } from "@dappnode/common"; import { pause, shell, getPublicIpFromUrls } from "@dappnode/utils"; // Wrap async getter so they do NOT throw, but return null and log the error diff --git a/packages/dappmanager/src/utils/getVersionData.ts b/packages/dappmanager/src/utils/getVersionData.ts index 00169b38a..c8d173b43 100644 --- a/packages/dappmanager/src/utils/getVersionData.ts +++ b/packages/dappmanager/src/utils/getVersionData.ts @@ -1,7 +1,7 @@ import fs from "fs"; import { isEqual } from "lodash-es"; import memoize from "memoizee"; -import { PackageVersionData } from "@dappnode/common"; +import { PackageVersionData } from "@dappnode/types"; import { params } from "@dappnode/params"; import * as db from "@dappnode/db"; diff --git a/packages/dappmanager/src/utils/validateBackupArray.ts b/packages/dappmanager/src/utils/validateBackupArray.ts index d3fced087..b55747a49 100644 --- a/packages/dappmanager/src/utils/validateBackupArray.ts +++ b/packages/dappmanager/src/utils/validateBackupArray.ts @@ -1,4 +1,4 @@ -import { PackageBackup } from "@dappnode/common"; +import { PackageBackup } from "@dappnode/types"; import path from "path"; /** diff --git a/packages/dappmanager/test/integration/fetchSystemData.test.int.ts b/packages/dappmanager/test/integration/fetchSystemData.test.int.ts index f73d77da1..73d25f013 100644 --- a/packages/dappmanager/test/integration/fetchSystemData.test.int.ts +++ b/packages/dappmanager/test/integration/fetchSystemData.test.int.ts @@ -2,7 +2,7 @@ import "mocha"; import { expect } from "chai"; import * as calls from "../../src/calls/index.js"; import { logs } from "@dappnode/logger"; -import { AutoUpdateSettings } from "@dappnode/common"; +import { AutoUpdateSettings } from "@dappnode/types"; import { MY_PACKAGES, SYSTEM_PACKAGES } from "@dappnode/daemons"; import { clearDbs } from "../testUtils.js"; diff --git a/packages/dappmanager/test/integration/testPackageUtils.ts b/packages/dappmanager/test/integration/testPackageUtils.ts index 68fbf8a34..523c5b52a 100644 --- a/packages/dappmanager/test/integration/testPackageUtils.ts +++ b/packages/dappmanager/test/integration/testPackageUtils.ts @@ -1,6 +1,6 @@ import "mocha"; import * as calls from "../../src/calls/index.js"; -import { InstalledPackageData, ContainerState } from "@dappnode/common"; +import { InstalledPackageData, ContainerState } from "@dappnode/types"; export async function getDnpFromListPackages( dnpName: string diff --git a/packages/dappmanager/test/testUtils.ts b/packages/dappmanager/test/testUtils.ts index e45018b8f..03f41aae7 100644 --- a/packages/dappmanager/test/testUtils.ts +++ b/packages/dappmanager/test/testUtils.ts @@ -11,9 +11,9 @@ import { PackageRelease, ReleaseSignatureStatusCode, InstallPackageData, - Compose, - Manifest -} from "@dappnode/common"; + Compose +} from "@dappnode/types"; +import { Manifest } from "@dappnode/types"; import { DappnodeInstaller } from "@dappnode/installer"; export const dappnodeInstaller = new DappnodeInstaller( diff --git a/packages/dappmanager/test/unit/calls/autoUpdateDataGet.test.ts b/packages/dappmanager/test/unit/calls/autoUpdateDataGet.test.ts index 6e82a69ba..66a8f89d2 100644 --- a/packages/dappmanager/test/unit/calls/autoUpdateDataGet.test.ts +++ b/packages/dappmanager/test/unit/calls/autoUpdateDataGet.test.ts @@ -15,7 +15,7 @@ import { import { params } from "@dappnode/params"; import rewiremock from "rewiremock/webpack"; import { autoUpdateDataGet as autoUpdateDataGetType } from "../../../src/calls/autoUpdateDataGet.js"; -import { InstalledPackageData } from "@dappnode/common"; +import { InstalledPackageData } from "@dappnode/types"; describe.skip("Call function: autoUpdateDataGet", function () { this.timeout(5000); diff --git a/packages/dappmanager/test/unit/calls/packageInstall.test.ts b/packages/dappmanager/test/unit/calls/packageInstall.test.ts index b8b622571..5fa8da5cf 100644 --- a/packages/dappmanager/test/unit/calls/packageInstall.test.ts +++ b/packages/dappmanager/test/unit/calls/packageInstall.test.ts @@ -1,13 +1,14 @@ import "mocha"; import { expect } from "chai"; import sinon from "sinon"; -import { PackageRelease, PackageRequest, Manifest } from "@dappnode/common"; +import { PackageRelease } from "@dappnode/types"; import { getMockEventBus } from "./eventBus.js"; import rewiremock from "rewiremock/webpack"; // Imports for typings import { packageInstall as packageInstallType } from "../../../src/calls/packageInstall.js"; import { mockManifest, mockRelease } from "../../testUtils.js"; import { DappGetState, DappnodeInstaller } from "@dappnode/installer"; +import { PackageRequest, Manifest } from "@dappnode/types"; describe.skip("Call function: packageInstall", function () { // Pkg data diff --git a/packages/dappmanager/test/unit/calls/packageRemove.test.ts b/packages/dappmanager/test/unit/calls/packageRemove.test.ts index 738a3c46e..e2461ba92 100644 --- a/packages/dappmanager/test/unit/calls/packageRemove.test.ts +++ b/packages/dappmanager/test/unit/calls/packageRemove.test.ts @@ -6,7 +6,7 @@ import { getDockerComposePath, validatePath } from "@dappnode/utils"; import rewiremock from "rewiremock/webpack"; // Imports for typings import { packageRemove as packageRemoveType } from "../../../src/calls/packageRemove.js"; -import { InstalledPackageData } from "@dappnode/common"; +import { InstalledPackageData } from "@dappnode/types"; import { mockDnp, cleanTestDir, mockContainer } from "../../testUtils.js"; import { getMockEventBus } from "./eventBus.js"; diff --git a/packages/db/package.json b/packages/db/package.json index dcd20005f..d8429d57b 100644 --- a/packages/db/package.json +++ b/packages/db/package.json @@ -19,7 +19,7 @@ "lint": "eslint . --ext .ts --fix src" }, "dependencies": { - "@dappnode/common": "^0.1.0", + "@dappnode/types": "^0.1.0", "@dappnode/dockerapi": "^0.1.0", "@dappnode/dockercompose": "^0.1.0", "@dappnode/eventbus": "^0.1.0", diff --git a/packages/db/src/autoUpdateSettings.ts b/packages/db/src/autoUpdateSettings.ts index da44dc049..faf34f8cd 100644 --- a/packages/db/src/autoUpdateSettings.ts +++ b/packages/db/src/autoUpdateSettings.ts @@ -2,8 +2,8 @@ import { dbCache, dbMain } from "./dbFactory.js"; import { AutoUpdateSettings, AutoUpdatePending, - AutoUpdateRegistry -} from "@dappnode/common"; + AutoUpdateRegistry, +} from "@dappnode/types"; export const AUTO_UPDATE_SETTINGS = "auto-update-settings"; const AUTO_UPDATE_REGISTRY = "auto-update-registry"; diff --git a/packages/db/src/coreUpdate.ts b/packages/db/src/coreUpdate.ts index bb33e221f..de01f2ba3 100644 --- a/packages/db/src/coreUpdate.ts +++ b/packages/db/src/coreUpdate.ts @@ -1,6 +1,6 @@ import { dbCache } from "./dbFactory.js"; import { pick } from "lodash-es"; -import { InstallPackageData, InstallPackageDataPaths } from "@dappnode/common"; +import { InstallPackageData, InstallPackageDataPaths } from "@dappnode/types"; const CORE_UPDATE_PACKAGES_DATA = "core-update-packages-data"; @@ -32,9 +32,9 @@ export const coreUpdatePackagesData = { "imagePath", "isUpdate", "dockerTimeout", - "containersStatus" + "containersStatus", ]) ) : packagesData - ) + ), }; diff --git a/packages/db/src/dyndns.ts b/packages/db/src/dyndns.ts index 7c67b3914..af286788a 100644 --- a/packages/db/src/dyndns.ts +++ b/packages/db/src/dyndns.ts @@ -1,5 +1,5 @@ import { dbMain } from "./dbFactory.js"; -import { IdentityInterface } from "@dappnode/common"; +import { IdentityInterface } from "@dappnode/types"; import { interceptGlobalEnvOnSet } from "./intercepGlobalEnvOnSet.js"; const PUBLIC_IP = "public-ip"; diff --git a/packages/db/src/ethClient.ts b/packages/db/src/ethClient.ts index 43ae455b8..b355fe992 100644 --- a/packages/db/src/ethClient.ts +++ b/packages/db/src/ethClient.ts @@ -8,7 +8,7 @@ import { EthClientInstallStatus, ExecutionClientMainnet, ConsensusClientMainnet, -} from "@dappnode/common"; +} from "@dappnode/types"; // User chosen properties const ETH_CLIENT_FALLBACK = "eth-client-fallback"; diff --git a/packages/db/src/globalEnvs.ts b/packages/db/src/globalEnvs.ts index 05d63ffbb..ba0bfeee7 100644 --- a/packages/db/src/globalEnvs.ts +++ b/packages/db/src/globalEnvs.ts @@ -1,4 +1,4 @@ -import { GlobalEnvsPrefixed, GlobalEnvs } from "@dappnode/common"; +import { GlobalEnvsPrefixed, GlobalEnvs } from "@dappnode/types"; import { staticIp, domain, dyndnsIdentity, publicIp } from "./dyndns.js"; import { internalIp, noNatLoopback } from "./network.js"; import { opEnableHistoricalRpc, opExecutionClient } from "./optimismConfig.js"; diff --git a/packages/db/src/ipfsClient.ts b/packages/db/src/ipfsClient.ts index 7cc423304..c98dc3668 100644 --- a/packages/db/src/ipfsClient.ts +++ b/packages/db/src/ipfsClient.ts @@ -1,5 +1,5 @@ import { dbMain } from "./dbFactory.js"; -import { IpfsClientTarget } from "@dappnode/common"; +import { IpfsClientTarget } from "@dappnode/types"; import { params } from "@dappnode/params"; // User chosen properties diff --git a/packages/db/src/notification.ts b/packages/db/src/notification.ts index 6886598e7..50ec16585 100644 --- a/packages/db/src/notification.ts +++ b/packages/db/src/notification.ts @@ -1,6 +1,6 @@ import { dbCache } from "./dbFactory.js"; import { stripDots } from "./dbUtils.js"; -import { PackageNotificationDb, PackageNotification } from "@dappnode/common"; +import { PackageNotificationDb, PackageNotification } from "@dappnode/types"; const NOTIFICATION = "notification"; const NOTIFICATION_LAST_EMITTED_VERSION = "notification-last-emitted-version"; @@ -10,9 +10,9 @@ export const notification = dbCache.indexedByKey( rootKey: NOTIFICATION, // The `update-available-${dnpName}-${newVersion}` included dots, // so for backwards compatibility they must be stripped - getKey: id => stripDots(id), + getKey: (id) => stripDots(id), validate: (id, notification) => - typeof id === "string" && typeof notification === "object" + typeof id === "string" && typeof notification === "object", } ); @@ -27,8 +27,8 @@ export function notificationPush(id: string, n: PackageNotification): void { export const notificationLastEmitVersion = dbCache.indexedByKey( { rootKey: NOTIFICATION_LAST_EMITTED_VERSION, - getKey: dnpName => stripDots(dnpName), + getKey: (dnpName) => stripDots(dnpName), validate: (dnpName, lastEmittedVersion) => - typeof lastEmittedVersion === "string" + typeof lastEmittedVersion === "string", } ); diff --git a/packages/db/src/optimismConfig.ts b/packages/db/src/optimismConfig.ts index 417b1bb30..efc7a13c4 100644 --- a/packages/db/src/optimismConfig.ts +++ b/packages/db/src/optimismConfig.ts @@ -1,4 +1,4 @@ -import { ExecutionClientOptimism } from "@dappnode/common"; +import { ExecutionClientOptimism } from "@dappnode/types"; import { dbMain } from "./dbFactory.js"; import { interceptGlobalEnvOnSet } from "./intercepGlobalEnvOnSet.js"; diff --git a/packages/db/src/package.ts b/packages/db/src/package.ts index f12989034..1c8e45c36 100644 --- a/packages/db/src/package.ts +++ b/packages/db/src/package.ts @@ -1,4 +1,4 @@ -import { PackageItemData, UpdateAvailable } from "@dappnode/common"; +import { PackageItemData, UpdateAvailable } from "@dappnode/types"; import { dbCache } from "./dbFactory.js"; import { stripDots } from "./dbUtils.js"; @@ -10,19 +10,19 @@ const PKG_ITEM_METADATA = "pkg-item-metadata"; export const pkgItemMetadata = dbCache.indexedByKey({ rootKey: PKG_ITEM_METADATA, - getKey: target => target, + getKey: (target) => target, validate: (id, metadata) => - typeof id === "string" && typeof metadata === "object" + typeof id === "string" && typeof metadata === "object", }); export const packageGettingStartedShow = dbCache.indexedByKey({ rootKey: PACKAGE_GETTING_STARTED_SHOW, - getKey: dnpName => stripDots(dnpName) + getKey: (dnpName) => stripDots(dnpName), }); export const packageInstallTime = dbCache.indexedByKey({ rootKey: PACKAGE_INSTALL_TIME, - getKey: dnpName => stripDots(dnpName) + getKey: (dnpName) => stripDots(dnpName), }); export function addPackageInstalledMetadata(dnpName: string): void { @@ -40,7 +40,7 @@ export const packageLatestKnownVersion = dbCache.indexedByKey< >({ rootKey: PACKAGE_LATEST_KNOWN_VERSION, // Do NOT strip dots so the packages can be indexed by dnpName doing .getAll() - getKey: dnpName => dnpName + getKey: (dnpName) => dnpName, }); /** @@ -51,5 +51,5 @@ export const packageSentData = dbCache.indexedByKey< string >({ rootKey: PACKAGE_SENT_DATA, - getKey: dnpName => dnpName + getKey: (dnpName) => dnpName, }); diff --git a/packages/db/src/releaseKeys.ts b/packages/db/src/releaseKeys.ts index 7a961f2c5..9c0a94f57 100644 --- a/packages/db/src/releaseKeys.ts +++ b/packages/db/src/releaseKeys.ts @@ -1,5 +1,5 @@ import { params } from "@dappnode/params"; -import { TrustedReleaseKey } from "@dappnode/common"; +import { TrustedReleaseKey } from "@dappnode/types"; import { dbMain } from "./dbFactory.js"; const RELEASE_KEYS_TRUSTED = "release-keys-trusted"; diff --git a/packages/db/src/stakerConfig.ts b/packages/db/src/stakerConfig.ts index 30a499f24..25ffa69f8 100644 --- a/packages/db/src/stakerConfig.ts +++ b/packages/db/src/stakerConfig.ts @@ -11,7 +11,7 @@ import { ExecutionClientLukso, ConsensusClientHolesky, ExecutionClientHolesky, -} from "@dappnode/common"; +} from "@dappnode/types"; // Mainnet diff --git a/packages/db/src/system.ts b/packages/db/src/system.ts index e62e87cb1..e2a3de2d4 100644 --- a/packages/db/src/system.ts +++ b/packages/db/src/system.ts @@ -1,5 +1,5 @@ import { dbCache, dbMain } from "./dbFactory.js"; -import { PackageVersionData } from "@dappnode/common"; +import { PackageVersionData } from "@dappnode/types"; import { interceptGlobalEnvOnSet } from "./intercepGlobalEnvOnSet.js"; const SERVER_NAME = "server-name"; diff --git a/packages/db/src/ui.ts b/packages/db/src/ui.ts index 567712d4e..6cab8becb 100644 --- a/packages/db/src/ui.ts +++ b/packages/db/src/ui.ts @@ -1,8 +1,5 @@ import { dbMain } from "./dbFactory.js"; -import { - NewFeatureId, - NewFeatureStatus, -} from "@dappnode/common"; +import { NewFeatureId, NewFeatureStatus } from "@dappnode/types"; const NEW_FEATURE_STATUS = "new-feature-status"; @@ -11,6 +8,5 @@ export const newFeatureStatus = dbMain.indexedByKey< NewFeatureId >({ rootKey: NEW_FEATURE_STATUS, - getKey: featureId => featureId + getKey: (featureId) => featureId, }); - diff --git a/packages/db/src/updatePkgsWithGlobalEnvs.ts b/packages/db/src/updatePkgsWithGlobalEnvs.ts index 59eb88d47..1e9d2564a 100644 --- a/packages/db/src/updatePkgsWithGlobalEnvs.ts +++ b/packages/db/src/updatePkgsWithGlobalEnvs.ts @@ -7,7 +7,7 @@ import { listPackageContainers, } from "@dappnode/dockerapi"; import { packageInstalledHasPid } from "@dappnode/utils"; -import { PackageEnvs } from "@dappnode/common"; +import { PackageEnvs } from "@dappnode/types"; import { params } from "@dappnode/params"; import { logs } from "@dappnode/logger"; diff --git a/packages/db/src/upnp.ts b/packages/db/src/upnp.ts index 125abb76a..607d35e55 100644 --- a/packages/db/src/upnp.ts +++ b/packages/db/src/upnp.ts @@ -1,5 +1,5 @@ import { dbCache } from "./dbFactory.js"; -import { PackagePort, UpnpPortMapping } from "@dappnode/common"; +import { PackagePort, UpnpPortMapping } from "@dappnode/types"; import { interceptGlobalEnvOnSet } from "./intercepGlobalEnvOnSet.js"; const UPNP_AVAILABLE = "upnp-available"; diff --git a/packages/db/src/vpn.ts b/packages/db/src/vpn.ts index 35dcb3635..34712077f 100644 --- a/packages/db/src/vpn.ts +++ b/packages/db/src/vpn.ts @@ -1,5 +1,5 @@ import { dbCache } from "./dbFactory.js"; -import { PackageVersionData } from "@dappnode/common"; +import { PackageVersionData } from "@dappnode/types"; const VERSION_DATA_VPN = "version-data-vpn"; diff --git a/packages/dockerApi/package.json b/packages/dockerApi/package.json index 051bdfc58..67ff993bf 100644 --- a/packages/dockerApi/package.json +++ b/packages/dockerApi/package.json @@ -20,7 +20,6 @@ "lint": "eslint . --ext .ts --fix src" }, "dependencies": { - "@dappnode/common": "^0.1.0", "@dappnode/hostscriptsservices": "^0.1.0", "@dappnode/params": "^0.1.0", "@dappnode/utils": "^0.1.0", diff --git a/packages/dockerApi/src/dockerComposeUp.ts b/packages/dockerApi/src/dockerComposeUp.ts index 380555e69..8ff4defcc 100644 --- a/packages/dockerApi/src/dockerComposeUp.ts +++ b/packages/dockerApi/src/dockerComposeUp.ts @@ -13,7 +13,7 @@ import { ContainersStatus, InstalledPackageData, PackageContainer, -} from "@dappnode/common"; +} from "@dappnode/types"; import { getDockerComposePathSmart } from "@dappnode/utils"; interface ComposeUpArgs { diff --git a/packages/dockerApi/src/getContainersAndVolumesToRemove.ts b/packages/dockerApi/src/getContainersAndVolumesToRemove.ts index b40109b20..64ad6e70d 100644 --- a/packages/dockerApi/src/getContainersAndVolumesToRemove.ts +++ b/packages/dockerApi/src/getContainersAndVolumesToRemove.ts @@ -1,5 +1,5 @@ import { uniq } from "lodash-es"; -import { InstalledPackageData } from "@dappnode/common"; +import { InstalledPackageData } from "@dappnode/types"; import { isVolumeOwner } from "./volumesData.js"; import { DockerVolumeListItem } from "./api/index.js"; diff --git a/packages/dockerApi/src/list/isPortMappingDeletable.ts b/packages/dockerApi/src/list/isPortMappingDeletable.ts index 1e2c859c8..a8d4bdb1f 100644 --- a/packages/dockerApi/src/list/isPortMappingDeletable.ts +++ b/packages/dockerApi/src/list/isPortMappingDeletable.ts @@ -1,4 +1,4 @@ -import { PortMapping } from "@dappnode/common"; +import { PortMapping } from "@dappnode/types"; /** * Utility to mark a port mapping as deletable in the admin UI @@ -14,7 +14,7 @@ export function isPortMappingDeletable( // Assume if no defaultPorts they were empty, so all ports = deletable !Array.isArray(defaultPorts) || !defaultPorts.find( - defaultPort => + (defaultPort) => defaultPort.container == port.container && defaultPort.protocol == port.protocol ) diff --git a/packages/dockerApi/src/list/listContainers.ts b/packages/dockerApi/src/list/listContainers.ts index 64d5e8554..d0a6c0909 100644 --- a/packages/dockerApi/src/list/listContainers.ts +++ b/packages/dockerApi/src/list/listContainers.ts @@ -1,5 +1,5 @@ import { listContainers as dockerApiListContainers } from "../api/index.js"; -import { PackageContainer } from "@dappnode/common"; +import { PackageContainer } from "@dappnode/types"; import { parseContainerInfo } from "./parseContainerInfo.js"; /** diff --git a/packages/dockerApi/src/list/listPackages.ts b/packages/dockerApi/src/list/listPackages.ts index 7c598da76..ed9a1f174 100644 --- a/packages/dockerApi/src/list/listPackages.ts +++ b/packages/dockerApi/src/list/listPackages.ts @@ -1,4 +1,4 @@ -import { InstalledPackageData } from "@dappnode/common"; +import { InstalledPackageData } from "@dappnode/types"; import { listPackageContainers } from "./listContainers.js"; import { groupPackagesFromContainers } from "./parsePackageFromContainer.js"; diff --git a/packages/dockerApi/src/list/parseContainerInfo.ts b/packages/dockerApi/src/list/parseContainerInfo.ts index d09908ad1..c8120bc7b 100644 --- a/packages/dockerApi/src/list/parseContainerInfo.ts +++ b/packages/dockerApi/src/list/parseContainerInfo.ts @@ -4,7 +4,7 @@ import { PackageContainer, VolumeMapping, ContainerState, -} from "@dappnode/common"; +} from "@dappnode/types"; import { parsePortMappings, parseVolumeMappings, diff --git a/packages/dockerApi/src/list/parsePackageFromContainer.ts b/packages/dockerApi/src/list/parsePackageFromContainer.ts index 694dde67c..161834cb7 100644 --- a/packages/dockerApi/src/list/parsePackageFromContainer.ts +++ b/packages/dockerApi/src/list/parsePackageFromContainer.ts @@ -1,5 +1,5 @@ import { pick } from "lodash-es"; -import { InstalledPackageData, PackageContainer } from "@dappnode/common"; +import { InstalledPackageData, PackageContainer } from "@dappnode/types"; /** * Return containers grouped by parent package. Necessary for multi-service packages @@ -23,9 +23,9 @@ export function groupPackagesFromContainers( "origin", "chain", "domainAlias", - "canBeFullnode" + "canBeFullnode", ]), - containers: [] + containers: [], }; dnpMap.set(container.dnpName, dnp); } diff --git a/packages/dockerApi/src/utils.ts b/packages/dockerApi/src/utils.ts index e9158a02f..d98983c0c 100644 --- a/packages/dockerApi/src/utils.ts +++ b/packages/dockerApi/src/utils.ts @@ -1,6 +1,6 @@ import Dockerode from "dockerode"; import stripAnsi from "strip-ansi"; -import { PortMapping, PortProtocol } from "@dappnode/common"; +import { PortMapping, PortProtocol } from "@dappnode/types"; import { isPortMappingDeletable } from "./list/isPortMappingDeletable.js"; /** @@ -38,7 +38,7 @@ export function stripDockerApiLogsHeaderAndAnsi(logs: string): string { return stripAnsi( logs .split("\n") - .map(line => stripDockerApiLogHeader(line)) + .map((line) => stripDockerApiLogHeader(line)) .join("\n") ); } @@ -119,13 +119,13 @@ export function ensureUniquePortsFromDockerApi( ({ ...(PublicPort ? { host: PublicPort } : {}), container: PrivatePort, - protocol: Type === "udp" ? PortProtocol.UDP : PortProtocol.TCP + protocol: Type === "udp" ? PortProtocol.UDP : PortProtocol.TCP, }) ) .map( (port): PortMapping => ({ ...port, - deletable: isPortMappingDeletable(port, defaultPorts) + deletable: isPortMappingDeletable(port, defaultPorts), }) ); diff --git a/packages/dockerApi/src/volumesData.ts b/packages/dockerApi/src/volumesData.ts index 061776e10..ce3a08a4c 100644 --- a/packages/dockerApi/src/volumesData.ts +++ b/packages/dockerApi/src/volumesData.ts @@ -5,7 +5,7 @@ import { VolumeData, VolumeOwnershipData, PackageContainer, -} from "@dappnode/common"; +} from "@dappnode/types"; import { detectMountpoints } from "@dappnode/hostscriptsservices"; /** @@ -56,39 +56,37 @@ export async function getVolumeSystemData(): Promise { // ); // Append sizes after to optimize the number of calls to dockerDf and host - return volumes.map( - (vol): VolumeData => { - const ownershipData = parseVolumeOwnershipData(vol, containers); + return volumes.map((vol): VolumeData => { + const ownershipData = parseVolumeOwnershipData(vol, containers); - // Get the size of the volume via docker system df -v - const volDfData = volumesDf.find((v) => v.Name === vol.Name); - const size = volDfData ? volDfData.UsageData.Size : undefined; - const refCount = volDfData ? volDfData.UsageData.RefCount : undefined; - // Check users for custom bind volumes - const isOrphan = !refCount && !ownershipData.owner; + // Get the size of the volume via docker system df -v + const volDfData = volumesDf.find((v) => v.Name === vol.Name); + const size = volDfData ? volDfData.UsageData.Size : undefined; + const refCount = volDfData ? volDfData.UsageData.RefCount : undefined; + // Check users for custom bind volumes + const isOrphan = !refCount && !ownershipData.owner; - // Custom mountpoint data - const pathParts = - vol.Options && vol.Options.device - ? parseDevicePath(vol.Options.device) - : undefined; + // Custom mountpoint data + const pathParts = + vol.Options && vol.Options.device + ? parseDevicePath(vol.Options.device) + : undefined; - return { - // Real volume and owner name to call delete on - name: vol.Name, - owner: ownershipData.owner, - internalName: parseVolumeLabels(vol.Labels).internalName, - createdAt: new Date(vol.CreatedAt).getTime(), - size, - refCount, - isOrphan, - mountpoint: pathParts ? pathParts.mountpoint : "", - fileSystem: pathParts - ? mountpoints.find((fs) => fs.mountpoint === pathParts.mountpoint) - : undefined, - }; - } - ); + return { + // Real volume and owner name to call delete on + name: vol.Name, + owner: ownershipData.owner, + internalName: parseVolumeLabels(vol.Labels).internalName, + createdAt: new Date(vol.CreatedAt).getTime(), + size, + refCount, + isOrphan, + mountpoint: pathParts ? pathParts.mountpoint : "", + fileSystem: pathParts + ? mountpoints.find((fs) => fs.mountpoint === pathParts.mountpoint) + : undefined, + }; + }); } export function parseVolumeOwnershipData( @@ -117,9 +115,7 @@ export function parseVolumeOwnershipData( * "com.docker.compose.volume": "lndconfig_backup" * }, */ -function parseVolumeLabels(labels?: { - [labelName: string]: string; -}): { +function parseVolumeLabels(labels?: { [labelName: string]: string }): { normalizedOwnerName: string; internalName?: string; } { diff --git a/packages/dockerApi/test/testUtils.ts b/packages/dockerApi/test/testUtils.ts index 72692765d..ea4d26853 100644 --- a/packages/dockerApi/test/testUtils.ts +++ b/packages/dockerApi/test/testUtils.ts @@ -2,7 +2,7 @@ import { InstalledPackageData, PackageContainer, VolumeMapping, -} from "@dappnode/common"; +} from "@dappnode/types"; /** * Mock data diff --git a/packages/dockerApi/test/unit/parseContainerInfo.test.ts b/packages/dockerApi/test/unit/parseContainerInfo.test.ts index e2699866e..9e7fe6513 100644 --- a/packages/dockerApi/test/unit/parseContainerInfo.test.ts +++ b/packages/dockerApi/test/unit/parseContainerInfo.test.ts @@ -1,6 +1,6 @@ import "mocha"; import { expect } from "chai"; -import { PackageContainer, PortProtocol } from "@dappnode/common"; +import { PackageContainer, PortProtocol } from "@dappnode/types"; import { parseContainerInfo, parseDnpNameFromContainerName, diff --git a/packages/dockerApi/test/unit/utils.test.ts b/packages/dockerApi/test/unit/utils.test.ts index 1ddb18652..caf09021c 100644 --- a/packages/dockerApi/test/unit/utils.test.ts +++ b/packages/dockerApi/test/unit/utils.test.ts @@ -5,7 +5,7 @@ import { ensureUniquePortsFromDockerApi, stripDockerApiLogsHeaderAndAnsi, } from "../../src/index.js"; -import { PackageContainer } from "@dappnode/common"; +import { PackageContainer } from "@dappnode/types"; import { mockContainer } from "../testUtils.js"; import Dockerode from "dockerode"; diff --git a/packages/dockerApi/test/unit/volumesData.test.ts b/packages/dockerApi/test/unit/volumesData.test.ts index 04ad74697..0088bc29e 100644 --- a/packages/dockerApi/test/unit/volumesData.test.ts +++ b/packages/dockerApi/test/unit/volumesData.test.ts @@ -4,7 +4,7 @@ import { parseVolumeOwnershipData, normalizeProjectName, } from "../../src/index.js"; -import { PackageContainer, VolumeOwnershipData } from "@dappnode/common"; +import { PackageContainer, VolumeOwnershipData } from "@dappnode/types"; describe("docker > volumes data", () => { describe("normalizeProjectName", () => { @@ -39,8 +39,7 @@ describe("docker > volumes data", () => { ports: [], volumes: [ { - host: - "/var/lib/docker/volumes/maindnpdappnodeeth_changeme-main/_data", + host: "/var/lib/docker/volumes/maindnpdappnodeeth_changeme-main/_data", container: "/temp", name: "maindnpdappnodeeth_changeme-main", }, @@ -50,8 +49,7 @@ describe("docker > volumes data", () => { name: "maindnpdappnodeeth_data", }, { - host: - "/var/lib/docker/volumes/dependencydnpdappnodeeth_data/_data", + host: "/var/lib/docker/volumes/dependencydnpdappnodeeth_data/_data", container: "/usrdep", name: "dependencydnpdappnodeeth_data", }, @@ -81,13 +79,11 @@ describe("docker > volumes data", () => { ports: [], volumes: [ { - host: - "/home/lion/Code/dappnode/DNP_DAPPMANAGER/packages/dappmanager/test_mountpoints/dnplifecycle-dep/testBind", + host: "/home/lion/Code/dappnode/DNP_DAPPMANAGER/packages/dappmanager/test_mountpoints/dnplifecycle-dep/testBind", container: "/temp", }, { - host: - "/var/lib/docker/volumes/dependencydnpdappnodeeth_data/_data", + host: "/var/lib/docker/volumes/dependencydnpdappnodeeth_data/_data", container: "/usr", name: "dependencydnpdappnodeeth_data", }, diff --git a/packages/dockerCompose/package.json b/packages/dockerCompose/package.json index 959fea8f7..263ea46eb 100644 --- a/packages/dockerCompose/package.json +++ b/packages/dockerCompose/package.json @@ -19,7 +19,7 @@ "lint": "eslint . --ext .ts --fix src" }, "dependencies": { - "@dappnode/common": "^0.1.0", + "@dappnode/types": "^0.1.0", "@dappnode/utils": "^0.1.0", "lodash-es": "^4.17.21" }, diff --git a/packages/dockerCompose/src/clean.ts b/packages/dockerCompose/src/clean.ts index bf38904f4..97c6b6bbc 100644 --- a/packages/dockerCompose/src/clean.ts +++ b/packages/dockerCompose/src/clean.ts @@ -1,5 +1,5 @@ import { mapValues, omitBy, isObject, isEmpty, pick } from "lodash-es"; -import { Compose } from "@dappnode/common"; +import { Compose } from "@dappnode/types"; /** * Cleans empty or null properties diff --git a/packages/dockerCompose/src/editor.ts b/packages/dockerCompose/src/editor.ts index 4cb21f6b4..7a11151ef 100644 --- a/packages/dockerCompose/src/editor.ts +++ b/packages/dockerCompose/src/editor.ts @@ -13,13 +13,16 @@ import { } from "lodash-es"; import { ContainerLabelsRaw } from "./types.js"; import { + Manifest, Compose, ComposeService, ComposeNetwork, - ComposeServiceNetwork, PackageEnvs, - Manifest, -} from "@dappnode/common"; + ComposeServiceNetwork, + GlobalEnvsPrefixed, + PortMapping, + UserSettings, +} from "@dappnode/types"; import { stringifyPortMappings, parsePortMappings, @@ -27,11 +30,6 @@ import { } from "./ports.js"; import { parseServiceNetworks } from "./networks.js"; import { verifyCompose } from "./verify.js"; -import { - GlobalEnvsPrefixed, - PortMapping, - UserSettings, -} from "@dappnode/common"; import { parseUserSettings, applyUserSettings } from "./userSettings.js"; import { getDockerComposePath, diff --git a/packages/dockerCompose/src/labelsDb.ts b/packages/dockerCompose/src/labelsDb.ts index 5a399b769..32ff3023c 100644 --- a/packages/dockerCompose/src/labelsDb.ts +++ b/packages/dockerCompose/src/labelsDb.ts @@ -1,13 +1,13 @@ import { ContainerLabelsRaw, ContainerLabelTypes } from "./types.js"; import { stringifyEnvironment } from "@dappnode/utils"; import { + Dependencies, ComposeService, ChainDriver, ChainDriverSpecs, ChainDriverType, chainDriversTypes, - Dependencies, -} from "@dappnode/common"; +} from "@dappnode/types"; import { pick, omitBy, mapValues } from "lodash-es"; /** @@ -138,9 +138,7 @@ export function writeDefaultsToLabels({ }); } -export function readContainerLabels( - labelsRaw: ContainerLabelsRaw -): Partial<{ +export function readContainerLabels(labelsRaw: ContainerLabelsRaw): Partial<{ dnpName: string; version: string; serviceName: string; diff --git a/packages/dockerCompose/src/networks.ts b/packages/dockerCompose/src/networks.ts index 1e8dfb1a3..89aeb03a0 100644 --- a/packages/dockerCompose/src/networks.ts +++ b/packages/dockerCompose/src/networks.ts @@ -1,7 +1,7 @@ import { ComposeServiceNetworks, ComposeServiceNetworksObj, -} from "@dappnode/common"; +} from "@dappnode/types"; /** * Parse service networks to object form diff --git a/packages/dockerCompose/src/ports.ts b/packages/dockerCompose/src/ports.ts index 035ee9044..553f26720 100644 --- a/packages/dockerCompose/src/ports.ts +++ b/packages/dockerCompose/src/ports.ts @@ -1,4 +1,4 @@ -import { PortMapping, PortProtocol } from "@dappnode/common"; +import { PortMapping, PortProtocol } from "@dappnode/types"; import { uniqBy, concat } from "lodash-es"; /** diff --git a/packages/dockerCompose/src/setDappnodeComposeDefaults.ts b/packages/dockerCompose/src/setDappnodeComposeDefaults.ts index 0ad7d235c..e3fb5d2f5 100644 --- a/packages/dockerCompose/src/setDappnodeComposeDefaults.ts +++ b/packages/dockerCompose/src/setDappnodeComposeDefaults.ts @@ -11,13 +11,13 @@ import { params } from "@dappnode/params"; import { cleanCompose } from "./clean.js"; import { parseServiceNetworks } from "./networks.js"; import { - Manifest, Compose, + ComposeNetworks, ComposeService, ComposeServiceNetworks, - ComposeNetworks, dockerComposeSafeKeys, -} from "@dappnode/common"; + Manifest, +} from "@dappnode/types"; import { lt } from "semver"; /** diff --git a/packages/dockerCompose/src/specialPermissions.ts b/packages/dockerCompose/src/specialPermissions.ts index 274e83ed6..d1f688708 100644 --- a/packages/dockerCompose/src/specialPermissions.ts +++ b/packages/dockerCompose/src/specialPermissions.ts @@ -1,4 +1,4 @@ -import { SpecialPermission, Compose } from "@dappnode/common"; +import { Compose, SpecialPermission } from "@dappnode/types"; /** * Parses relevant settings in the compose that may be dangerous or grant diff --git a/packages/dockerCompose/src/types.ts b/packages/dockerCompose/src/types.ts index 88bfce79e..ef67ed583 100644 --- a/packages/dockerCompose/src/types.ts +++ b/packages/dockerCompose/src/types.ts @@ -1,4 +1,4 @@ -import { Dependencies, ChainDriver } from "@dappnode/common"; +import { Dependencies, ChainDriver } from "@dappnode/types"; export interface ContainerLabelsRaw { [labelId: string]: string; diff --git a/packages/dockerCompose/src/userSettings.ts b/packages/dockerCompose/src/userSettings.ts index 696e9867a..31a8590a7 100644 --- a/packages/dockerCompose/src/userSettings.ts +++ b/packages/dockerCompose/src/userSettings.ts @@ -9,11 +9,11 @@ import { } from "./index.js"; import { parseEnvironment } from "@dappnode/utils"; import { + Compose, PortMapping, UserSettings, VolumeMapping, - Compose, -} from "@dappnode/common"; +} from "@dappnode/types"; import { cleanCompose, isOmitable } from "./clean.js"; import { stringifyVolumeMappings } from "./volumes.js"; import { readContainerLabels, writeDefaultsToLabels } from "./labelsDb.js"; @@ -138,28 +138,24 @@ export function applyUserSettings( ); const nextPorts = stringifyPortMappings( - portMappings.map( - (portMapping): PortMapping => { - const portId = getPortMappingId(portMapping); - const userSetHost = parseInt(userSetPortMappings[portId]); - // Use `in` operator to tolerate empty hosts (= ephemeral port) - return portId in userSetPortMappings - ? { ...portMapping, host: userSetHost || undefined } - : portMapping; - } - ) + portMappings.map((portMapping): PortMapping => { + const portId = getPortMappingId(portMapping); + const userSetHost = parseInt(userSetPortMappings[portId]); + // Use `in` operator to tolerate empty hosts (= ephemeral port) + return portId in userSetPortMappings + ? { ...portMapping, host: userSetHost || undefined } + : portMapping; + }) ); // ##### Kept for legacy compatibility const nextServiceVolumes = stringifyVolumeMappings( - volumeMappings.map( - (vol): VolumeMapping => { - const hostUserSet = vol.name && userSetLegacyBindVolumes[vol.name]; - return hostUserSet && path.isAbsolute(hostUserSet) - ? { host: hostUserSet, container: vol.container } - : vol; - } - ) + volumeMappings.map((vol): VolumeMapping => { + const hostUserSet = vol.name && userSetLegacyBindVolumes[vol.name]; + return hostUserSet && path.isAbsolute(hostUserSet) + ? { host: hostUserSet, container: vol.container } + : vol; + }) ); // ##### diff --git a/packages/dockerCompose/src/validate.ts b/packages/dockerCompose/src/validate.ts index 3a7a72a96..4abd66771 100644 --- a/packages/dockerCompose/src/validate.ts +++ b/packages/dockerCompose/src/validate.ts @@ -1,6 +1,6 @@ import { getSchemaValidator } from "@dappnode/utils"; import compose3xSchema from "./compose_v3x.schema.json" assert { type: "json" }; -import { Compose } from "@dappnode/common"; +import { Compose } from "@dappnode/types"; /** * Validates a compose 3.x not strictly diff --git a/packages/dockerCompose/src/verify.ts b/packages/dockerCompose/src/verify.ts index 31394e99d..902d5cac9 100644 --- a/packages/dockerCompose/src/verify.ts +++ b/packages/dockerCompose/src/verify.ts @@ -1,4 +1,4 @@ -import { Compose } from "@dappnode/common"; +import { Compose } from "@dappnode/types"; import { applyRecursivelyToStringValues } from "@dappnode/utils"; import { parsePortMappings } from "./ports.js"; diff --git a/packages/dockerCompose/src/volumes.ts b/packages/dockerCompose/src/volumes.ts index 571de465f..a9ce6059f 100644 --- a/packages/dockerCompose/src/volumes.ts +++ b/packages/dockerCompose/src/volumes.ts @@ -1,5 +1,5 @@ import path from "path"; -import { VolumeMapping } from "@dappnode/common"; +import { VolumeMapping } from "@dappnode/types"; /** * Normalizes volume paths, removes trailing slash @@ -30,7 +30,7 @@ export function parseVolumeMappings(volumesArray: string[]): VolumeMapping[] { return { host, container, - name: isNamed ? host : undefined + name: isNamed ? host : undefined, }; }) .filter(({ container }) => container); diff --git a/packages/dockerCompose/test/testUtils.ts b/packages/dockerCompose/test/testUtils.ts index c0790fdde..af4c69cd4 100644 --- a/packages/dockerCompose/test/testUtils.ts +++ b/packages/dockerCompose/test/testUtils.ts @@ -1,4 +1,4 @@ -import { Compose } from "@dappnode/common"; +import { Compose } from "@dappnode/types"; export const mockDnpName = "mock-dnp.dnp.dappnode.eth"; export const mockDnpVersion = "0.0.0"; diff --git a/packages/dockerCompose/test/unit/composeAliases.test.ts b/packages/dockerCompose/test/unit/composeAliases.test.ts index 2024b8a60..dd1e37130 100644 --- a/packages/dockerCompose/test/unit/composeAliases.test.ts +++ b/packages/dockerCompose/test/unit/composeAliases.test.ts @@ -8,7 +8,7 @@ import { import { params } from "@dappnode/params"; import fs from "fs"; import path from "path"; -import { GlobalEnvsPrefixed, ComposeServiceNetwork } from "@dappnode/common"; +import { GlobalEnvsPrefixed, ComposeServiceNetwork } from "@dappnode/types"; describe("compose service editor", () => { const exampleCompose = ` diff --git a/packages/dockerCompose/test/unit/composeSpecs.test.ts b/packages/dockerCompose/test/unit/composeSpecs.test.ts index 280194cd1..66482c12e 100644 --- a/packages/dockerCompose/test/unit/composeSpecs.test.ts +++ b/packages/dockerCompose/test/unit/composeSpecs.test.ts @@ -2,7 +2,7 @@ import "mocha"; import { expect } from "chai"; import fs from "fs"; import path from "path"; -import { Manifest, Compose } from "@dappnode/common"; +import { Manifest, Compose } from "@dappnode/types"; import { yamlParse, yamlDump, isNotFoundError } from "@dappnode/utils"; import { setDappnodeComposeDefaults, diff --git a/packages/dockerCompose/test/unit/ports.test.ts b/packages/dockerCompose/test/unit/ports.test.ts index 36d6dcd8f..a64ca4123 100644 --- a/packages/dockerCompose/test/unit/ports.test.ts +++ b/packages/dockerCompose/test/unit/ports.test.ts @@ -1,6 +1,6 @@ import "mocha"; import { expect } from "chai"; -import { PortProtocol } from "@dappnode/common"; +import { PortProtocol } from "@dappnode/types"; import { parsePortMappings, stringifyPortMappings, diff --git a/packages/dockerCompose/test/unit/setDappnodeComposeDefaults.test.ts b/packages/dockerCompose/test/unit/setDappnodeComposeDefaults.test.ts index db699d37c..e5fd15b24 100644 --- a/packages/dockerCompose/test/unit/setDappnodeComposeDefaults.test.ts +++ b/packages/dockerCompose/test/unit/setDappnodeComposeDefaults.test.ts @@ -1,6 +1,6 @@ import "mocha"; import { expect } from "chai"; -import { Compose, Manifest } from "@dappnode/common"; +import { Compose, Manifest } from "@dappnode/types"; import { validateDappnodeCompose } from "@dappnode/schemas"; import { setDappnodeComposeDefaults } from "../../src/index.js"; diff --git a/packages/dockerCompose/test/unit/specialPermissions.test.ts b/packages/dockerCompose/test/unit/specialPermissions.test.ts index 22a18388d..816a14fe8 100644 --- a/packages/dockerCompose/test/unit/specialPermissions.test.ts +++ b/packages/dockerCompose/test/unit/specialPermissions.test.ts @@ -3,7 +3,7 @@ import { expect } from "chai"; import { mapValues } from "lodash-es"; import { parseSpecialPermissions } from "../../src/index.js"; import { mockCompose } from "../testUtils.js"; -import { Compose } from "@dappnode/common"; +import { Compose } from "@dappnode/types"; describe("Modules > compose", () => { describe("parseSpecialPermissions", () => { diff --git a/packages/dockerCompose/test/unit/userSettings.test.ts b/packages/dockerCompose/test/unit/userSettings.test.ts index a4719c6b8..bb2884e25 100644 --- a/packages/dockerCompose/test/unit/userSettings.test.ts +++ b/packages/dockerCompose/test/unit/userSettings.test.ts @@ -1,7 +1,8 @@ import "mocha"; import { expect } from "chai"; import { pick } from "lodash-es"; -import { UserSettings, Compose, ComposeService } from "@dappnode/common"; +import { Compose, ComposeService } from "@dappnode/types"; +import { UserSettings } from "@dappnode/types"; import { parseUserSettings, applyUserSettings } from "../../src/index.js"; const bitcoinVolumeName = "bitcoin_data"; diff --git a/packages/dockerCompose/test/unit/validate.test.ts b/packages/dockerCompose/test/unit/validate.test.ts index ef2521002..047f05aca 100644 --- a/packages/dockerCompose/test/unit/validate.test.ts +++ b/packages/dockerCompose/test/unit/validate.test.ts @@ -1,7 +1,7 @@ import "mocha"; import { expect } from "chai"; import { mockCompose } from "../testUtils.js"; -import { Compose } from "@dappnode/common"; +import { Compose } from "@dappnode/types"; import { validateCompose } from "../../src/index.js"; describe("validateCompose", () => { @@ -11,7 +11,7 @@ describe("validateCompose", () => { }); it("Should reject an empty compose", () => { - expect(function() { + expect(function () { validateCompose({} as Compose); }).to.throw("Invalid compose"); }); diff --git a/packages/dockerCompose/test/unit/verify.test.ts b/packages/dockerCompose/test/unit/verify.test.ts index c797bd941..55c6b0e57 100644 --- a/packages/dockerCompose/test/unit/verify.test.ts +++ b/packages/dockerCompose/test/unit/verify.test.ts @@ -1,6 +1,6 @@ import "mocha"; import { expect } from "chai"; -import { Compose, ComposeService } from "@dappnode/common"; +import { Compose, ComposeService } from "@dappnode/types"; import { verifyCompose } from "../../src/index.js"; describe("verify compose", () => { diff --git a/packages/dockerCompose/test/unit/volumes.test.ts b/packages/dockerCompose/test/unit/volumes.test.ts index 83a398c32..6ca6cc43d 100644 --- a/packages/dockerCompose/test/unit/volumes.test.ts +++ b/packages/dockerCompose/test/unit/volumes.test.ts @@ -1,6 +1,6 @@ import "mocha"; import { expect } from "chai"; -import { VolumeMapping } from "@dappnode/common"; +import { VolumeMapping } from "@dappnode/types"; import { parseVolumeMappings, stringifyVolumeMappings, diff --git a/packages/eventBus/package.json b/packages/eventBus/package.json index ef7b12c56..180178183 100644 --- a/packages/eventBus/package.json +++ b/packages/eventBus/package.json @@ -18,8 +18,7 @@ "lint": "eslint . --ext .ts --fix src" }, "dependencies": { - "@dappnode/common": "^0.1.0", - "@dappnode/params": "^0.1.0", + "@dappnode/types": "^0.1.0", "lodash-es": "^4.17.21" }, "devDependencies": { diff --git a/packages/eventBus/src/eventBus.ts b/packages/eventBus/src/eventBus.ts index cf3d69ceb..4a8325ed8 100644 --- a/packages/eventBus/src/eventBus.ts +++ b/packages/eventBus/src/eventBus.ts @@ -8,7 +8,7 @@ import { PackageNotification, DirectoryItem, ExecutionClientMainnet, -} from "@dappnode/common"; +} from "@dappnode/types"; interface EventTypes { chainData: ChainData[]; diff --git a/packages/hostScriptsServices/package.json b/packages/hostScriptsServices/package.json index f1e293c95..99f2788aa 100644 --- a/packages/hostScriptsServices/package.json +++ b/packages/hostScriptsServices/package.json @@ -19,7 +19,7 @@ "lint": "eslint . --ext .ts --fix src" }, "dependencies": { - "@dappnode/common": "^0.1.0", + "@dappnode/types": "^0.1.0", "@dappnode/logger": "^0.1.0", "@dappnode/utils": "^0.1.0", "memoizee": "0.4.14" diff --git a/packages/hostScriptsServices/src/hostScripts/scripts/avahiDaemon.ts b/packages/hostScriptsServices/src/hostScripts/scripts/avahiDaemon.ts index 8f4621f74..9ce6f94a1 100644 --- a/packages/hostScriptsServices/src/hostScripts/scripts/avahiDaemon.ts +++ b/packages/hostScriptsServices/src/hostScripts/scripts/avahiDaemon.ts @@ -1,5 +1,5 @@ import memoize from "memoizee"; -import { AvahiDaemonStatus } from "@dappnode/common"; +import { AvahiDaemonStatus } from "@dappnode/types"; import { runScript } from "../runScripts.js"; /** @@ -35,7 +35,7 @@ export const getAvahiDaemonStatus = memoize( return { isAvahiRunning: status.isAvahiRunning === "true", isAvahiEnabled: status.isAvahiEnabled === "true", - avahiResolves: status.avahiResolves === "true" + avahiResolves: status.avahiResolves === "true", }; }, // Prevent running this script more than once diff --git a/packages/hostScriptsServices/src/hostScripts/scripts/hostInfo.ts b/packages/hostScriptsServices/src/hostScripts/scripts/hostInfo.ts index 0349701e7..a785354af 100644 --- a/packages/hostScriptsServices/src/hostScripts/scripts/hostInfo.ts +++ b/packages/hostScriptsServices/src/hostScripts/scripts/hostInfo.ts @@ -1,5 +1,5 @@ import memoize from "memoizee"; -import { HostInfoScript } from "@dappnode/common"; +import { HostInfoScript } from "@dappnode/types"; import { runScript } from "../runScripts.js"; /** @@ -28,7 +28,7 @@ export const getHostInfoMemoized = memoize( os: info.os.toLowerCase().trim(), versionCodename: info.versionCodename.toLowerCase().trim(), architecture: info.architecture.toLowerCase().trim(), - kernel: info.kernel.toLowerCase().trim() + kernel: info.kernel.toLowerCase().trim(), }; }, diff --git a/packages/hostScriptsServices/src/hostScripts/scripts/lvm.ts b/packages/hostScriptsServices/src/hostScripts/scripts/lvm.ts index e9413b1fb..34d9406dc 100644 --- a/packages/hostScriptsServices/src/hostScripts/scripts/lvm.ts +++ b/packages/hostScriptsServices/src/hostScripts/scripts/lvm.ts @@ -6,8 +6,8 @@ import { HostVolumeGroup, HostVolumeGroupReport, HostLogicalVolume, - HostLogicalVolumeReport -} from "@dappnode/common"; + HostLogicalVolumeReport, +} from "@dappnode/types"; /** * Returns host hard disks detected diff --git a/packages/hostScriptsServices/src/hostScripts/scripts/mountpoints.ts b/packages/hostScriptsServices/src/hostScripts/scripts/mountpoints.ts index 02a63f353..e46e0e48a 100644 --- a/packages/hostScriptsServices/src/hostScripts/scripts/mountpoints.ts +++ b/packages/hostScriptsServices/src/hostScripts/scripts/mountpoints.ts @@ -1,5 +1,5 @@ import memoize from "memoizee"; -import { MountpointData } from "@dappnode/common"; +import { MountpointData } from "@dappnode/types"; import { runScript } from "../runScripts.js"; /** @@ -49,7 +49,7 @@ export const detectMountpoints = memoize( total: parseInt(dataRaw.total), free: parseInt(dataRaw.free), vendor: dataRaw.vendor, - model: dataRaw.model + model: dataRaw.model, }) ); diff --git a/packages/hostScriptsServices/src/hostScripts/scripts/rebootRequired.ts b/packages/hostScriptsServices/src/hostScripts/scripts/rebootRequired.ts index fa07ac79f..4e0faa268 100644 --- a/packages/hostScriptsServices/src/hostScripts/scripts/rebootRequired.ts +++ b/packages/hostScriptsServices/src/hostScripts/scripts/rebootRequired.ts @@ -1,13 +1,13 @@ import memoize from "memoizee"; import { runScript } from "../runScripts.js"; -import { RebootRequiredScript } from "@dappnode/common"; +import { RebootRequiredScript } from "@dappnode/types"; /** * Checks weather or not the host machine needs to be rebooted * if it does, it returns the list of packages that need to be updated */ export const getRebootRequiredMemoized = memoize( - async function(): Promise { + async function (): Promise { const response = await runScript("reboot_required.sh"); const infoParsed = JSON.parse(response); return { diff --git a/packages/httpsPortal/package.json b/packages/httpsPortal/package.json index be765b06d..b39285c7e 100644 --- a/packages/httpsPortal/package.json +++ b/packages/httpsPortal/package.json @@ -19,7 +19,7 @@ "lint": "eslint . --ext .ts --fix src" }, "dependencies": { - "@dappnode/common": "^0.1.0", + "@dappnode/types": "^0.1.0", "@dappnode/dockerapi": "^0.1.0", "@dappnode/dockercompose": "^0.1.0", "@dappnode/logger": "^0.1.0", diff --git a/packages/httpsPortal/src/domains.ts b/packages/httpsPortal/src/domains.ts index c02cefd61..7cd412cd5 100644 --- a/packages/httpsPortal/src/domains.ts +++ b/packages/httpsPortal/src/domains.ts @@ -1,4 +1,4 @@ -import { ContainerNames } from "@dappnode/common"; +import { ContainerNames } from "@dappnode/types"; import { getShortUniqueDnp, getContainerDomain } from "@dappnode/utils"; export function stripBadDomainChars(s: string): string { diff --git a/packages/httpsPortal/src/exposable/index.ts b/packages/httpsPortal/src/exposable/index.ts index 7a7cfdc12..ca3324d36 100644 --- a/packages/httpsPortal/src/exposable/index.ts +++ b/packages/httpsPortal/src/exposable/index.ts @@ -1,5 +1,5 @@ import memoizee from "memoizee"; -import { ExposableServiceInfo, InstalledPackageData } from "@dappnode/common"; +import { ExposableServiceInfo, InstalledPackageData } from "@dappnode/types"; import { listPackages } from "@dappnode/dockerapi"; import { readManifestIfExists } from "@dappnode/utils"; import { exposablePredefined } from "./predefined.js"; diff --git a/packages/httpsPortal/src/exposable/parseExposable.ts b/packages/httpsPortal/src/exposable/parseExposable.ts index bc247b493..493935208 100644 --- a/packages/httpsPortal/src/exposable/parseExposable.ts +++ b/packages/httpsPortal/src/exposable/parseExposable.ts @@ -2,7 +2,7 @@ import { ExposableServiceInfo, ExposableServiceManifestInfo, InstalledPackageData, -} from "@dappnode/common"; +} from "@dappnode/types"; import { getPublicSubdomain, stripBadDomainChars } from "../domains.js"; /** diff --git a/packages/httpsPortal/src/exposable/predefined.ts b/packages/httpsPortal/src/exposable/predefined.ts index 779e83518..0dcbf40be 100644 --- a/packages/httpsPortal/src/exposable/predefined.ts +++ b/packages/httpsPortal/src/exposable/predefined.ts @@ -1,4 +1,4 @@ -import { ExposableServiceInfo } from "@dappnode/common"; +import { ExposableServiceInfo } from "@dappnode/types"; export const exposablePredefined: { [dnpName: string]: ExposableServiceInfo[]; @@ -10,7 +10,7 @@ export const exposablePredefined: { serviceName: "geth.dnp.dappnode.eth", port: 8545, name: "Geth JSON RPC", - description: "JSON RPC endpoint for Geth Ethereum mainnet" + description: "JSON RPC endpoint for Geth Ethereum mainnet", }, { fromSubdomain: "geth-ws", @@ -18,8 +18,8 @@ export const exposablePredefined: { serviceName: "geth.dnp.dappnode.eth", port: 8546, name: "Geth JSON RPC (WS)", - description: "WebSockets endpoint for Geth Ethereum mainnet" - } + description: "WebSockets endpoint for Geth Ethereum mainnet", + }, ], "goerli-geth.dnp.dappnode.eth": [ { @@ -28,7 +28,7 @@ export const exposablePredefined: { serviceName: "goerli-geth.dnp.dappnode.eth", port: 8545, name: "Goerli Geth JSON RPC", - description: "JSON RPC endpoint for Goerli Ethereum network" + description: "JSON RPC endpoint for Goerli Ethereum network", }, { fromSubdomain: "goerli-geth-ws", @@ -36,8 +36,8 @@ export const exposablePredefined: { serviceName: "goerli-geth.dnp.dappnode.eth", port: 8546, name: "Goerli Geth JSON RPC (WS)", - description: "WebSockets endpoint for Goerli Ethereum network" - } + description: "WebSockets endpoint for Goerli Ethereum network", + }, ], "kovan.dnp.dappnode.eth": [ { @@ -46,7 +46,7 @@ export const exposablePredefined: { serviceName: "kovan.dnp.dappnode.eth", port: 8545, name: "Kovan JSON RPC", - description: "JSON RPC endpoint for Kovan Ethereum network" + description: "JSON RPC endpoint for Kovan Ethereum network", }, { fromSubdomain: "kovan-ws", @@ -54,8 +54,8 @@ export const exposablePredefined: { serviceName: "kovan.dnp.dappnode.eth", port: 8546, name: "Kovan JSON RPC (WS)", - description: "WebSockets endpoint for Kovan Ethereum network" - } + description: "WebSockets endpoint for Kovan Ethereum network", + }, ], "nethermind.public.dappnode.eth": [ { @@ -64,7 +64,7 @@ export const exposablePredefined: { serviceName: "nethermind.public.dappnode.eth", port: 8545, name: "Nethermind JSON RPC", - description: "JSON RPC endpoint for Nethermind Ethereum mainnet" + description: "JSON RPC endpoint for Nethermind Ethereum mainnet", }, { fromSubdomain: "nethermind-ws", @@ -72,8 +72,8 @@ export const exposablePredefined: { serviceName: "nethermind.public.dappnode.eth", port: 8546, name: "Nethermind JSON RPC (WS)", - description: "WebSockets endpoint for Nethermind Ethereum mainnet" - } + description: "WebSockets endpoint for Nethermind Ethereum mainnet", + }, ], "rinkeby.dnp.dappnode.eth": [ { @@ -82,7 +82,7 @@ export const exposablePredefined: { serviceName: "rinkeby.dnp.dappnode.eth", port: 8545, name: "Rinkeby JSON RPC", - description: "JSON RPC endpoint for Rinkeby Ethereum network" + description: "JSON RPC endpoint for Rinkeby Ethereum network", }, { fromSubdomain: "rinkeby-ws", @@ -90,8 +90,8 @@ export const exposablePredefined: { serviceName: "rinkeby.dnp.dappnode.eth", port: 8546, name: "Rinkeby JSON RPC (WS)", - description: "WebSockets endpoint for Rinkeby Ethereum network" - } + description: "WebSockets endpoint for Rinkeby Ethereum network", + }, ], "ropsten.dnp.dappnode.eth": [ { @@ -100,7 +100,7 @@ export const exposablePredefined: { serviceName: "ropsten.dnp.dappnode.eth", port: 8545, name: "Ropsten JSON RPC", - description: "JSON RPC endpoint for Ropsten Ethereum network" + description: "JSON RPC endpoint for Ropsten Ethereum network", }, { fromSubdomain: "ropsten-ws", @@ -108,8 +108,8 @@ export const exposablePredefined: { serviceName: "ropsten.dnp.dappnode.eth", port: 8546, name: "Ropsten JSON RPC (WS)", - description: "WebSockets endpoint for Ropsten Ethereum network" - } + description: "WebSockets endpoint for Ropsten Ethereum network", + }, ], "avalanche.public.dappnode.eth": [ { @@ -118,8 +118,8 @@ export const exposablePredefined: { serviceName: "wallet", port: 80, name: "Avalanche wallet", - description: "Avalanche wallet UI" - } + description: "Avalanche wallet UI", + }, ], "bee.dnp.dappnode.eth": [ { @@ -128,8 +128,8 @@ export const exposablePredefined: { serviceName: "bee.dnp.dappnode.eth", port: 1633, name: "Bee JSON RPC", - description: "JSON RPC endpoint for Bee" - } + description: "JSON RPC endpoint for Bee", + }, ], "bitcoin.dnp.dappnode.eth": [ { @@ -138,8 +138,8 @@ export const exposablePredefined: { serviceName: "bitcoin.dnp.dappnode.eth", port: 8332, name: "Bitcoin JSON RPC", - description: "JSON RPC endpoint for Bitcoin" - } + description: "JSON RPC endpoint for Bitcoin", + }, ], "monero.dnp.dappnode.eth": [ { @@ -148,8 +148,8 @@ export const exposablePredefined: { serviceName: "monero.dnp.dappnode.eth", port: 18081, name: "Monero JSON RPC", - description: "JSON RPC endpoint for Monero" - } + description: "JSON RPC endpoint for Monero", + }, ], "zcash.public.dappnode.eth": [ { @@ -158,8 +158,8 @@ export const exposablePredefined: { serviceName: "zcash.public.dappnode.eth", port: 8232, name: "Zcash JSON RPC", - description: "JSON RPC endpoint for Zcash" - } + description: "JSON RPC endpoint for Zcash", + }, ], "owncloud.dnp.dappnode.eth": [ { @@ -168,8 +168,8 @@ export const exposablePredefined: { serviceName: "owncloud", port: 80, name: "Owncloud UI", - description: "Owncloud UI" - } + description: "Owncloud UI", + }, ], "trustlines.dnp.dappnode.eth": [ { @@ -178,7 +178,7 @@ export const exposablePredefined: { serviceName: "node", port: 8545, name: "Truslines JSON RPC", - description: "JSON RPC endpoint for Truslines network" + description: "JSON RPC endpoint for Truslines network", }, { fromSubdomain: "trustlines-ws", @@ -186,8 +186,8 @@ export const exposablePredefined: { serviceName: "node", port: 8546, name: "Truslines JSON RPC (WS)", - description: "WebSockets endpoint for Truslines network" - } + description: "WebSockets endpoint for Truslines network", + }, ], "turbo-geth.dnp.dappnode.eth": [ { @@ -196,7 +196,7 @@ export const exposablePredefined: { serviceName: "rpcdaemon", port: 8545, name: "Turbo-Geth JSON RPC", - description: "JSON RPC endpoint for Turbo-Geth Ethereum mainnet" + description: "JSON RPC endpoint for Turbo-Geth Ethereum mainnet", }, { fromSubdomain: "turbo-geth-ws", @@ -204,7 +204,7 @@ export const exposablePredefined: { serviceName: "rpcdaemon", port: 8546, name: "Turbo-Geth JSON RPC (WS)", - description: "WebSockets endpoint for Turbo-Geth Ethereum mainnet" - } - ] + description: "WebSockets endpoint for Turbo-Geth Ethereum mainnet", + }, + ], }; diff --git a/packages/httpsPortal/src/httpsPortal.ts b/packages/httpsPortal/src/httpsPortal.ts index 5772377a9..63c10c0fb 100644 --- a/packages/httpsPortal/src/httpsPortal.ts +++ b/packages/httpsPortal/src/httpsPortal.ts @@ -7,7 +7,7 @@ import { import { listPackageContainers } from "@dappnode/dockerapi"; import { params } from "@dappnode/params"; import { getExternalNetworkAlias } from "./domains.js"; -import { PackageContainer, HttpsPortalMapping } from "@dappnode/common"; +import { PackageContainer, HttpsPortalMapping } from "@dappnode/types"; import { HttpsPortalApiClient } from "./apiClient.js"; import { ComposeEditor } from "@dappnode/dockercompose"; import { addNetworkAliasCompose } from "./utils/addNetworkAliasCompose.js"; diff --git a/packages/httpsPortal/src/utils/addNetworkAliasCompose.ts b/packages/httpsPortal/src/utils/addNetworkAliasCompose.ts index 094d1fddd..c7b10eae9 100644 --- a/packages/httpsPortal/src/utils/addNetworkAliasCompose.ts +++ b/packages/httpsPortal/src/utils/addNetworkAliasCompose.ts @@ -1,4 +1,4 @@ -import { PackageContainer } from "@dappnode/common"; +import { PackageContainer } from "@dappnode/types"; import { ComposeFileEditor } from "@dappnode/dockercompose"; export function addNetworkAliasCompose( diff --git a/packages/httpsPortal/src/utils/connectToPublicNetwork.ts b/packages/httpsPortal/src/utils/connectToPublicNetwork.ts index 62e4e10ec..5c6f42d6f 100644 --- a/packages/httpsPortal/src/utils/connectToPublicNetwork.ts +++ b/packages/httpsPortal/src/utils/connectToPublicNetwork.ts @@ -1,5 +1,5 @@ import { httpsPortal } from "../index.js"; -import { InstallPackageData } from "@dappnode/common"; +import { InstallPackageData } from "@dappnode/types"; import { getExternalNetworkAlias } from "../domains.js"; import { params } from "@dappnode/params"; import { diff --git a/packages/httpsPortal/src/utils/exposeByDefaultHttpsPorts.ts b/packages/httpsPortal/src/utils/exposeByDefaultHttpsPorts.ts index 1c1dc4ff0..158a3bb79 100644 --- a/packages/httpsPortal/src/utils/exposeByDefaultHttpsPorts.ts +++ b/packages/httpsPortal/src/utils/exposeByDefaultHttpsPorts.ts @@ -1,6 +1,6 @@ import { Log } from "@dappnode/logger"; import { httpsPortal } from "../index.js"; -import { InstallPackageData, HttpsPortalMapping } from "@dappnode/common"; +import { InstallPackageData, HttpsPortalMapping } from "@dappnode/types"; import { prettyDnpName } from "@dappnode/utils"; import { isRunningHttps } from "./isRunningHttps.js"; diff --git a/packages/httpsPortal/src/utils/removeNetworkAliasCompose.ts b/packages/httpsPortal/src/utils/removeNetworkAliasCompose.ts index 4dc503c22..2b3ceecb9 100644 --- a/packages/httpsPortal/src/utils/removeNetworkAliasCompose.ts +++ b/packages/httpsPortal/src/utils/removeNetworkAliasCompose.ts @@ -1,4 +1,4 @@ -import { PackageContainer } from "@dappnode/common"; +import { PackageContainer } from "@dappnode/types"; import { ComposeFileEditor } from "@dappnode/dockercompose"; export function removeNetworkAliasCompose( diff --git a/packages/httpsPortal/test/testUtils.ts b/packages/httpsPortal/test/testUtils.ts index b6a137b19..0be57abe0 100644 --- a/packages/httpsPortal/test/testUtils.ts +++ b/packages/httpsPortal/test/testUtils.ts @@ -1,4 +1,4 @@ -import { InstalledPackageData, PackageContainer } from "@dappnode/common"; +import { InstalledPackageData, PackageContainer } from "@dappnode/types"; export const mockDnpName = "mock-dnp.dnp.dappnode.eth"; export const mockDnpVersion = "0.0.0"; diff --git a/packages/httpsPortal/test/unit/exposable.test.ts b/packages/httpsPortal/test/unit/exposable.test.ts index 99f16039c..b63d002d0 100644 --- a/packages/httpsPortal/test/unit/exposable.test.ts +++ b/packages/httpsPortal/test/unit/exposable.test.ts @@ -4,14 +4,14 @@ import { ExposableServiceInfo, ExposableServiceManifestInfo, InstalledPackageData, -} from "@dappnode/common"; +} from "@dappnode/types"; import { mockDnp, mockContainer } from "../testUtils.js"; describe("modules / https-portal / exposable", () => { it("Should parse manifest.exposable", () => { const manifestExposable: ExposableServiceManifestInfo[] = [ { name: "name1", port: 1111 }, - ({ broken: true } as unknown) as ExposableServiceManifestInfo, + { broken: true } as unknown as ExposableServiceManifestInfo, { name: "name3", description: "desc3", serviceName: "serv3", port: 3333 }, ]; diff --git a/packages/installer/package.json b/packages/installer/package.json index 0286b5e3e..d90868877 100644 --- a/packages/installer/package.json +++ b/packages/installer/package.json @@ -19,7 +19,7 @@ "lint": "eslint . --ext .ts --fix src" }, "dependencies": { - "@dappnode/common": "^0.1.0", + "@dappnode/types": "^0.1.0", "@dappnode/db": "^0.1.0", "@dappnode/dockerapi": "^0.1.0", "@dappnode/dockercompose": "^0.1.0", diff --git a/packages/installer/src/calls/packageGet.ts b/packages/installer/src/calls/packageGet.ts index 596fb35c9..742b94fca 100644 --- a/packages/installer/src/calls/packageGet.ts +++ b/packages/installer/src/calls/packageGet.ts @@ -1,7 +1,7 @@ import { omit } from "lodash-es"; import { shouldUpdate, readManifestIfExists } from "@dappnode/utils"; import * as db from "@dappnode/db"; -import { InstalledPackageDetailData } from "@dappnode/common"; +import { InstalledPackageDetailData } from "@dappnode/types"; import { logs } from "@dappnode/logger"; import { ComposeFileEditor } from "@dappnode/dockercompose"; import { getVolumesOwnershipData, listPackages } from "@dappnode/dockerapi"; diff --git a/packages/installer/src/calls/packageGetData.ts b/packages/installer/src/calls/packageGetData.ts index 8a978588b..771b5a65d 100644 --- a/packages/installer/src/calls/packageGetData.ts +++ b/packages/installer/src/calls/packageGetData.ts @@ -1,4 +1,5 @@ -import { PackageItemData, PackageRelease, Manifest } from "@dappnode/common"; +import { PackageItemData, PackageRelease } from "@dappnode/types"; +import { Manifest } from "@dappnode/types"; import * as db from "@dappnode/db"; import { pick } from "lodash-es"; import { eventBus } from "@dappnode/eventbus"; @@ -24,7 +25,9 @@ export async function packageGetData( } } -export function packagePickItemData(pkgRelease: PackageRelease): PackageItemData { +export function packagePickItemData( + pkgRelease: PackageRelease +): PackageItemData { return { manifest: packagePickManifestData(pkgRelease.manifest), ...pick(pkgRelease, [ diff --git a/packages/installer/src/calls/packageInstall.ts b/packages/installer/src/calls/packageInstall.ts index 67cf5adbe..b22487030 100644 --- a/packages/installer/src/calls/packageInstall.ts +++ b/packages/installer/src/calls/packageInstall.ts @@ -13,7 +13,8 @@ import { afterInstall, } from "../installer/index.js"; import { logs, getLogUi, logUiClear } from "@dappnode/logger"; -import { Routes, PackageRequest } from "@dappnode/common"; +import { Routes } from "@dappnode/types"; +import { PackageRequest } from "@dappnode/types"; import { DappnodeInstaller } from "../dappnodeInstaller.js"; /** diff --git a/packages/installer/src/calls/packageRemove.ts b/packages/installer/src/calls/packageRemove.ts index 872366e0e..faa547ff1 100644 --- a/packages/installer/src/calls/packageRemove.ts +++ b/packages/installer/src/calls/packageRemove.ts @@ -8,12 +8,12 @@ import { dockerContainerRemove, dockerContainerStop, dockerComposeDown, - listPackage + listPackage, } from "@dappnode/dockerapi"; import { isRunningHttps } from "@dappnode/httpsportal"; import { httpsPortal } from "@dappnode/httpsportal"; import * as db from "@dappnode/db"; -import { mevBoostMainnet, mevBoostPrater, stakerPkgs } from "@dappnode/common"; +import { mevBoostMainnet, mevBoostPrater, stakerPkgs } from "@dappnode/types"; import { ethicalMetricsDnpName, unregister } from "@dappnode/ethicalmetrics"; /** @@ -24,7 +24,7 @@ import { ethicalMetricsDnpName, unregister } from "@dappnode/ethicalmetrics"; */ export async function packageRemove({ dnpName, - deleteVolumes = false + deleteVolumes = false, }: { dnpName: string; deleteVolumes?: boolean; @@ -51,7 +51,7 @@ export async function packageRemove({ await httpsPortal .removeMapping(mapping) // Bypass error to continue deleting mappings - .catch(e => + .catch((e) => logs.error(`Error removing https mapping of ${dnp.dnpName}`, e) ); } @@ -89,7 +89,7 @@ export async function packageRemove({ await dockerComposeDown(composePath, { volumes: deleteVolumes, // Ignore timeout is user doesn't want to keep any data - timeout: deleteVolumes ? undefined : timeout + timeout: deleteVolumes ? undefined : timeout, }); hasRemoved = true; // To mimic an early return } catch (e) { @@ -98,11 +98,11 @@ export async function packageRemove({ } if (!hasRemoved) { - const containerNames = dnp.containers.map(c => c.containerName); + const containerNames = dnp.containers.map((c) => c.containerName); await Promise.all( - containerNames.map(async containerName => { + containerNames.map(async (containerName) => { // Continue removing package even if container is already stopped - await dockerContainerStop(containerName, { timeout }).catch(e => { + await dockerContainerStop(containerName, { timeout }).catch((e) => { if ( e.reason.includes("container already stopped") && e.statusCode === 304 @@ -119,7 +119,7 @@ export async function packageRemove({ if (fs.existsSync(packageRepoDir)) await shell(`rm -r ${packageRepoDir}`); // Remove client from maindb.json if it is a staker package - if (stakerPkgs.some(stakerPkg => stakerPkg === dnp.dnpName)) + if (stakerPkgs.some((stakerPkg) => stakerPkg === dnp.dnpName)) await removeStakerPkgFromDbIfSelected({ dnpName }); // Emit packages update @@ -132,7 +132,7 @@ export async function packageRemove({ * @param dnpName DNP of the removed package */ async function removeStakerPkgFromDbIfSelected({ - dnpName + dnpName, }: { dnpName: string; }): Promise { diff --git a/packages/installer/src/calls/packageSetEnvironment.ts b/packages/installer/src/calls/packageSetEnvironment.ts index 3d5dbe845..5452a1c4c 100644 --- a/packages/installer/src/calls/packageSetEnvironment.ts +++ b/packages/installer/src/calls/packageSetEnvironment.ts @@ -6,7 +6,7 @@ import { listPackage, } from "@dappnode/dockerapi"; import { packageInstalledHasPid, getDockerComposePath } from "@dappnode/utils"; -import { PackageEnvs } from "@dappnode/common"; +import { PackageEnvs } from "@dappnode/types"; import { params } from "@dappnode/params"; import { restartDappmanagerPatch } from "../installer/index.js"; diff --git a/packages/installer/src/calls/packagesGet.ts b/packages/installer/src/calls/packagesGet.ts index 7e383566f..c21af6898 100644 --- a/packages/installer/src/calls/packagesGet.ts +++ b/packages/installer/src/calls/packagesGet.ts @@ -4,8 +4,8 @@ import { listPackages } from "@dappnode/dockerapi"; import { InstalledPackageData, InstalledPackageDataApiReturn, - UpdateAvailable -} from "@dappnode/common"; + UpdateAvailable, +} from "@dappnode/types"; /** * Returns the list of current containers associated to packages @@ -16,7 +16,7 @@ export async function packagesGet(): Promise { // Check if an update is available from stored last known version const latestKnownVersions = db.packageLatestKnownVersion.getAll(); - return dnps.map(dnp => { + return dnps.map((dnp) => { const latestKnownVersion: UpdateAvailable | undefined = latestKnownVersions[dnp.dnpName]; return { @@ -25,7 +25,7 @@ export async function packagesGet(): Promise { latestKnownVersion && shouldUpdate(dnp.version, latestKnownVersion.newVersion) ? latestKnownVersion - : null + : null, }; }); } diff --git a/packages/installer/src/dappGet/aggregate/getRelevantInstalledDnps.ts b/packages/installer/src/dappGet/aggregate/getRelevantInstalledDnps.ts index 9fcea8d9b..516f6ad97 100644 --- a/packages/installer/src/dappGet/aggregate/getRelevantInstalledDnps.ts +++ b/packages/installer/src/dappGet/aggregate/getRelevantInstalledDnps.ts @@ -1,5 +1,5 @@ import { intersection } from "lodash-es"; -import { InstalledPackageData } from "@dappnode/common"; +import { InstalledPackageData } from "@dappnode/types"; /** * @param requestedDnps = [ @@ -21,7 +21,7 @@ import { InstalledPackageData } from "@dappnode/common"; export default function getRelevantInstalledDnps({ requestedDnps, - installedDnps + installedDnps, }: { requestedDnps: string[]; installedDnps: InstalledPackageData[]; @@ -32,16 +32,16 @@ export default function getRelevantInstalledDnps({ const state: { [dnpName: string]: InstalledPackageData } = {}; const intersectedDnps = intersection( requestedDnps, - installedDnps.map(dnp => dnp.dnpName) + installedDnps.map((dnp) => dnp.dnpName) ); - const installedDnpsWithDeps = installedDnps.filter(dnp => dnp.dependencies); + const installedDnpsWithDeps = installedDnps.filter((dnp) => dnp.dependencies); for (const dnpName of intersectedDnps) { - const dnp = installedDnps.find(dnp => dnp.dnpName === dnpName); + const dnp = installedDnps.find((dnp) => dnp.dnpName === dnpName); if (dnp) addDependants(dnp); } // Return only packages that are not already included in the requestedDnps array return Object.values(state).filter( - dnp => !requestedDnps.includes(dnp.dnpName) + (dnp) => !requestedDnps.includes(dnp.dnpName) ); function addDependants(dnp: InstalledPackageData): void { diff --git a/packages/installer/src/dappGet/aggregate/index.ts b/packages/installer/src/dappGet/aggregate/index.ts index 5b20a4699..0e113524a 100644 --- a/packages/installer/src/dappGet/aggregate/index.ts +++ b/packages/installer/src/dappGet/aggregate/index.ts @@ -13,7 +13,7 @@ import { ErrorDappGetNotSatisfyRange, ErrorDappGetNoVersions, } from "../errors.js"; -import { InstalledPackageData, PackageRequest } from "@dappnode/common"; +import { InstalledPackageData, PackageRequest } from "@dappnode/types"; import { DappnodeInstaller } from "../../dappnodeInstaller.js"; /** diff --git a/packages/installer/src/dappGet/basic.ts b/packages/installer/src/dappGet/basic.ts index 7f22ccb1b..f1e70c28d 100644 --- a/packages/installer/src/dappGet/basic.ts +++ b/packages/installer/src/dappGet/basic.ts @@ -1,7 +1,7 @@ import { listPackages } from "@dappnode/dockerapi"; import { shouldUpdate } from "@dappnode/utils"; // Internal -import { PackageRequest } from "@dappnode/common"; +import { PackageRequest } from "@dappnode/types"; import { logs } from "@dappnode/logger"; import { DappGetResult, DappGetState } from "./types.js"; import { DappGetFetcher } from "./fetch/index.js"; diff --git a/packages/installer/src/dappGet/dappGet.ts b/packages/installer/src/dappGet/dappGet.ts index f21b180c5..9583a92b2 100644 --- a/packages/installer/src/dappGet/dappGet.ts +++ b/packages/installer/src/dappGet/dappGet.ts @@ -1,5 +1,5 @@ import { listPackages } from "@dappnode/dockerapi"; -import { PackageRequest } from "@dappnode/common"; +import { PackageRequest } from "@dappnode/types"; import dappGetBasic from "./basic.js"; import aggregate from "./aggregate/index.js"; import { DappGetFetcher } from "./fetch/index.js"; diff --git a/packages/installer/src/dappGet/errors.ts b/packages/installer/src/dappGet/errors.ts index e2d83ebf8..28a559fa3 100644 --- a/packages/installer/src/dappGet/errors.ts +++ b/packages/installer/src/dappGet/errors.ts @@ -1,4 +1,4 @@ -import { PackageRequest } from "@dappnode/common"; +import { PackageRequest } from "@dappnode/types"; export class DappGetError extends Error {} diff --git a/packages/installer/src/dappGet/fetch/DappGetFetcher.ts b/packages/installer/src/dappGet/fetch/DappGetFetcher.ts index f1f4b2ff7..a0da01e75 100644 --- a/packages/installer/src/dappGet/fetch/DappGetFetcher.ts +++ b/packages/installer/src/dappGet/fetch/DappGetFetcher.ts @@ -1,4 +1,4 @@ -import { Dependencies } from "@dappnode/common"; +import { Dependencies } from "@dappnode/types"; import { validRange, satisfies, valid } from "semver"; import { DappnodeInstaller } from "../../dappnodeInstaller.js"; diff --git a/packages/installer/src/dappGet/utils/dnpUtils.ts b/packages/installer/src/dappGet/utils/dnpUtils.ts index 8b52cdfe1..0bca985b8 100644 --- a/packages/installer/src/dappGet/utils/dnpUtils.ts +++ b/packages/installer/src/dappGet/utils/dnpUtils.ts @@ -1,4 +1,4 @@ -import { Dependencies } from "@dappnode/common"; +import { Dependencies } from "@dappnode/types"; import { DappGetDnps, DappGetDnp } from "../types.js"; import { sanitizeDependencies } from "./sanitizeDependencies.js"; @@ -38,9 +38,7 @@ export function setVersion( dnps[name].versions[version] = sanitizeDependencies(dependencies); } -export function getVersionsFromDnp( - dnp: DappGetDnp -): { +export function getVersionsFromDnp(dnp: DappGetDnp): { [version: string]: { [dependencyName: string]: string; }; diff --git a/packages/installer/src/dappGet/utils/sanitizeDependencies.ts b/packages/installer/src/dappGet/utils/sanitizeDependencies.ts index 2a2a9d378..2cffb5800 100644 --- a/packages/installer/src/dappGet/utils/sanitizeDependencies.ts +++ b/packages/installer/src/dappGet/utils/sanitizeDependencies.ts @@ -1,4 +1,4 @@ -import { Dependencies } from "@dappnode/common"; +import { Dependencies } from "@dappnode/types"; import { mapValues } from "lodash-es"; /** diff --git a/packages/installer/src/dappnodeInstaller.ts b/packages/installer/src/dappnodeInstaller.ts index 96a69ff86..676e176d8 100644 --- a/packages/installer/src/dappnodeInstaller.ts +++ b/packages/installer/src/dappnodeInstaller.ts @@ -2,19 +2,20 @@ import { params } from "@dappnode/params"; import { DappnodeRepository } from "@dappnode/toolkit"; import * as db from "@dappnode/db"; import { - Compose, - DappGetState, DistributedFile, - GrafanaDashboard, IpfsClientTarget, + PackageRelease, + ManifestWithImage, +} from "@dappnode/types"; +import { + Compose, Manifest, PackageRequest, SetupWizard, + GrafanaDashboard, PrometheusTarget, - PackageRelease, - ManifestWithImage, -} from "@dappnode/common"; -import { DappgetOptions, dappGet } from "./dappGet/index.js"; +} from "@dappnode/types"; +import { DappGetState, DappgetOptions, dappGet } from "./dappGet/index.js"; import { validateDappnodeCompose, validateManifestSchema, diff --git a/packages/installer/src/ethClient/clientStatus.ts b/packages/installer/src/ethClient/clientStatus.ts index dd1e038e0..a9f9d7dbf 100644 --- a/packages/installer/src/ethClient/clientStatus.ts +++ b/packages/installer/src/ethClient/clientStatus.ts @@ -6,7 +6,7 @@ import { ConsensusClientMainnet, executionClientsMainnet, consensusClientsMainnet, -} from "@dappnode/common"; +} from "@dappnode/types"; import { listPackageNoThrow } from "@dappnode/dockerapi"; import { serializeError } from "./types.js"; import { getEthExecClientApiUrl, getEthConsClientApiUrl } from "./apiUrl.js"; diff --git a/packages/installer/src/ethClient/ethereumClient.ts b/packages/installer/src/ethClient/ethereumClient.ts index 7d7e19794..d4e9cfe0d 100644 --- a/packages/installer/src/ethClient/ethereumClient.ts +++ b/packages/installer/src/ethClient/ethereumClient.ts @@ -4,7 +4,7 @@ import { EthClientRemote, ExecutionClient, InstalledPackageDetailData, -} from "@dappnode/common"; +} from "@dappnode/types"; import * as db from "@dappnode/db"; import { eventBus } from "@dappnode/eventbus"; import { logs } from "@dappnode/logger"; @@ -25,7 +25,7 @@ import { ExecutionClientMainnet, ConsensusClientMainnet, Network, -} from "@dappnode/common"; +} from "@dappnode/types"; import { DappnodeInstaller } from "../dappnodeInstaller.js"; export enum ComposeAliasEditorAction { diff --git a/packages/installer/src/ethClient/ethersProvider.ts b/packages/installer/src/ethClient/ethersProvider.ts index a0cf3918d..7e7f364d0 100644 --- a/packages/installer/src/ethClient/ethersProvider.ts +++ b/packages/installer/src/ethClient/ethersProvider.ts @@ -2,7 +2,7 @@ import { ethers } from "ethers"; import * as db from "@dappnode/db"; import { params } from "@dappnode/params"; import { getMultiClientStatus } from "./clientStatus.js"; -import { EthClientStatusError, EthProviderError } from "@dappnode/common"; +import { EthClientStatusError, EthProviderError } from "@dappnode/types"; import { emitSyncedNotification } from "./syncedNotification.js"; import { ethereumClient } from "./index.js"; diff --git a/packages/installer/src/ethClient/syncedNotification.ts b/packages/installer/src/ethClient/syncedNotification.ts index 0e8ae4b86..498999de4 100644 --- a/packages/installer/src/ethClient/syncedNotification.ts +++ b/packages/installer/src/ethClient/syncedNotification.ts @@ -1,6 +1,6 @@ import * as db from "@dappnode/db"; import { eventBus } from "@dappnode/eventbus"; -import { Eth2ClientTarget, EthClientStatus } from "@dappnode/common"; +import { Eth2ClientTarget, EthClientStatus } from "@dappnode/types"; /** * Send a notification when going from syncing to synced only once per target @@ -20,7 +20,7 @@ export function emitSyncedNotification( // None -> AwaitingSynced db.ethClientSyncedNotificationStatus.set({ execClientTarget: target.execClient, - status: "AwaitingSynced" + status: "AwaitingSynced", }); } else if ( status.ok && @@ -31,13 +31,13 @@ export function emitSyncedNotification( // AwaitingSynced -> Synced db.ethClientSyncedNotificationStatus.set({ execClientTarget: target.execClient, - status: "Synced" + status: "Synced", }); eventBus.notification.emit({ id: `eth-client-synced-${target}`, type: "success", title: "Ethereum node synced", - body: `Your DAppNode's Ethereum node ${target} is synced.` + body: `Your DAppNode's Ethereum node ${target} is synced.`, }); } } diff --git a/packages/installer/src/ethClient/types.ts b/packages/installer/src/ethClient/types.ts index e10e64ee2..53b242215 100644 --- a/packages/installer/src/ethClient/types.ts +++ b/packages/installer/src/ethClient/types.ts @@ -1,4 +1,4 @@ -import { ErrorSerialized } from "@dappnode/common"; +import { ErrorSerialized } from "@dappnode/types"; /** * Serialize errors so the can be persisted in the db, a JSON to disk @@ -6,5 +6,5 @@ import { ErrorSerialized } from "@dappnode/common"; */ export const serializeError = (e: Error): ErrorSerialized => ({ message: e.message, - stack: e.stack + stack: e.stack, }); diff --git a/packages/installer/src/ethClient/utils.ts b/packages/installer/src/ethClient/utils.ts index 63e44a862..29f29b871 100644 --- a/packages/installer/src/ethClient/utils.ts +++ b/packages/installer/src/ethClient/utils.ts @@ -3,7 +3,7 @@ import { executionClientsMainnet, ConsensusClientMainnet, consensusClientsMainnet, -} from "@dappnode/common"; +} from "@dappnode/types"; export const isExecClient = ( client: string diff --git a/packages/installer/src/installer/createVolumeDevicePaths.ts b/packages/installer/src/installer/createVolumeDevicePaths.ts index 94afc8900..02b160ee6 100644 --- a/packages/installer/src/installer/createVolumeDevicePaths.ts +++ b/packages/installer/src/installer/createVolumeDevicePaths.ts @@ -1,5 +1,5 @@ import path from "path"; -import { Compose } from "@dappnode/common"; +import { Compose } from "@dappnode/types"; import { logs } from "@dappnode/logger"; import { uniq } from "lodash-es"; import { shellHost } from "@dappnode/utils"; diff --git a/packages/installer/src/installer/downloadImages.ts b/packages/installer/src/installer/downloadImages.ts index a36c48fb7..5f2b94686 100644 --- a/packages/installer/src/installer/downloadImages.ts +++ b/packages/installer/src/installer/downloadImages.ts @@ -1,6 +1,6 @@ import fs from "fs"; import { isAbsolute } from "path"; -import { InstallPackageData, DistributedFile } from "@dappnode/common"; +import { InstallPackageData, DistributedFile } from "@dappnode/types"; import { Log, logs } from "@dappnode/logger"; import { shell, validatePath, getImageTag } from "@dappnode/utils"; import { getDockerImageManifest } from "@dappnode/dockerapi"; diff --git a/packages/installer/src/installer/getInstallerPackageData.ts b/packages/installer/src/installer/getInstallerPackageData.ts index 9cca46b95..99b73dada 100644 --- a/packages/installer/src/installer/getInstallerPackageData.ts +++ b/packages/installer/src/installer/getInstallerPackageData.ts @@ -9,7 +9,7 @@ import { PackageRelease, InstallPackageData, ContainersStatus, -} from "@dappnode/common"; +} from "@dappnode/types"; import { getBackupPath, getDockerComposePath, diff --git a/packages/installer/src/installer/loadImages.ts b/packages/installer/src/installer/loadImages.ts index 3c119dfc3..491b60a46 100644 --- a/packages/installer/src/installer/loadImages.ts +++ b/packages/installer/src/installer/loadImages.ts @@ -1,4 +1,4 @@ -import { InstallPackageData } from "@dappnode/common"; +import { InstallPackageData } from "@dappnode/types"; import { Log } from "@dappnode/logger"; import { loadImage, getDockerImageManifest } from "@dappnode/dockerapi"; diff --git a/packages/installer/src/installer/orderInstallPackages.ts b/packages/installer/src/installer/orderInstallPackages.ts index 005e073b4..d499d8971 100644 --- a/packages/installer/src/installer/orderInstallPackages.ts +++ b/packages/installer/src/installer/orderInstallPackages.ts @@ -1,5 +1,5 @@ import { params } from "@dappnode/params"; -import { InstallPackageData } from "@dappnode/common"; +import { InstallPackageData } from "@dappnode/types"; const dappmanager = params.dappmanagerDnpName; diff --git a/packages/installer/src/installer/postInstallClean.ts b/packages/installer/src/installer/postInstallClean.ts index 7c87281d5..cc2a4a103 100644 --- a/packages/installer/src/installer/postInstallClean.ts +++ b/packages/installer/src/installer/postInstallClean.ts @@ -1,7 +1,7 @@ import fs from "fs"; import path from "path"; import * as db from "@dappnode/db"; -import { InstallPackageDataPaths } from "@dappnode/common"; +import { InstallPackageDataPaths } from "@dappnode/types"; import { Log } from "@dappnode/logger"; import { logs } from "@dappnode/logger"; import { isNotFoundError } from "@dappnode/utils"; diff --git a/packages/installer/src/installer/restartPatch.ts b/packages/installer/src/installer/restartPatch.ts index 4e80bbe08..e675e9dc9 100644 --- a/packages/installer/src/installer/restartPatch.ts +++ b/packages/installer/src/installer/restartPatch.ts @@ -21,7 +21,7 @@ import { postInstallClean } from "./postInstallClean.js"; import { afterInstall } from "./afterInstall.js"; import { flagPackagesAreInstalling } from "./packageIsInstalling.js"; import { ComposeEditor } from "@dappnode/dockercompose"; -import { InstallPackageData, InstallPackageDataPaths } from "@dappnode/common"; +import { InstallPackageData, InstallPackageDataPaths } from "@dappnode/types"; const restartId = params.restartDnpName; const dappmanagerName = params.dappmanagerDnpName; diff --git a/packages/installer/src/installer/rollbackPackages.ts b/packages/installer/src/installer/rollbackPackages.ts index 03afc8311..da2bee5f5 100644 --- a/packages/installer/src/installer/rollbackPackages.ts +++ b/packages/installer/src/installer/rollbackPackages.ts @@ -1,7 +1,7 @@ import fs from "fs"; import { params } from "@dappnode/params"; import { Log } from "@dappnode/logger"; -import { InstallPackageDataPaths } from "@dappnode/common"; +import { InstallPackageDataPaths } from "@dappnode/types"; import { logs } from "@dappnode/logger"; import { isNotFoundError } from "@dappnode/utils"; import { dockerComposeRm, dockerComposeUpPackage } from "@dappnode/dockerapi"; diff --git a/packages/installer/src/installer/runPackages.ts b/packages/installer/src/installer/runPackages.ts index a3d3ca6f1..35dc997c2 100644 --- a/packages/installer/src/installer/runPackages.ts +++ b/packages/installer/src/installer/runPackages.ts @@ -2,7 +2,7 @@ import path from "path"; import { params } from "@dappnode/params"; import { restartDappmanagerPatch } from "./restartPatch.js"; import { Log } from "@dappnode/logger"; -import { InstallPackageData } from "@dappnode/common"; +import { InstallPackageData } from "@dappnode/types"; import { logs } from "@dappnode/logger"; import { dockerComposeUpPackage, diff --git a/packages/installer/src/installer/writeAndValidateFiles.ts b/packages/installer/src/installer/writeAndValidateFiles.ts index 7c47d109b..d040a6e74 100644 --- a/packages/installer/src/installer/writeAndValidateFiles.ts +++ b/packages/installer/src/installer/writeAndValidateFiles.ts @@ -1,11 +1,10 @@ import fs from "fs"; import { Log } from "@dappnode/logger"; import { validatePath } from "@dappnode/utils"; -import { InstallPackageData } from "@dappnode/common"; +import { InstallPackageData } from "@dappnode/types"; import { dockerComposeConfig } from "@dappnode/dockerapi"; import { ComposeEditor } from "@dappnode/dockercompose"; -import { writeManifest } from "@dappnode/utils"; -import { isNotFoundError } from "@dappnode/utils"; +import { isNotFoundError, writeManifest } from "@dappnode/utils"; /** * Write the new compose and test it with config diff --git a/packages/installer/test/int/dnpLifecycle.test.int.ts b/packages/installer/test/int/dnpLifecycle.test.int.ts index 5d20c24f8..d4ef0f265 100644 --- a/packages/installer/test/int/dnpLifecycle.test.int.ts +++ b/packages/installer/test/int/dnpLifecycle.test.int.ts @@ -18,7 +18,7 @@ import { Compose, Manifest, PackageEnvs, -} from "@dappnode/common"; +} from "@dappnode/types"; import { clearDbs, getTestMountpoint, diff --git a/packages/installer/test/int/fetchRelease.test.int.ts b/packages/installer/test/int/fetchRelease.test.int.ts index 3f8ddc27f..4fc0b4fbe 100644 --- a/packages/installer/test/int/fetchRelease.test.int.ts +++ b/packages/installer/test/int/fetchRelease.test.int.ts @@ -13,7 +13,7 @@ import { uploadDirectoryRelease } from "./integrationSpecs/index.js"; import { dockerComposeUp } from "@dappnode/dockerapi"; import { ComposeEditor } from "@dappnode/dockercompose"; import { getContainerName, validatePath } from "@dappnode/utils"; -import { RequestedDnp, Manifest, SetupWizard } from "@dappnode/common"; +import { RequestedDnp, Manifest, SetupWizard } from "@dappnode/types"; import { getImageTag } from "@dappnode/utils"; describe("Fetch releases", () => { diff --git a/packages/installer/test/int/integrationSpecs/buildReleaseDirectory.ts b/packages/installer/test/int/integrationSpecs/buildReleaseDirectory.ts index e620a33c4..e97dcc201 100644 --- a/packages/installer/test/int/integrationSpecs/buildReleaseDirectory.ts +++ b/packages/installer/test/int/integrationSpecs/buildReleaseDirectory.ts @@ -10,7 +10,7 @@ import { Compose, SetupWizard, ComposeService, -} from "@dappnode/common"; +} from "@dappnode/types"; import { testDir, manifestFileName, diff --git a/packages/installer/test/int/integrationSpecs/signRelease.ts b/packages/installer/test/int/integrationSpecs/signRelease.ts index 82b1c3be6..e94a9e54e 100644 --- a/packages/installer/test/int/integrationSpecs/signRelease.ts +++ b/packages/installer/test/int/integrationSpecs/signRelease.ts @@ -1,7 +1,7 @@ import { ethers } from "ethers"; import { sortBy } from "lodash-es"; import { serializeIpfsDirectory } from "@dappnode/toolkit"; -import { ReleaseSignature } from "@dappnode/common"; +import { ReleaseSignature } from "@dappnode/types"; import { dappnodeInstaller, ipfs } from "../../testUtils.js"; import { CID } from "kubo-rpc-client"; diff --git a/packages/installer/test/int/releaseFormat.test.int.ts b/packages/installer/test/int/releaseFormat.test.int.ts index 5762c6262..ab0b318f7 100644 --- a/packages/installer/test/int/releaseFormat.test.int.ts +++ b/packages/installer/test/int/releaseFormat.test.int.ts @@ -9,7 +9,7 @@ import { } from "../../../dappmanager/test/testUtils.js"; import { params } from "@dappnode/params"; import { shell } from "@dappnode/utils"; -import { TrustedReleaseKey } from "@dappnode/common"; +import { TrustedReleaseKey } from "@dappnode/types"; import { cleanInstallationArtifacts, uploadDirectoryRelease, diff --git a/packages/installer/test/int/signedRelease.test.int.ts b/packages/installer/test/int/signedRelease.test.int.ts index d6842401f..c5298475d 100644 --- a/packages/installer/test/int/signedRelease.test.int.ts +++ b/packages/installer/test/int/signedRelease.test.int.ts @@ -3,7 +3,7 @@ import { ethers } from "ethers"; import { ComposeEditor } from "@dappnode/dockercompose"; import { dappnodeInstaller } from "../testUtils.js"; import { getContainerName, getImageTag } from "@dappnode/utils"; -import { ReleaseSignatureStatusCode, Manifest } from "@dappnode/common"; +import { ReleaseSignatureStatusCode, Manifest } from "@dappnode/types"; import { uploadDirectoryRelease } from "./integrationSpecs/index.js"; import { signRelease } from "./integrationSpecs/signRelease.js"; diff --git a/packages/installer/test/testUtils.ts b/packages/installer/test/testUtils.ts index 1975ab8fd..e45c77a3a 100644 --- a/packages/installer/test/testUtils.ts +++ b/packages/installer/test/testUtils.ts @@ -5,7 +5,7 @@ import { PackageRelease, Compose, ReleaseSignatureStatusCode, -} from "@dappnode/common"; +} from "@dappnode/types"; import { DappnodeInstaller } from "../src/dappnodeInstaller.js"; import { params } from "@dappnode/params"; import { shell } from "@dappnode/utils"; diff --git a/packages/installer/test/unit/calls/sortPackages.test.ts b/packages/installer/test/unit/calls/sortPackages.test.ts index 5de5a6d3c..955b66dd5 100644 --- a/packages/installer/test/unit/calls/sortPackages.test.ts +++ b/packages/installer/test/unit/calls/sortPackages.test.ts @@ -1,5 +1,5 @@ import { expect } from "chai"; -import { InstalledPackageData } from "@dappnode/common"; +import { InstalledPackageData } from "@dappnode/types"; import { mockContainer, mockDnp } from "../../testUtils.js"; import { sortPackages } from "../../../src/calls/packagesGet.js"; diff --git a/packages/installer/test/unit/dappGet/aggregate/getRelevantInstalledDnps.test.ts b/packages/installer/test/unit/dappGet/aggregate/getRelevantInstalledDnps.test.ts index 949219f81..aaaec6875 100644 --- a/packages/installer/test/unit/dappGet/aggregate/getRelevantInstalledDnps.test.ts +++ b/packages/installer/test/unit/dappGet/aggregate/getRelevantInstalledDnps.test.ts @@ -3,7 +3,7 @@ import { expect } from "chai"; import { valid } from "semver"; import { mockDnp, mockContainer } from "../../../testUtils.js"; import getRelevantInstalledDnps from "../../../../src/dappGet/aggregate/getRelevantInstalledDnps.js"; -import { InstalledPackageData } from "@dappnode/common"; +import { InstalledPackageData } from "@dappnode/types"; /** * Purpose of the test. Make sure it is able to pick up relevant installed DNPs diff --git a/packages/installer/test/unit/dappGet/aggregate/index.test.ts b/packages/installer/test/unit/dappGet/aggregate/index.test.ts index d77a2add0..172c743b4 100644 --- a/packages/installer/test/unit/dappGet/aggregate/index.test.ts +++ b/packages/installer/test/unit/dappGet/aggregate/index.test.ts @@ -5,7 +5,7 @@ import rewiremock from "rewiremock/webpack"; import { DappGetFetcherMock } from "../testHelpers.js"; // Import for types import aggregateType from "../../../../src/dappGet/aggregate/index.js"; -import { InstalledPackageData } from "@dappnode/common"; +import { InstalledPackageData } from "@dappnode/types"; import { mockDnp } from "../../../testUtils.js"; import { DappGetDnps } from "../../../../src/dappGet/types.js"; @@ -122,15 +122,17 @@ describe.skip("dappGet/aggregate", () => { const mock = await rewiremock.around( () => import("../../../../src/dappGet/aggregate/index.js"), (mock) => { - mock(() => - import( - "../../../../src/dappGet/aggregate/getRelevantInstalledDnps.js" - ) + mock( + () => + import( + "../../../../src/dappGet/aggregate/getRelevantInstalledDnps.js" + ) ) .withDefault(getRelevantInstalledDnps) .toBeUsed(); - mock(() => - import("../../../../src/dappGet/aggregate/aggregateDependencies.js") + mock( + () => + import("../../../../src/dappGet/aggregate/aggregateDependencies.js") ) .withDefault(aggregateDependencies) .toBeUsed(); @@ -204,9 +206,8 @@ describe.skip("dappGet/aggregate", () => { ); dnpAggregateDependenciesCalls.forEach((callArgs, i) => { - const { name, versionRange } = aggregateDependenciesSpy.getCall( - i - ).lastArg; + const { name, versionRange } = + aggregateDependenciesSpy.getCall(i).lastArg; expect({ name, versionRange }).to.deep.equal( callArgs, `Wrong arguments for call ${i} to aggregateDependencies` diff --git a/packages/installer/test/unit/dappGet/index.test.ts b/packages/installer/test/unit/dappGet/index.test.ts index 4eac1e3e0..3e4a0c0a7 100644 --- a/packages/installer/test/unit/dappGet/index.test.ts +++ b/packages/installer/test/unit/dappGet/index.test.ts @@ -4,7 +4,7 @@ import sinon from "sinon"; import rewiremock from "rewiremock/webpack"; // Import for types import { dappGet as dappGetType } from "../../../src/dappGet/index.js"; -import { InstalledPackageData } from "@dappnode/common"; +import { InstalledPackageData } from "@dappnode/types"; import { dappnodeInstaller, mockDnp } from "../../testUtils.js"; import { DappGetDnps } from "../../../src/dappGet/types.js"; import { DappGetFetcher } from "../../../src/dappGet/fetch/index.js"; diff --git a/packages/installer/test/unit/dappGet/integration.test.ts b/packages/installer/test/unit/dappGet/integration.test.ts index d5807e755..4b207f43e 100644 --- a/packages/installer/test/unit/dappGet/integration.test.ts +++ b/packages/installer/test/unit/dappGet/integration.test.ts @@ -2,7 +2,7 @@ import "mocha"; import { expect } from "chai"; import fs from "fs"; import path from "path"; -import { InstalledPackageData } from "@dappnode/common"; +import { InstalledPackageData } from "@dappnode/types"; import { mockDnp } from "../../../../dappmanager/test/testUtils.js"; import rewiremock from "rewiremock/webpack"; import { DappGetFetcherMock, DappgetTestCase } from "./testHelpers.js"; diff --git a/packages/installer/test/unit/dappGet/testHelpers.ts b/packages/installer/test/unit/dappGet/testHelpers.ts index e16ecc7d7..30f6eb5bb 100644 --- a/packages/installer/test/unit/dappGet/testHelpers.ts +++ b/packages/installer/test/unit/dappGet/testHelpers.ts @@ -1,6 +1,6 @@ import "mocha"; import { safeSemver } from "../../../src/dappGet/utils/safeSemver.js"; -import { PackageRequest, Dependencies } from "@dappnode/common"; +import { PackageRequest, Dependencies } from "@dappnode/types"; import { DappGetFetcher } from "../../../src/dappGet/fetch/index.js"; import { DappGetState, DappGetDnps } from "../../../src/dappGet/types.js"; import { DappnodeInstaller } from "../../../src/dappnodeInstaller.js"; diff --git a/packages/installer/test/unit/ethClient/syncedNotification.test.ts b/packages/installer/test/unit/ethClient/syncedNotification.test.ts index 69c6fd6e8..4abca16c9 100644 --- a/packages/installer/test/unit/ethClient/syncedNotification.test.ts +++ b/packages/installer/test/unit/ethClient/syncedNotification.test.ts @@ -3,7 +3,7 @@ import { expect } from "chai"; import sinon from "sinon"; import rewiremock from "rewiremock/webpack"; import { EventBus, eventBus } from "@dappnode/eventbus"; // TODO: consider moving to @dappnode/eventbus -import { EthClientSyncedNotificationStatus } from "@dappnode/common"; +import { EthClientSyncedNotificationStatus } from "@dappnode/types"; describe.skip("modules / ethClient / emitSyncedNotification", () => { it("Simulate notification cycle for ethClient synced status", async () => { diff --git a/packages/installer/test/unit/installer/createVolumeDevicePaths.test.ts b/packages/installer/test/unit/installer/createVolumeDevicePaths.test.ts index 6c7b558bf..cda52539a 100644 --- a/packages/installer/test/unit/installer/createVolumeDevicePaths.test.ts +++ b/packages/installer/test/unit/installer/createVolumeDevicePaths.test.ts @@ -1,6 +1,6 @@ import "mocha"; import { expect } from "chai"; -import { Compose } from "@dappnode/common"; +import { Compose } from "@dappnode/types"; import { getVolumeDevicePaths } from "../../../src/installer/createVolumeDevicePaths.js"; describe("Module > installer > createVolumeDevicePaths", () => { diff --git a/packages/installer/test/unit/installer/orderInstallPackages.test.ts b/packages/installer/test/unit/installer/orderInstallPackages.test.ts index 2f1bf20d6..faca7a8a0 100644 --- a/packages/installer/test/unit/installer/orderInstallPackages.test.ts +++ b/packages/installer/test/unit/installer/orderInstallPackages.test.ts @@ -1,6 +1,6 @@ import "mocha"; import { expect } from "chai"; -import { InstallPackageData } from "@dappnode/common"; +import { InstallPackageData } from "@dappnode/types"; import { mockPackageData } from "../../testUtils.js"; import { orderInstallPackages } from "../../../src/installer/orderInstallPackages.js"; diff --git a/packages/installer/test/unit/release/findEntries.test.ts b/packages/installer/test/unit/release/findEntries.test.ts index 3f645c6f6..71d376a01 100644 --- a/packages/installer/test/unit/release/findEntries.test.ts +++ b/packages/installer/test/unit/release/findEntries.test.ts @@ -7,7 +7,7 @@ import { DirectoryFiles, FileConfig, releaseFiles, -} from "@dappnode/common"; +} from "@dappnode/types"; interface IpfsFileResult { name: string; // 'avatar.png', diff --git a/packages/logger/package.json b/packages/logger/package.json index c559f62f4..df0369042 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -19,7 +19,7 @@ "lint": "eslint . --ext .ts --fix src" }, "dependencies": { - "@dappnode/common": "^0.1.0", + "@dappnode/types": "^0.1.0", "@dappnode/eventbus": "^0.1.0", "@dappnode/params": "^0.1.0", "@dappnode/utils": "^0.1.0", diff --git a/packages/logger/src/logUi.ts b/packages/logger/src/logUi.ts index c0c418e03..57de5cf6c 100644 --- a/packages/logger/src/logUi.ts +++ b/packages/logger/src/logUi.ts @@ -1,5 +1,5 @@ import { eventBus } from "@dappnode/eventbus"; -import { ProgressLog } from "@dappnode/common"; +import { ProgressLog } from "@dappnode/types"; import { logs } from "./logs.js"; export type Log = (dnpName: string, message: string) => void; @@ -35,7 +35,7 @@ export function logUiClear({ id }: { id: string }): void { * Curried version of logUi to simplify code * @param id, overall log id (to bundle multiple logs) */ -export const getLogUi = (id: string): Log => ( - dnpName: string, - message: string -): void => logUi({ id, dnpName, message }); +export const getLogUi = + (id: string): Log => + (dnpName: string, message: string): void => + logUi({ id, dnpName, message }); diff --git a/packages/logger/src/logUserAction.ts b/packages/logger/src/logUserAction.ts index b492740f1..61c6c4013 100644 --- a/packages/logger/src/logUserAction.ts +++ b/packages/logger/src/logUserAction.ts @@ -2,7 +2,7 @@ import { logSafeObjects } from "./logSafeObjects.js"; import { logs } from "./logs.js"; // dappnode import { JsonFileDb } from "@dappnode/utils"; -import { UserActionLog } from "@dappnode/common"; +import { UserActionLog } from "@dappnode/types"; import { params } from "@dappnode/params"; import { eventBus } from "@dappnode/eventbus"; diff --git a/packages/logger/src/logger.ts b/packages/logger/src/logger.ts index 7c0bdfae3..9f44225d5 100644 --- a/packages/logger/src/logger.ts +++ b/packages/logger/src/logger.ts @@ -1,13 +1,12 @@ import * as logUserAction from "./logUserAction.js"; import { logs } from "./logs.js"; +import { routesData, Routes } from "@dappnode/types"; import { - routesData, - Routes, LoggerMiddleware, Args, Result, EthProviderError, -} from "@dappnode/common"; +} from "@dappnode/types"; export const routesLogger: LoggerMiddleware = { onCall: (route: string, args: Args = []): void => { diff --git a/packages/logger/test/unit/logUserAction.test.ts b/packages/logger/test/unit/logUserAction.test.ts index 33e4cd0ca..d9bc4522e 100644 --- a/packages/logger/test/unit/logUserAction.test.ts +++ b/packages/logger/test/unit/logUserAction.test.ts @@ -1,23 +1,23 @@ import * as logUserAction from "../../src/logUserAction.js"; -import { UserActionLog } from "@dappnode/common"; +import { UserActionLog } from "@dappnode/types"; import "mocha"; import { expect } from "chai"; describe("Util: logUserAction", () => { it("Should return true due to a big log", () => { const bigBuffer = Buffer.alloc(3073, "a"); - const bigString: UserActionLog = (bigBuffer.toString( + const bigString: UserActionLog = bigBuffer.toString( "utf8" - ) as unknown) as UserActionLog; + ) as unknown as UserActionLog; expect(logUserAction.isLogTooBig(bigString)).to.be.true; }); it("Should return false due to a small log", () => { const bigBuffer = Buffer.alloc(3069, "a"); - const bigString: UserActionLog = (bigBuffer.toString( + const bigString: UserActionLog = bigBuffer.toString( "utf8" - ) as unknown) as UserActionLog; + ) as unknown as UserActionLog; expect(logUserAction.isLogTooBig(bigString)).to.be.false; }); diff --git a/packages/migrations/package.json b/packages/migrations/package.json index 7ddc3a6d1..9c921443e 100644 --- a/packages/migrations/package.json +++ b/packages/migrations/package.json @@ -20,13 +20,12 @@ "lint": "eslint . --ext .ts --fix src" }, "dependencies": { - "@dappnode/common": "^0.1.0", + "@dappnode/types": "^0.1.0", "@dappnode/db": "^0.1.0", "@dappnode/dockerapi": "^0.1.0", "@dappnode/dockercompose": "^0.1.0", "@dappnode/ethicalmetrics": "^0.1.0", "@dappnode/eventbus": "^0.1.0", - "@dappnode/installer": "^0.1.0", "@dappnode/logger": "^0.1.0", "@dappnode/params": "^0.1.0", "@dappnode/utils": "^0.1.0", diff --git a/packages/migrations/src/addAliasToRunningContainers.ts b/packages/migrations/src/addAliasToRunningContainers.ts index 1f96c120d..692002ad3 100644 --- a/packages/migrations/src/addAliasToRunningContainers.ts +++ b/packages/migrations/src/addAliasToRunningContainers.ts @@ -1,10 +1,10 @@ import Dockerode from "dockerode"; import { uniq } from "lodash-es"; import { - PackageContainer, ComposeNetwork, ComposeServiceNetwork, -} from "@dappnode/common"; + PackageContainer, +} from "@dappnode/types"; import { logs } from "@dappnode/logger"; import { params } from "@dappnode/params"; import { diff --git a/packages/migrations/src/migrateUserActionLogs.ts b/packages/migrations/src/migrateUserActionLogs.ts index fcf2df1ca..ed8622300 100644 --- a/packages/migrations/src/migrateUserActionLogs.ts +++ b/packages/migrations/src/migrateUserActionLogs.ts @@ -1,5 +1,5 @@ import { orderBy } from "lodash-es"; -import { UserActionLog } from "@dappnode/common"; +import { UserActionLog } from "@dappnode/types"; import { isNotFoundError } from "@dappnode/utils"; import { params } from "@dappnode/params"; import fs from "fs"; diff --git a/packages/migrations/src/recreateContainersIfLegacyDns.ts b/packages/migrations/src/recreateContainersIfLegacyDns.ts index 8c976083a..7055d049f 100644 --- a/packages/migrations/src/recreateContainersIfLegacyDns.ts +++ b/packages/migrations/src/recreateContainersIfLegacyDns.ts @@ -2,7 +2,7 @@ import { logs } from "@dappnode/logger"; import { listPackages, docker, dockerComposeUp } from "@dappnode/dockerapi"; import { getDockerComposePath } from "@dappnode/utils"; import { params } from "@dappnode/params"; -import { PackageContainer } from "@dappnode/common"; +import { PackageContainer } from "@dappnode/types"; /** * Recreate docker containers if legacy dns is still set in runtime. diff --git a/packages/migrations/src/removeLegacyDockerAssets.ts b/packages/migrations/src/removeLegacyDockerAssets.ts index 19b3e9b98..8f8aabc29 100644 --- a/packages/migrations/src/removeLegacyDockerAssets.ts +++ b/packages/migrations/src/removeLegacyDockerAssets.ts @@ -6,7 +6,7 @@ import { listPackages, } from "@dappnode/dockerapi"; import fs from "fs"; -import { InstalledPackageData } from "@dappnode/common"; +import { InstalledPackageData } from "@dappnode/types"; import { getDockerComposePath, isNotFoundError, diff --git a/packages/migrations/test/int/aliasMigration.test.int.ts b/packages/migrations/test/int/aliasMigration.test.int.ts index 99a6b5487..a60ef6fd9 100644 --- a/packages/migrations/test/int/aliasMigration.test.int.ts +++ b/packages/migrations/test/int/aliasMigration.test.int.ts @@ -1,7 +1,7 @@ import "mocha"; import fs from "fs"; import { expect } from "chai"; -import { PackageContainer } from "@dappnode/common"; +import { PackageContainer } from "@dappnode/types"; import { addAliasToGivenContainers } from "../../src/addAliasToRunningContainers.js"; import { mockContainer, shellSafe } from "../testUtils.js"; import { params } from "@dappnode/params"; diff --git a/packages/migrations/test/int/composeMigration.test.int.ts b/packages/migrations/test/int/composeMigration.test.int.ts index 504e331e8..cdc1aa518 100644 --- a/packages/migrations/test/int/composeMigration.test.int.ts +++ b/packages/migrations/test/int/composeMigration.test.int.ts @@ -1,6 +1,6 @@ import { expect } from "chai"; import fs from "fs"; -import { PackageContainer } from "@dappnode/common"; +import { PackageContainer } from "@dappnode/types"; import { migrateCoreNetworkAndAliasInCompose } from "../../src/addAliasToRunningContainers.js"; import { removeDnsFromPackageComposeFile } from "../../src/removeDnsFromComposeFiles.js"; import { params } from "@dappnode/params"; diff --git a/packages/migrations/test/testUtils.ts b/packages/migrations/test/testUtils.ts index e4cea00bb..44a180c30 100644 --- a/packages/migrations/test/testUtils.ts +++ b/packages/migrations/test/testUtils.ts @@ -1,4 +1,4 @@ -import { PackageContainer } from "@dappnode/common"; +import { PackageContainer } from "@dappnode/types"; import { shell } from "@dappnode/utils"; export const mockDnpName = "mock-dnp.dnp.dappnode.eth"; @@ -32,7 +32,7 @@ export const mockContainer: PackageContainer = { }; function ignoreErrors(fn: (arg: A) => R) { - return async function(arg: A): Promise { + return async function (arg: A): Promise { try { return await fn(arg); } catch (e) { diff --git a/packages/optimism/package.json b/packages/optimism/package.json index b1e39e3a7..be0dbcede 100644 --- a/packages/optimism/package.json +++ b/packages/optimism/package.json @@ -18,7 +18,7 @@ "lint": "eslint . --ext .ts --fix src" }, "dependencies": { - "@dappnode/common": "^0.1.0", + "@dappnode/types": "^0.1.0", "@dappnode/db": "^0.1.0", "@dappnode/dockerapi": "^0.1.0", "@dappnode/dockercompose": "^0.1.0", diff --git a/packages/optimism/src/getOptimismConfig.ts b/packages/optimism/src/getOptimismConfig.ts index cffaed390..0387b87f5 100644 --- a/packages/optimism/src/getOptimismConfig.ts +++ b/packages/optimism/src/getOptimismConfig.ts @@ -4,10 +4,10 @@ import { executionClientsOptimism, optimismL2Geth, optimismNode, -} from "@dappnode/common"; +} from "@dappnode/types"; import * as db from "@dappnode/db"; import { listPackages } from "@dappnode/dockerapi"; -import { DappnodeInstaller, packageGetData } from "@dappnode/installer"; +import { DappnodeInstaller, packageGetData } from "@dappnode/installer"; import { getIsInstalled, getIsRunning, @@ -60,7 +60,10 @@ export async function getOptimismConfig( // make sure the repo exists await dappnodeInstaller.getRepoContract(optimismNode); - const pkgData = await packageGetData(dappnodeInstaller, optimismNode); + const pkgData = await packageGetData( + dappnodeInstaller, + optimismNode + ); const mainnetRpcUrl = getOptimismNodeRpcUrlIfExists(); const isRunning = getIsRunning(pkgData, dnpList); resolve({ @@ -91,7 +94,10 @@ export async function getOptimismConfig( // make sure the repo exists await dappnodeInstaller.getRepoContract(optimismL2Geth); - const pkgData = await packageGetData(dappnodeInstaller, optimismL2Geth); + const pkgData = await packageGetData( + dappnodeInstaller, + optimismL2Geth + ); const isRunning = getIsRunning(pkgData, dnpList); resolve({ status: "ok", diff --git a/packages/optimism/src/getOptimismNodeRpcUrlIfExists.ts b/packages/optimism/src/getOptimismNodeRpcUrlIfExists.ts index 56b9d721a..7bd45d17d 100644 --- a/packages/optimism/src/getOptimismNodeRpcUrlIfExists.ts +++ b/packages/optimism/src/getOptimismNodeRpcUrlIfExists.ts @@ -1,4 +1,4 @@ -import { optimismNode } from "@dappnode/common"; +import { optimismNode } from "@dappnode/types"; import { ComposeFileEditor } from "@dappnode/dockercompose"; import { opNodeRpcUrlEnvName, opNodeServiceName } from "./params.js"; diff --git a/packages/optimism/src/params.ts b/packages/optimism/src/params.ts index c081aad7d..57996ef69 100644 --- a/packages/optimism/src/params.ts +++ b/packages/optimism/src/params.ts @@ -1,4 +1,4 @@ -import { ExecutionClientOptimism } from "@dappnode/common"; +import { ExecutionClientOptimism } from "@dappnode/types"; export const opNodeRpcUrlEnvName = "CUSTOM_L1_RPC"; export const opNodeServiceName = "op-node"; diff --git a/packages/optimism/src/setOptimismConfig.ts b/packages/optimism/src/setOptimismConfig.ts index cb7313aa4..4af08a66b 100644 --- a/packages/optimism/src/setOptimismConfig.ts +++ b/packages/optimism/src/setOptimismConfig.ts @@ -6,7 +6,7 @@ import { optimismL2Geth, executionClientsOptimism, ExecutionClientOptimism, -} from "@dappnode/common"; +} from "@dappnode/types"; import * as db from "@dappnode/db"; import { ComposeFileEditor } from "@dappnode/dockercompose"; import { diff --git a/packages/params/src/params.ts b/packages/params/src/params.ts index 9a16b5410..00b183fae 100644 --- a/packages/params/src/params.ts +++ b/packages/params/src/params.ts @@ -82,8 +82,6 @@ export const params = { // Signature API SIGNATURE_PREFIX: "\x1dDappnode Signed Message:", - DAPPNODE_REGISTRY: ".dnp.dappnode.eth", - // HTTP API parameters /** Use the internal ipfs gateway proxy so the UI works served from the HTTPs Portal */ IPFS_GATEWAY: "/ipfs/", @@ -263,30 +261,6 @@ export const params = { WIFI_KEY_SSID: "SSID", WIFI_KEY_PASSWORD: "WPA_PASSPHRASE", - // Global ENVs names - GLOBAL_ENVS: { - ACTIVE: "_DAPPNODE_GLOBAL_ENVS_ACTIVE", - DOMAIN: "_DAPPNODE_GLOBAL_DOMAIN", // "" || "6b3d49d4965584c2.dyndns.dappnode.io" - STATIC_IP: "_DAPPNODE_GLOBAL_STATIC_IP", // "" || "138.68.106.96" - HOSTNAME: "_DAPPNODE_GLOBAL_HOSTNAME", // "6b3d49d4965584c2.dyndns.dappnode.io" || "138.68.106.96" - INTERNAL_IP: "_DAPPNODE_GLOBAL_INTERNAL_IP", // "192.168.0.1" - UPNP_AVAILABLE: "_DAPPNODE_GLOBAL_UPNP_AVAILABLE", // "true" || "false" - NO_NAT_LOOPBACK: "_DAPPNODE_GLOBAL_NO_NAT_LOOPBACK", // "true" || "false" - PUBKEY: "_DAPPNODE_GLOBAL_PUBKEY", // "0x048e66b3e549818ea2cb354fb70749f6c8de8fa484f7530fc447d5fe80a1c424e4f5ae648d648c980ae7095d1efad87161d83886ca4b6c498ac22a93da5099014a", - ADDRESS: "_DAPPNODE_GLOBAL_ADDRESS", // "0x6B3D49d4965584C28Fbf14B82b1012664a73b9Ab" - PUBLIC_IP: "_DAPPNODE_GLOBAL_PUBLIC_IP", // "138.68.106.96" - SERVER_NAME: "_DAPPNODE_GLOBAL_SERVER_NAME", // "MyDAppNode" - CONSENSUS_CLIENT_MAINNET: "_DAPPNODE_GLOBAL_CONSENSUS_CLIENT_MAINNET", // "prysm.dnp.dappnode.eth" - EXECUTION_CLIENT_MAINNET: "_DAPPNODE_GLOBAL_EXECUTION_CLIENT_MAINNET", // "geth.dnp.dappnode.eth" - CONSENSUS_CLIENT_GNOSIS: "_DAPPNODE_GLOBAL_CONSENSUS_CLIENT_GNOSIS", // "teku-gnosis.dnp.dappnode.eth" - EXECUTION_CLIENT_GNOSIS: "_DAPPNODE_GLOBAL_EXECUTION_CLIENT_GNOSIS", // "nethermind-xdai.dnp.dappnode.eth" - CONSENSUS_CLIENT_PRATER: "_DAPPNODE_GLOBAL_CONSENSUS_CLIENT_PRATER", // "prysm-prater.dnp.dappnode.eth" - EXECUTION_CLIENT_PRATER: "_DAPPNODE_GLOBAL_EXECUTION_CLIENT_PRATER", // "goerli-geth.dnp.dappnode.eth" - CONSENSUS_CLIENT_LUKSO: "_DAPPNODE_GLOBAL_CONSENSUS_CLIENT_LUKSO", // "prysm-lukso.dnp.dappnode.eth" - EXECUTION_CLIENT_LUKSO: "_DAPPNODE_GLOBAL_EXECUTION_CLIENT_LUKSO", // "lukso-geth.dnp.dappnode.eth", - CONSENSUS_CLIENT_HOLESKY: "_DAPPNODE_GLOBAL_CONSENSUS_CLIENT_HOLESKY", // "prysm-holesky.dnp.dappnode.eth" - EXECUTION_CLIENT_HOLESKY: "_DAPPNODE_GLOBAL_EXECUTION_CLIENT_HOLESKY", // "geth.dnp.dappnode.eth" - }, // Global ENVs dappnode prefix GLOBAL_ENVS_PREFIX: "_DAPPNODE_GLOBAL_", diff --git a/packages/schemas/package.json b/packages/schemas/package.json index bed6c90c9..bc1827982 100644 --- a/packages/schemas/package.json +++ b/packages/schemas/package.json @@ -33,11 +33,11 @@ "src/schemas" ], "devDependencies": { - "@dappnode/params": "^0.1.0", "@types/node": "^20.6.2" }, "dependencies": { - "@dappnode/common": "^0.1.0", + "@dappnode/utils": "^0.1.0", + "@dappnode/types": "^0.1.0", "ajv": "^8.12.0", "semver": "^7.5.0" } diff --git a/packages/schemas/src/validateDappnodeCompose.ts b/packages/schemas/src/validateDappnodeCompose.ts index 55fef69ca..01168819d 100644 --- a/packages/schemas/src/validateDappnodeCompose.ts +++ b/packages/schemas/src/validateDappnodeCompose.ts @@ -1,10 +1,10 @@ import semver from "semver"; import { Compose, - Manifest, ComposeService, + Manifest, dockerComposeSafeKeys, -} from "@dappnode/common"; +} from "@dappnode/types"; import { dockerParams } from "./params.js"; import { params } from "../../params/dist/params.js"; @@ -107,9 +107,8 @@ function validateComposeService( ); } - const { dns, pid, privileged, network_mode, volumes } = compose.services[ - serviceName - ]; + const { dns, pid, privileged, network_mode, volumes } = + compose.services[serviceName]; // Check that if defined, the DNS must be the one provided from the bind package if (!isCore && dns && !dockerParams.DNS_SERVICE.includes(dns)) @@ -167,12 +166,10 @@ function validateComposeServiceNetworks( isCore: boolean, serviceName: string ): void { - const DOCKER_WHITELIST_NETWORKS_STR = dockerParams.DOCKER_WHITELIST_NETWORKS.join( - "," - ); - const DOCKER_WHITELIST_ALIASES_STR = dockerParams.DOCKER_CORE_ALIASES.join( - "," - ); + const DOCKER_WHITELIST_NETWORKS_STR = + dockerParams.DOCKER_WHITELIST_NETWORKS.join(","); + const DOCKER_WHITELIST_ALIASES_STR = + dockerParams.DOCKER_CORE_ALIASES.join(","); const service = compose.services[serviceName]; const serviceNetworks = service.networks; if (!serviceNetworks) return; diff --git a/packages/schemas/src/validateManifestSchema.ts b/packages/schemas/src/validateManifestSchema.ts index 0bfac6915..88d33f211 100644 --- a/packages/schemas/src/validateManifestSchema.ts +++ b/packages/schemas/src/validateManifestSchema.ts @@ -2,7 +2,7 @@ import { ajv } from "./ajv.js"; import { CliError } from "./error.js"; import { processError } from "./utils.js"; import manifestSchema from "./schemas/manifest.schema.json" assert { type: "json" }; -import { Manifest } from "@dappnode/common"; +import { Manifest } from "@dappnode/types"; /** * Validates manifest file with schema diff --git a/packages/schemas/src/validateSetupWizardSchema.ts b/packages/schemas/src/validateSetupWizardSchema.ts index caf2fdb6a..6ee0048a2 100644 --- a/packages/schemas/src/validateSetupWizardSchema.ts +++ b/packages/schemas/src/validateSetupWizardSchema.ts @@ -2,7 +2,7 @@ import { ajv } from "./ajv.js"; import { processError } from "./utils.js"; import setupWizardSchema from "./schemas/setup-wizard.schema.json" assert { type: "json" }; import { CliError } from "./error.js"; -import { SetupWizard } from "@dappnode/common"; +import { SetupWizard } from "@dappnode/types"; /** * Validates setupWizard file with schema diff --git a/packages/schemas/test/unit/validateDappnodeCompose.test.ts b/packages/schemas/test/unit/validateDappnodeCompose.test.ts index c0cdad3bb..daa4df503 100644 --- a/packages/schemas/test/unit/validateDappnodeCompose.test.ts +++ b/packages/schemas/test/unit/validateDappnodeCompose.test.ts @@ -1,6 +1,6 @@ import { expect } from "chai"; import { validateDappnodeCompose } from "../../src/index.js"; -import { Manifest, Compose } from "@dappnode/common"; +import { Manifest, Compose } from "@dappnode/types"; describe("files / compose / validateDappnodeCompose", () => { const manifest: Manifest = { @@ -44,8 +44,7 @@ describe("files / compose / validateDappnodeCompose", () => { "This is a major update of Prysm Prater, it will start validating with the web3signer. There will be a migration where your keystores will be replaced to another location, pay attention to the update", }, links: { - ui: - "http://ui.web3signer-prater.dappnode?signer_url=http://web3signer.web3signer-prater.dappnode:9000", + ui: "http://ui.web3signer-prater.dappnode?signer_url=http://web3signer.web3signer-prater.dappnode:9000", homepage: "https://prysmaticlabs.com/", readme: "https://github.com/dappnode/DAppNodePackage-prysm-prater", docs: "https://docs.prylabs.network/docs/getting-started", diff --git a/packages/schemas/test/unit/validateSchema.test.ts b/packages/schemas/test/unit/validateSchema.test.ts index 547d85e29..b0d0fd043 100644 --- a/packages/schemas/test/unit/validateSchema.test.ts +++ b/packages/schemas/test/unit/validateSchema.test.ts @@ -7,7 +7,7 @@ import { import fs from "fs"; import path from "path"; import { cleanTestDir, testDir } from "../testUtils.js"; -import { Manifest, SetupWizard } from "@dappnode/common"; +import { Manifest, SetupWizard } from "@dappnode/types"; describe("schemaValidation", () => { describe("manifest", () => { diff --git a/packages/stakers/package.json b/packages/stakers/package.json index 79b381b60..0e93f7280 100644 --- a/packages/stakers/package.json +++ b/packages/stakers/package.json @@ -18,7 +18,7 @@ "lint": "eslint . --ext .ts --fix src" }, "dependencies": { - "@dappnode/common": "^0.1.0", + "@dappnode/types": "^0.1.0", "@dappnode/db": "^0.1.0", "@dappnode/dockerapi": "^0.1.0", "@dappnode/installer": "^0.1.0", diff --git a/packages/stakers/src/get/getStakerConfig.ts b/packages/stakers/src/get/getStakerConfig.ts index c72a073e2..a86e3f39e 100644 --- a/packages/stakers/src/get/getStakerConfig.ts +++ b/packages/stakers/src/get/getStakerConfig.ts @@ -13,7 +13,7 @@ import { StakerConfigGet, StakerItem, Network, -} from "@dappnode/common"; +} from "@dappnode/types"; import { listPackages } from "@dappnode/dockerapi"; import { packageGetData, diff --git a/packages/stakers/src/get/getStakerDnpNamesByNetwork.ts b/packages/stakers/src/get/getStakerDnpNamesByNetwork.ts index 32d992683..2aaadda3f 100644 --- a/packages/stakers/src/get/getStakerDnpNamesByNetwork.ts +++ b/packages/stakers/src/get/getStakerDnpNamesByNetwork.ts @@ -17,7 +17,7 @@ import { signerHolesky, consensusClientsHolesky, executionClientsHolesky, -} from "@dappnode/common"; +} from "@dappnode/types"; interface StakerDnpNamesByNetwork { executionClients: readonly string[]; diff --git a/packages/stakers/src/set/ensureSetRequirements.ts b/packages/stakers/src/set/ensureSetRequirements.ts index 5d05ef26f..d993b8a45 100644 --- a/packages/stakers/src/set/ensureSetRequirements.ts +++ b/packages/stakers/src/set/ensureSetRequirements.ts @@ -5,7 +5,7 @@ import { ConsensusClient, Signer, Network, -} from "@dappnode/common"; +} from "@dappnode/types"; import { lt } from "semver"; export function ensureSetRequirements({ diff --git a/packages/stakers/src/set/getStakerCompatibleVersionsByNetwork.ts b/packages/stakers/src/set/getStakerCompatibleVersionsByNetwork.ts index 9ef6b6907..5a62f2558 100644 --- a/packages/stakers/src/set/getStakerCompatibleVersionsByNetwork.ts +++ b/packages/stakers/src/set/getStakerCompatibleVersionsByNetwork.ts @@ -5,7 +5,7 @@ import { Signer, StakerCompatibleVersionsByNetwork, Network, -} from "@dappnode/common"; +} from "@dappnode/types"; /** * Get the current staker config (execution and consensus clients selected) as well as @@ -158,7 +158,8 @@ export function getStakerCompatibleVersionsByNetwork( minVersion: "0.1.0", }, { - dnpName: "holesky-nethermind.dnp.dappnode.eth" as ExecutionClient, + dnpName: + "holesky-nethermind.dnp.dappnode.eth" as ExecutionClient, minVersion: "0.1.0", }, { @@ -168,9 +169,8 @@ export function getStakerCompatibleVersionsByNetwork( ], compatibleConsensus: [ { - dnpName: "lighthouse-holesky.dnp.dappnode.eth" as ConsensusClient< - T - >, + dnpName: + "lighthouse-holesky.dnp.dappnode.eth" as ConsensusClient, minVersion: "0.1.0", }, { diff --git a/packages/stakers/src/set/setConsensusClient.ts b/packages/stakers/src/set/setConsensusClient.ts index 5dbefef35..d96d90ab2 100644 --- a/packages/stakers/src/set/setConsensusClient.ts +++ b/packages/stakers/src/set/setConsensusClient.ts @@ -4,7 +4,7 @@ import { InstalledPackageData, Network, UserSettingsAllDnps, -} from "@dappnode/common"; +} from "@dappnode/types"; import { DappnodeInstaller, packageInstall, diff --git a/packages/stakers/src/set/setExecutionClient.ts b/packages/stakers/src/set/setExecutionClient.ts index d1e76026d..afdd2d76a 100644 --- a/packages/stakers/src/set/setExecutionClient.ts +++ b/packages/stakers/src/set/setExecutionClient.ts @@ -3,7 +3,7 @@ import { StakerItemOk, Network, InstalledPackageData, -} from "@dappnode/common"; +} from "@dappnode/types"; import { DappnodeInstaller, packageInstall } from "@dappnode/installer"; import { logs } from "@dappnode/logger"; import { diff --git a/packages/stakers/src/set/setMevBoost.ts b/packages/stakers/src/set/setMevBoost.ts index 0aa026525..db0f06ef6 100644 --- a/packages/stakers/src/set/setMevBoost.ts +++ b/packages/stakers/src/set/setMevBoost.ts @@ -5,7 +5,7 @@ import { MevBoostMainnet, MevBoostPrater, Network, -} from "@dappnode/common"; +} from "@dappnode/types"; import { DappnodeInstaller, packageInstall, diff --git a/packages/stakers/src/set/setSigner.ts b/packages/stakers/src/set/setSigner.ts index c0a299283..7bc8ed4cd 100644 --- a/packages/stakers/src/set/setSigner.ts +++ b/packages/stakers/src/set/setSigner.ts @@ -1,4 +1,4 @@ -import { InstalledPackageData } from "@dappnode/common"; +import { InstalledPackageData } from "@dappnode/types"; import { DappnodeInstaller, packageInstall } from "@dappnode/installer"; import { logs } from "@dappnode/logger"; import { dockerComposeUpPackage } from "@dappnode/dockerapi"; diff --git a/packages/stakers/src/set/setStakerConfig.ts b/packages/stakers/src/set/setStakerConfig.ts index 32ad9bb13..a67583a84 100644 --- a/packages/stakers/src/set/setStakerConfig.ts +++ b/packages/stakers/src/set/setStakerConfig.ts @@ -14,7 +14,7 @@ import { ConsensusClientHolesky, ExecutionClientHolesky, Network, -} from "@dappnode/common"; +} from "@dappnode/types"; import { getStakerCompatibleVersionsByNetwork } from "./getStakerCompatibleVersionsByNetwork.js"; import * as db from "@dappnode/db"; import { getStakerConfigByNetwork } from "../index.js"; diff --git a/packages/stakers/src/set/stopAllPkgContainers.ts b/packages/stakers/src/set/stopAllPkgContainers.ts index a5917ae11..1a986eb12 100644 --- a/packages/stakers/src/set/stopAllPkgContainers.ts +++ b/packages/stakers/src/set/stopAllPkgContainers.ts @@ -1,7 +1,7 @@ import { InstalledPackageDataApiReturn, - InstalledPackageData -} from "@dappnode/common"; + InstalledPackageData, +} from "@dappnode/types"; import { logs } from "@dappnode/logger"; import { dockerContainerStop } from "@dappnode/dockerapi"; @@ -13,9 +13,9 @@ export async function stopAllPkgContainers( ): Promise { await Promise.all( pkg.containers - .filter(c => c.running) - .map(async c => + .filter((c) => c.running) + .map(async (c) => dockerContainerStop(c.containerName, { timeout: c.dockerTimeout }) ) - ).catch(e => logs.error(e.message)); + ).catch((e) => logs.error(e.message)); } diff --git a/packages/stakers/src/utils.ts b/packages/stakers/src/utils.ts index 661949e38..e1599b32f 100644 --- a/packages/stakers/src/utils.ts +++ b/packages/stakers/src/utils.ts @@ -3,7 +3,7 @@ import { ExecutionClient, StakerConfigByNetwork, Network, -} from "@dappnode/common"; +} from "@dappnode/types"; import * as db from "@dappnode/db"; export function getStakerConfigByNetwork( diff --git a/packages/toolkit/package.json b/packages/toolkit/package.json index d447ad2db..ff171563b 100644 --- a/packages/toolkit/package.json +++ b/packages/toolkit/package.json @@ -42,8 +42,7 @@ "typechain": "^8.3.2" }, "dependencies": { - "@dappnode/common": "^0.1.0", - "@dappnode/utils": "^0.1.0", + "@dappnode/types": "^0.1.0", "@ipld/car": "^5.1.1", "esm": "^3.2.25", "ethers": "^6.9.0", diff --git a/packages/toolkit/src/directory/directory.ts b/packages/toolkit/src/directory/directory.ts index 46e86bb1a..ff6ca0a92 100644 --- a/packages/toolkit/src/directory/directory.ts +++ b/packages/toolkit/src/directory/directory.ts @@ -5,7 +5,7 @@ import { } from "../typechain/index.js"; import { DirectoryDnp, directoryDnpStatus } from "./types.js"; import { directoryAddress } from "./params.js"; -import { isEnsDomain } from "@dappnode/utils"; +import { isEnsDomain } from "../isEnsDomain.js"; /** * DappNodeDirectory is a class to interact with the DAppNode Directory Contract. diff --git a/packages/toolkit/src/directory/types.ts b/packages/toolkit/src/directory/types.ts index 57522c739..ad77cfb3e 100644 --- a/packages/toolkit/src/directory/types.ts +++ b/packages/toolkit/src/directory/types.ts @@ -1,4 +1,4 @@ -import { Manifest } from "@dappnode/common"; +import { Manifest } from "@dappnode/types"; /** * ========================== diff --git a/packages/utils/src/isEnsDomain.ts b/packages/toolkit/src/isEnsDomain.ts similarity index 100% rename from packages/utils/src/isEnsDomain.ts rename to packages/toolkit/src/isEnsDomain.ts diff --git a/packages/toolkit/src/repository/apmRepository.ts b/packages/toolkit/src/repository/apmRepository.ts index 065d24cb0..5fc79dd69 100644 --- a/packages/toolkit/src/repository/apmRepository.ts +++ b/packages/toolkit/src/repository/apmRepository.ts @@ -7,7 +7,7 @@ import { ApmVersionState, } from "./types.js"; import * as isIPFS from "is-ipfs"; -import { isEnsDomain } from "@dappnode/utils"; +import { isEnsDomain } from "../isEnsDomain.js"; import { repositoryAbi } from "./params.js"; /** diff --git a/packages/toolkit/src/repository/params.ts b/packages/toolkit/src/repository/params.ts index 03b6b66e9..80b746b3f 100644 --- a/packages/toolkit/src/repository/params.ts +++ b/packages/toolkit/src/repository/params.ts @@ -2,6 +2,8 @@ import { Abi } from "../types.js"; +export const dappnodeRegistry = ".dnp.dappnode.eth"; + // This SC creates repos for DAppNodePackages to control versioning export const repositoryContractName = "repository"; diff --git a/packages/toolkit/src/repository/releaseSignature.ts b/packages/toolkit/src/repository/releaseSignature.ts index c084d47fe..48f62aafc 100644 --- a/packages/toolkit/src/repository/releaseSignature.ts +++ b/packages/toolkit/src/repository/releaseSignature.ts @@ -9,9 +9,9 @@ import { ReleaseSignatureProtocol, ReleaseSignature, ReleaseSignatureWithData, -} from "@dappnode/common"; + releaseFiles, +} from "@dappnode/types"; import { CID } from "kubo-rpc-client"; -import { releaseFiles } from "@dappnode/common"; import { IPFSEntry } from "./types.js"; export function getReleaseSignatureStatus( diff --git a/packages/toolkit/src/repository/repository.ts b/packages/toolkit/src/repository/repository.ts index 6e668b09b..3a90b97f9 100644 --- a/packages/toolkit/src/repository/repository.ts +++ b/packages/toolkit/src/repository/repository.ts @@ -9,34 +9,29 @@ import fs from "fs"; import stream from "stream"; import util from "util"; import { - Architecture, - Manifest, ReleaseSignature, TrustedReleaseKey, defaultArch, ReleaseSignatureStatusCode, releaseFilesToDownload, - Compose, ReleaseSignatureStatus, DistributedFile, FileConfig, FileFormat, PackageRelease, releaseFiles, -} from "@dappnode/common"; -import { - getImageName, - getIsCore, - getLegacyImageName, - isEnsDomain, -} from "@dappnode/utils"; + Manifest, + Compose, + Architecture, +} from "@dappnode/types"; import YAML from "yaml"; import { ApmRepository } from "./apmRepository.js"; import { getReleaseSignatureStatus, serializeIpfsDirectory, } from "./releaseSignature.js"; -import { params } from "@dappnode/params"; +import { isEnsDomain } from "../isEnsDomain.js"; +import { dappnodeRegistry } from "./params.js"; const source = "ipfs" as const; @@ -167,7 +162,7 @@ export class DappnodeRepository extends ApmRepository { if (!manifest) throw Error(`Invalid pkg release ${contentUri}, manifest not found`); const dnpName = manifest.name; - const isCore = getIsCore(manifest); + const isCore = manifest.type === "dncore"; // get compose const compose = await this.getPkgAsset( @@ -227,8 +222,7 @@ export class DappnodeRepository extends ApmRepository { // consider adding to signedSafe !origin || signedSafe, warnings: { - coreFromForeignRegistry: - isCore && !dnpName.endsWith(params.DAPPNODE_REGISTRY), + coreFromForeignRegistry: isCore && !dnpName.endsWith(dappnodeRegistry), requestNameMismatch: isEnsDomain(dnpNameOrHash) && dnpNameOrHash !== dnpName, }, @@ -526,11 +520,15 @@ export class DappnodeRepository extends ApmRepository { const { name, version } = manifest; const imageAsset = - files.find((file) => file.name === getImageName(name, version, arch)) || + files.find( + (file) => file.name === this.getImageName(name, version, arch) + ) || (arch === defaultArch ? // New DAppNodes should load old single arch packages, // and consider their single image as amd64 - files.find((file) => file.name === getLegacyImageName(name, version)) + files.find( + (file) => file.name === this.getLegacyImageName(name, version) + ) : undefined); if (!imageAsset) { @@ -596,4 +594,33 @@ export class DappnodeRepository extends ApmRepository { if (ipfsPath.includes("ipfs")) return ipfsPath.replace("/ipfs/", ""); return ipfsPath; } + + /** + * Returns the legacy image path for the given container name and version + * @param name Container name + * @param version Container version + * @returns Legacy image path in the format _.tar.xz + */ + private getLegacyImageName = (name: string, version: string): string => + `${name}_${version}.tar.xz`; + + /** + * Returns the image path for the given container name, version and architecture + * @param name Container name + * @param version Container version + * @param arch Container architecture in the format / + * @returns Image path in the format __-.txz + */ + private getImageName = ( + name: string, + version: string, + arch: Architecture + ): string => `${name}_${version}_${this.getArchTag(arch)}.txz`; + + /** + * Returns the arch tag for the given architecture + * @param arch Architecture in the format / + * @returns Arch tag in the format - + */ + private getArchTag = (arch: Architecture): string => arch.replace(/\//g, "-"); } diff --git a/packages/toolkit/src/repository/types.ts b/packages/toolkit/src/repository/types.ts index ffbf83762..0ff5a0bb0 100644 --- a/packages/toolkit/src/repository/types.ts +++ b/packages/toolkit/src/repository/types.ts @@ -49,7 +49,3 @@ export interface PackageRequest { ver: string; req?: string; } - -export interface DappGetState { - [dnpName: string]: string; // version -} diff --git a/packages/toolkit/test/repository/repository.test.ts b/packages/toolkit/test/repository/repository.test.ts index 7d38ba855..72b6ed16f 100644 --- a/packages/toolkit/test/repository/repository.test.ts +++ b/packages/toolkit/test/repository/repository.test.ts @@ -4,10 +4,7 @@ import { cleanTestDir, testDir } from "../testUtils.js"; import path from "path"; import fs from "fs"; import { createHash } from "crypto"; -import { - ReleaseSignatureStatusCode, - TrustedReleaseKey, -} from "@dappnode/common"; +import { ReleaseSignatureStatusCode, TrustedReleaseKey } from "@dappnode/types"; describe("Dappnode Repository", function () { const ipfsUrls = [ diff --git a/packages/toolkit/test/repository/signedRelease.test.ts b/packages/toolkit/test/repository/signedRelease.test.ts index a04b5c239..e8068f08c 100644 --- a/packages/toolkit/test/repository/signedRelease.test.ts +++ b/packages/toolkit/test/repository/signedRelease.test.ts @@ -6,8 +6,8 @@ import { ReleaseSignature, ReleaseSignatureStatusCode, TrustedReleaseKey, -} from "@dappnode/common"; -import { IPFSEntry } from "@dappnode/toolkit"; +} from "@dappnode/types"; +import { IPFSEntry } from "../../src/repository/types.js"; import { serializeIpfsDirectory, getReleaseSignatureStatus, diff --git a/packages/types/.eslintignore b/packages/types/.eslintignore new file mode 100644 index 000000000..db4c6d9b6 --- /dev/null +++ b/packages/types/.eslintignore @@ -0,0 +1,2 @@ +dist +node_modules \ No newline at end of file diff --git a/packages/types/.eslintrc.cjs b/packages/types/.eslintrc.cjs new file mode 100644 index 000000000..881637db7 --- /dev/null +++ b/packages/types/.eslintrc.cjs @@ -0,0 +1,5 @@ +module.exports = { + extends: [ + "../../.eslintrc.cjs", // Uses the recommended rules from the @typescript-eslint/eslint-plugin + ], +} \ No newline at end of file diff --git a/packages/types/.mocharc.yaml b/packages/types/.mocharc.yaml new file mode 100644 index 000000000..74f9e0b34 --- /dev/null +++ b/packages/types/.mocharc.yaml @@ -0,0 +1,8 @@ +colors: true +exit: true +extension: [ts] +require: + - dotenv/config +node-option: + - experimental-specifier-resolution=node + - loader=ts-node/esm diff --git a/packages/types/README.md b/packages/types/README.md new file mode 100644 index 000000000..7cbe803ed --- /dev/null +++ b/packages/types/README.md @@ -0,0 +1,21 @@ +# Utils package + +## Overview + +❌ This package does not have calls exports + +This package contains a number of utility functions that are used throughout the rest of the packages. The work direction should go to stop from using this package as much as possible, and instead move the functions into the packages that use them. + +## Testing + +- Unit testing: `yarn test` + +## Todo + +- [ ] Reduce the number of functions in this package +- [ ] Add unit testing to every function in this package + +## Contact + +- Responsibles: + - @pablomendezroyo diff --git a/packages/types/package.json b/packages/types/package.json new file mode 100644 index 000000000..3fd04867c --- /dev/null +++ b/packages/types/package.json @@ -0,0 +1,24 @@ +{ + "name": "@dappnode/types", + "type": "module", + "version": "0.1.0", + "license": "GPL-3.0", + "main": "dist/index.js", + "typings": "dist/index.d.ts", + "exports": { + ".": { + "import": "./dist/index.js", + "require": "./dist/index.js" + }, + "./package.json": "./package.json" + }, + "scripts": { + "build": "tsc -p tsconfig.json", + "dev": "tsc -w", + "lint": "eslint . --ext .ts --fix src" + }, + "dependencies": {}, + "devDependencies": { + "@types/node": "^20.6.2" + } +} diff --git a/packages/common/src/types/calls.ts b/packages/types/src/calls.ts similarity index 98% rename from packages/common/src/types/calls.ts rename to packages/types/src/calls.ts index 3231c6a6b..7bcc9ddbd 100644 --- a/packages/common/src/types/calls.ts +++ b/packages/types/src/calls.ts @@ -1,4 +1,4 @@ -import { params } from "@dappnode/params"; +import { ContainerState } from "./pkg.js"; import { PackageEnvs } from "./compose.js"; import { Manifest, @@ -9,7 +9,6 @@ import { } from "./manifest.js"; import { SetupWizard } from "./setupWizard.js"; import { ExecutionClientMainnet, ConsensusClientMainnet } from "./stakers.js"; -import { ContainerState } from "./pkg.js"; /** * Take into account the following tags to document the new types inside this file @@ -1110,24 +1109,6 @@ export interface IdentityInterface { publicKey: string; } -/** - * =========== - * GLOBAL ENVS - * =========== - */ - -type GlobalEnvsKeys = keyof typeof params.GLOBAL_ENVS; -type GlobalEnvsValues = (typeof params.GLOBAL_ENVS)[GlobalEnvsKeys]; - -export type GlobalEnvs = { - [K in keyof typeof params.GLOBAL_ENVS]: string; -}; - -// Create type GlobalEnvsPrefixed where the key may be any value from GlobalEnvsValues -export type GlobalEnvsPrefixed = { - [K in GlobalEnvsValues]: string; -}; - /** * ===== * UTILS diff --git a/packages/common/src/types/compose.ts b/packages/types/src/compose.ts similarity index 89% rename from packages/common/src/types/compose.ts rename to packages/types/src/compose.ts index 1ffe418fd..5435910e8 100644 --- a/packages/common/src/types/compose.ts +++ b/packages/types/src/compose.ts @@ -159,3 +159,38 @@ export interface ComposePaths { /** 'manifest-admin.json', [optional] name of the compose file */ composeFileName?: string; } + +export const dockerComposeSafeKeys: (keyof ComposeService)[] = [ + "cap_add", + "cap_drop", + "command", + "depends_on", + "devices", + "entrypoint", + "environment", + "expose", + "extra_hosts", + "healthcheck", + "labels", + "logging", + "network_mode", + "networks", + "ports", + "privileged", + "restart", + "stop_grace_period", + "stop_signal", + "user", + "volumes", + "working_dir", + "security_opt", + "image", + "build", + "volumes", + "environment", + "pid", + "container_name", + "dns", + "ulimits", + "deploy", +]; diff --git a/packages/common/src/errors.ts b/packages/types/src/errors.ts similarity index 100% rename from packages/common/src/errors.ts rename to packages/types/src/errors.ts diff --git a/packages/types/src/globalEnvs.ts b/packages/types/src/globalEnvs.ts new file mode 100644 index 000000000..79781d2a8 --- /dev/null +++ b/packages/types/src/globalEnvs.ts @@ -0,0 +1,42 @@ +// Global ENVs names +export const GLOBAL_ENVS = { + ACTIVE: "_DAPPNODE_GLOBAL_ENVS_ACTIVE", + DOMAIN: "_DAPPNODE_GLOBAL_DOMAIN", // "" || "6b3d49d4965584c2.dyndns.dappnode.io" + STATIC_IP: "_DAPPNODE_GLOBAL_STATIC_IP", // "" || "138.68.106.96" + HOSTNAME: "_DAPPNODE_GLOBAL_HOSTNAME", // "6b3d49d4965584c2.dyndns.dappnode.io" || "138.68.106.96" + INTERNAL_IP: "_DAPPNODE_GLOBAL_INTERNAL_IP", // "192.168.0.1" + UPNP_AVAILABLE: "_DAPPNODE_GLOBAL_UPNP_AVAILABLE", // "true" || "false" + NO_NAT_LOOPBACK: "_DAPPNODE_GLOBAL_NO_NAT_LOOPBACK", // "true" || "false" + PUBKEY: "_DAPPNODE_GLOBAL_PUBKEY", // "0x048e66b3e549818ea2cb354fb70749f6c8de8fa484f7530fc447d5fe80a1c424e4f5ae648d648c980ae7095d1efad87161d83886ca4b6c498ac22a93da5099014a", + ADDRESS: "_DAPPNODE_GLOBAL_ADDRESS", // "0x6B3D49d4965584C28Fbf14B82b1012664a73b9Ab" + PUBLIC_IP: "_DAPPNODE_GLOBAL_PUBLIC_IP", // "138.68.106.96" + SERVER_NAME: "_DAPPNODE_GLOBAL_SERVER_NAME", // "MyDAppNode" + CONSENSUS_CLIENT_MAINNET: "_DAPPNODE_GLOBAL_CONSENSUS_CLIENT_MAINNET", // "prysm.dnp.dappnode.eth" + EXECUTION_CLIENT_MAINNET: "_DAPPNODE_GLOBAL_EXECUTION_CLIENT_MAINNET", // "geth.dnp.dappnode.eth" + CONSENSUS_CLIENT_GNOSIS: "_DAPPNODE_GLOBAL_CONSENSUS_CLIENT_GNOSIS", // "teku-gnosis.dnp.dappnode.eth" + EXECUTION_CLIENT_GNOSIS: "_DAPPNODE_GLOBAL_EXECUTION_CLIENT_GNOSIS", // "nethermind-xdai.dnp.dappnode.eth" + CONSENSUS_CLIENT_PRATER: "_DAPPNODE_GLOBAL_CONSENSUS_CLIENT_PRATER", // "prysm-prater.dnp.dappnode.eth" + EXECUTION_CLIENT_PRATER: "_DAPPNODE_GLOBAL_EXECUTION_CLIENT_PRATER", // "goerli-geth.dnp.dappnode.eth" + CONSENSUS_CLIENT_LUKSO: "_DAPPNODE_GLOBAL_CONSENSUS_CLIENT_LUKSO", // "prysm-lukso.dnp.dappnode.eth" + EXECUTION_CLIENT_LUKSO: "_DAPPNODE_GLOBAL_EXECUTION_CLIENT_LUKSO", // "lukso-geth.dnp.dappnode.eth", + CONSENSUS_CLIENT_HOLESKY: "_DAPPNODE_GLOBAL_CONSENSUS_CLIENT_HOLESKY", // "prysm-holesky.dnp.dappnode.eth" + EXECUTION_CLIENT_HOLESKY: "_DAPPNODE_GLOBAL_EXECUTION_CLIENT_HOLESKY", // "geth.dnp.dappnode.eth" +}; + +/** + * =========== + * GLOBAL ENVS + * =========== + */ + +type GlobalEnvsKeys = keyof typeof GLOBAL_ENVS; +type GlobalEnvsValues = (typeof GLOBAL_ENVS)[GlobalEnvsKeys]; + +export type GlobalEnvs = { + [K in keyof typeof GLOBAL_ENVS]: string; +}; + +// Create type GlobalEnvsPrefixed where the key may be any value from GlobalEnvsValues +export type GlobalEnvsPrefixed = { + [K in GlobalEnvsValues]: string; +}; diff --git a/packages/common/src/types/index.ts b/packages/types/src/index.ts similarity index 56% rename from packages/common/src/types/index.ts rename to packages/types/src/index.ts index 454a5d3fc..4d5d36f18 100644 --- a/packages/common/src/types/index.ts +++ b/packages/types/src/index.ts @@ -1,7 +1,12 @@ export * from "./manifest.js"; -export * from "./compose.js"; export * from "./setupWizard.js"; -export * from "./pkg.js"; +export * from "./compose.js"; export * from "./stakers.js"; -export * from "./rollups.js"; +export * from "./pkg.js"; export * from "./calls.js"; +export * from "./rollups.js"; +export * from "./globalEnvs.js"; +export * from "./releaseFiles.js"; +export * from "./errors.js"; +export * from "./routes.js"; +export * from "./subscriptions.js"; diff --git a/packages/common/src/types/manifest.ts b/packages/types/src/manifest.ts similarity index 91% rename from packages/common/src/types/manifest.ts rename to packages/types/src/manifest.ts index 5f8fe9998..5f9872216 100644 --- a/packages/common/src/types/manifest.ts +++ b/packages/types/src/manifest.ts @@ -160,19 +160,6 @@ interface ExposableServiceManifestInfo { exposeByDefault?: boolean; } -export enum ManifestFormat { - json = "json", - yml = "yml", - yaml = "yaml", -} - -export interface ManifestPaths { - /** './folder', [optional] directory to load the manifest from */ - dir?: string; - /** 'manifest-admin.json', [optional] name of the manifest file */ - manifestFileName?: string; -} - // Arch export type Architecture = (typeof architectures)[number]; diff --git a/packages/common/src/types/pkg.ts b/packages/types/src/pkg.ts similarity index 95% rename from packages/common/src/types/pkg.ts rename to packages/types/src/pkg.ts index b92a88473..e90130ddc 100644 --- a/packages/common/src/types/pkg.ts +++ b/packages/types/src/pkg.ts @@ -1,17 +1,7 @@ import { Compose } from "./compose.js"; -import { GrafanaDashboard, Manifest, PrometheusTarget } from "./manifest.js"; +import { Manifest, PrometheusTarget, GrafanaDashboard } from "./manifest.js"; import { SetupWizard } from "./setupWizard.js"; -/** - * IPFS - */ - -export interface IpfsDagGetDirectory { - Name: string; - Size: number; - Hash: string; -} - /** * ========= * CONTAINER @@ -207,6 +197,4 @@ export interface PackageRequest { req?: string; } -export interface DappGetState { - [dnpName: string]: string; // version -} +export const defaultArch = "linux/amd64" as const; diff --git a/packages/common/src/releaseFiles/releaseFiles.ts b/packages/types/src/releaseFiles.ts similarity index 84% rename from packages/common/src/releaseFiles/releaseFiles.ts rename to packages/types/src/releaseFiles.ts index 5082f00d1..8f1efdfff 100644 --- a/packages/common/src/releaseFiles/releaseFiles.ts +++ b/packages/types/src/releaseFiles.ts @@ -1,4 +1,4 @@ -import { FileFormat } from "../types/pkg.js"; +import { FileFormat } from "./pkg.js"; export const releaseFiles = Object.freeze({ manifest: Object.freeze({ @@ -86,3 +86,14 @@ export const releaseFiles = Object.freeze({ multiple: true as const, }), } as const); + +export const releaseFilesToDownload = { + manifest: releaseFiles.manifest, + compose: releaseFiles.compose, + signature: releaseFiles.signature, + setupWizard: releaseFiles.setupWizard, + disclaimer: releaseFiles.disclaimer, + gettingStarted: releaseFiles.gettingStarted, + prometheusTargets: releaseFiles.prometheusTargets, + grafanaDashboards: releaseFiles.grafanaDashboards, +}; diff --git a/packages/common/src/types/rollups.ts b/packages/types/src/rollups.ts similarity index 100% rename from packages/common/src/types/rollups.ts rename to packages/types/src/rollups.ts diff --git a/packages/common/src/routes.ts b/packages/types/src/routes.ts similarity index 98% rename from packages/common/src/routes.ts rename to packages/types/src/routes.ts index 8f1ee61ca..229856501 100644 --- a/packages/common/src/routes.ts +++ b/packages/types/src/routes.ts @@ -1,55 +1,52 @@ import { AutoUpdateDataView, + ChainData, + VpnDeviceCredentials, + VpnDevice, + HostDiagnoseItem, + EthClientFallback, + Eth2ClientTarget, + EthicalMetricsConfig, CoreUpdateData, DirectoryItem, RequestedDnp, - UserSettingsAllDnps, + UserActionLog, + HttpsPortalMapping, + ExposableServiceMapping, + IpfsRepository, + LocalProxyingStatus, + HostHardDisk, + HostVolumeGroup, + HostLogicalVolume, MountpointData, - SystemInfo, - VolumeData, - PortMapping, - PackageNotification, - EthClientFallback, NewFeatureId, NewFeatureStatus, - VpnDeviceCredentials, - VpnDevice, PackageNotificationDb, - UserActionLog, + PackageNotification, + UserSettingsAllDnps, InstalledPackageDetailData, - HostStatCpu, - HostStatDisk, - HostStatMemory, - PublicIpResponse, - ChainData, - ShhStatus, + InstalledPackageDataApiReturn, + PortMapping, PortToOpen, UpnpTablePortStatus, ApiTablePortStatus, - HttpsPortalMapping, - WireguardDeviceCredentials, - ExposableServiceMapping, - HostDiagnoseItem, - InstalledPackageDataApiReturn, - WifiReport, - CurrentWifiCredentials, - LocalProxyingStatus, - HostHardDisk, - HostVolumeGroup, - HostLogicalVolume, - IpfsRepository, - TrustedReleaseKey, - StakerConfigSet, - StakerConfigGet, - Eth2ClientTarget, - EthicalMetricsConfig, - OptimismConfigSet, - OptimismConfigGet, RebootRequiredScript, - Network, - PackageBackup, - PackageEnvs, -} from "./types/index.js"; + HostStatCpu, + HostStatMemory, + HostStatDisk, + ShhStatus, + SystemInfo, + VolumeData, + PublicIpResponse, + CurrentWifiCredentials, + WifiReport, + WireguardDeviceCredentials, +} from "./calls.js"; +import { PackageEnvs } from "./compose.js"; +import { PackageBackup } from "./manifest.js"; +import { TrustedReleaseKey } from "./pkg.js"; +import { OptimismConfigSet, OptimismConfigGet } from "./rollups.js"; +import { Network, StakerConfigGet, StakerConfigSet } from "./stakers.js"; export interface Routes { /** diff --git a/packages/common/src/types/setupWizard.ts b/packages/types/src/setupWizard.ts similarity index 100% rename from packages/common/src/types/setupWizard.ts rename to packages/types/src/setupWizard.ts diff --git a/packages/common/src/types/stakers.ts b/packages/types/src/stakers.ts similarity index 100% rename from packages/common/src/types/stakers.ts rename to packages/types/src/stakers.ts diff --git a/packages/common/src/subscriptions.ts b/packages/types/src/subscriptions.ts similarity index 95% rename from packages/common/src/subscriptions.ts rename to packages/types/src/subscriptions.ts index cf0a94f30..46c710fed 100644 --- a/packages/common/src/subscriptions.ts +++ b/packages/types/src/subscriptions.ts @@ -1,14 +1,14 @@ import { AutoUpdateDataView, + VpnDevice, DirectoryItem, InstalledPackageData, - PackageNotification, ProgressLog, + PackageNotification, SystemInfo, UserActionLog, VolumeData, - VpnDevice, -} from "./types/index.js"; +} from "./calls.js"; export interface SubscriptionsTypes { /** @@ -93,7 +93,7 @@ export type Subscriptions = { }; }; -export const subscriptionsData: { [P in keyof Subscriptions]: {} } = { +export const subscriptionsData: { [P in keyof Subscriptions]: object } = { autoUpdateData: {}, devices: {}, directory: {}, diff --git a/packages/types/tsconfig.json b/packages/types/tsconfig.json new file mode 100644 index 000000000..e91c35bd6 --- /dev/null +++ b/packages/types/tsconfig.json @@ -0,0 +1,16 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + /* Modules */ + "types": ["node", "mocha"], + + /* Emit */ + "outDir": "dist", + + /* Language and Environment */ + "lib": ["DOM", "ESNext"] + }, + "ts-node": { "esm": true, "experimentalSpecifierResolution": "node" }, + "include": ["src/**/*", "src/**/*.json"], + "exclude": ["node_modules", "test/**/*"] +} diff --git a/packages/upnpc/package.json b/packages/upnpc/package.json index f6dd723ec..801b49e1e 100644 --- a/packages/upnpc/package.json +++ b/packages/upnpc/package.json @@ -19,7 +19,7 @@ "lint": "eslint . --ext .ts --fix src" }, "dependencies": { - "@dappnode/common": "^0.1.0", + "@dappnode/types": "^0.1.0", "@dappnode/dockerapi": "^0.1.0", "@dappnode/utils": "^0.1.0", "is-ip": "3.0.0" diff --git a/packages/upnpc/src/close.ts b/packages/upnpc/src/close.ts index 91537d33d..308406226 100644 --- a/packages/upnpc/src/close.ts +++ b/packages/upnpc/src/close.ts @@ -1,5 +1,5 @@ import upnpcCommand from "./upnpcCommand.js"; -import { PackagePort } from "@dappnode/common"; +import { PackagePort } from "@dappnode/types"; /** * Close port = deletes the map requested port to host diff --git a/packages/upnpc/src/list.ts b/packages/upnpc/src/list.ts index c09495c72..0621be6b2 100644 --- a/packages/upnpc/src/list.ts +++ b/packages/upnpc/src/list.ts @@ -1,5 +1,5 @@ import upnpcCommand from "./upnpcCommand.js"; -import { PortProtocol, UpnpPortMapping } from "@dappnode/common"; +import { PortProtocol, UpnpPortMapping } from "@dappnode/types"; import { parseUpnpErrors } from "./upnpError.js"; /** @@ -85,10 +85,10 @@ export function parseListOutput(terminalOutput: string): UpnpPortMapping[] { .split(/\r?\n/) // Filter by lines that have the table format above .filter( - line => line && typeof line === "string" && validLineRegex.test(line) + (line) => line && typeof line === "string" && validLineRegex.test(line) ) // Parse the line to extract the protocol and port mapping - .map(line => { + .map((line) => { // 3 UDP 30303->192.168.1.42:30303 'DAppNode' '' 0 const [, protocol, mapping] = line.trim().split(/\s+/); const exPort = mapping.split("->")[0]; @@ -97,7 +97,7 @@ export function parseListOutput(terminalOutput: string): UpnpPortMapping[] { protocol: protocol === "UDP" ? PortProtocol.UDP : PortProtocol.TCP, exPort, inPort, - ip + ip, }; }) // Make sure each result is correct, otherwise remove it diff --git a/packages/upnpc/src/open.ts b/packages/upnpc/src/open.ts index 314b75271..d9b9691d9 100644 --- a/packages/upnpc/src/open.ts +++ b/packages/upnpc/src/open.ts @@ -1,5 +1,5 @@ import upnpcCommand from "./upnpcCommand.js"; -import { PackagePort } from "@dappnode/common"; +import { PackagePort } from "@dappnode/types"; /** * Opens port = adds port mapping diff --git a/packages/utils/package.json b/packages/utils/package.json index 6d362a2eb..e876103e5 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -20,7 +20,7 @@ "lint": "eslint . --ext .ts --fix src" }, "dependencies": { - "@dappnode/common": "^0.1.0", + "@dappnode/types": "^0.1.0", "@dappnode/params": "^0.1.0", "ajv": "^6.10.2", "async-retry": "^1.3.1", diff --git a/packages/utils/src/computeSemverUpdateType.ts b/packages/utils/src/computeSemverUpdateType.ts index a51e3346e..8e00fc414 100644 --- a/packages/utils/src/computeSemverUpdateType.ts +++ b/packages/utils/src/computeSemverUpdateType.ts @@ -1,5 +1,5 @@ import { lt, valid, major, minor, patch, coerce } from "semver"; -import { UpdateType } from "@dappnode/common"; +import { UpdateType } from "@dappnode/types"; /** * Compute the release type: major, minor, patch diff --git a/packages/utils/src/environment.ts b/packages/utils/src/environment.ts index 0b3c3a470..20c1c5002 100644 --- a/packages/utils/src/environment.ts +++ b/packages/utils/src/environment.ts @@ -1,4 +1,4 @@ -import { PackageEnvs } from "@dappnode/common"; +import { PackageEnvs } from "@dappnode/types"; import { pickBy } from "lodash-es"; /** diff --git a/packages/utils/src/fileToGatewayUrl.ts b/packages/utils/src/fileToGatewayUrl.ts index a6588e7fd..e80e4623c 100644 --- a/packages/utils/src/fileToGatewayUrl.ts +++ b/packages/utils/src/fileToGatewayUrl.ts @@ -1,4 +1,4 @@ -import { DistributedFile } from "@dappnode/common"; +import { DistributedFile } from "@dappnode/types"; import { normalizeHash } from "./normalizeHash.js"; import url from "url"; import { params } from "@dappnode/params"; diff --git a/packages/utils/src/getArchTag.ts b/packages/utils/src/getArchTag.ts deleted file mode 100644 index 283362540..000000000 --- a/packages/utils/src/getArchTag.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Architecture } from "@dappnode/common"; - -/** - * Returns the arch tag for the given architecture - * @param arch Architecture in the format / - * @returns Arch tag in the format - - */ -export const getArchTag = (arch: Architecture): string => - arch.replace(/\//g, "-"); diff --git a/packages/utils/src/getImageName.ts b/packages/utils/src/getImageName.ts deleted file mode 100644 index f6af2ebc7..000000000 --- a/packages/utils/src/getImageName.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Architecture } from "@dappnode/common"; -import { getArchTag } from "./getArchTag.js"; - -/** - * Returns the image path for the given container name, version and architecture - * @param name Container name - * @param version Container version - * @param arch Container architecture in the format / - * @returns Image path in the format __-.txz - */ -export const getImageName = ( - name: string, - version: string, - arch: Architecture -): string => `${name}_${version}_${getArchTag(arch)}.txz`; diff --git a/packages/utils/src/getIsCore.ts b/packages/utils/src/getIsCore.ts index def298680..8ebdd5eb0 100644 --- a/packages/utils/src/getIsCore.ts +++ b/packages/utils/src/getIsCore.ts @@ -1,4 +1,4 @@ -import { Manifest } from "@dappnode/common"; +import { Manifest } from "@dappnode/types"; export function getIsCore(manifest: Manifest): boolean { return manifest.type === "dncore"; diff --git a/packages/utils/src/getIsInstalled.ts b/packages/utils/src/getIsInstalled.ts index 8969d54df..3e7e02217 100644 --- a/packages/utils/src/getIsInstalled.ts +++ b/packages/utils/src/getIsInstalled.ts @@ -1,4 +1,4 @@ -import { InstalledPackageData } from "@dappnode/common"; +import { InstalledPackageData } from "@dappnode/types"; /** * Helper to check if a package is installed diff --git a/packages/utils/src/getIsMonoService.ts b/packages/utils/src/getIsMonoService.ts index 500742a8f..5c4346eda 100644 --- a/packages/utils/src/getIsMonoService.ts +++ b/packages/utils/src/getIsMonoService.ts @@ -1,4 +1,4 @@ -import { Compose } from "@dappnode/common"; +import { Compose } from "@dappnode/types"; /** * Returns whether the given compose file is a mono-service compose file or not diff --git a/packages/utils/src/getIsRunning.ts b/packages/utils/src/getIsRunning.ts index a96524873..0dcb60af4 100644 --- a/packages/utils/src/getIsRunning.ts +++ b/packages/utils/src/getIsRunning.ts @@ -1,4 +1,4 @@ -import { InstalledPackageData } from "@dappnode/common"; +import { InstalledPackageData } from "@dappnode/types"; /** * Returns true if the package is running or false if not diff --git a/packages/utils/src/getIsUpdated.ts b/packages/utils/src/getIsUpdated.ts index 6b5a3b1ed..87044d0e6 100644 --- a/packages/utils/src/getIsUpdated.ts +++ b/packages/utils/src/getIsUpdated.ts @@ -1,4 +1,4 @@ -import { InstalledPackageData } from "@dappnode/common"; +import { InstalledPackageData } from "@dappnode/types"; import { shouldUpdate } from "./shouldUpdate.js"; /** diff --git a/packages/utils/src/getLegacyImageName.ts b/packages/utils/src/getLegacyImageName.ts deleted file mode 100644 index 9aaaf2643..000000000 --- a/packages/utils/src/getLegacyImageName.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Returns the legacy image path for the given container name and version - * @param name Container name - * @param version Container version - * @returns Legacy image path in the format _.tar.xz - */ -export const getLegacyImageName = (name: string, version: string): string => - `${name}_${version}.tar.xz`; diff --git a/packages/utils/src/getPrivateNetworkAliases.ts b/packages/utils/src/getPrivateNetworkAliases.ts index 79a269293..befca6442 100644 --- a/packages/utils/src/getPrivateNetworkAliases.ts +++ b/packages/utils/src/getPrivateNetworkAliases.ts @@ -1,4 +1,4 @@ -import { ContainerNames } from "@dappnode/common"; +import { ContainerNames } from "@dappnode/types"; import { params } from "@dappnode/params"; import { buildNetworkAlias } from "./buildNetworkAlias.js"; diff --git a/packages/utils/src/globalEnvs.ts b/packages/utils/src/globalEnvs.ts index 8b922a48d..349b1a12b 100644 --- a/packages/utils/src/globalEnvs.ts +++ b/packages/utils/src/globalEnvs.ts @@ -1,4 +1,4 @@ -import { GlobalEnvs } from "@dappnode/common"; +import { GlobalEnvs, GLOBAL_ENVS } from "@dappnode/types"; import { params } from "@dappnode/params"; import fs from "fs"; import { mapKeys } from "lodash-es"; @@ -29,7 +29,7 @@ export function createGlobalEnvsEnvFile(): void { export function writeEnvFile(envPath: string, envs: GlobalEnvs): void { const envsWithPrefix = mapKeys( envs, - (_0, key) => params.GLOBAL_ENVS[key as keyof typeof envs] + (_0, key) => GLOBAL_ENVS[key as keyof typeof envs] ); const envData = stringifyEnvironment(envsWithPrefix).join("\n"); fs.writeFileSync(envPath, envData); diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts index 5f7d8c0d6..b048bd1bd 100644 --- a/packages/utils/src/index.ts +++ b/packages/utils/src/index.ts @@ -1,7 +1,6 @@ export { applyRecursivelyToStringValues } from "./applyRecursivelyToStringValues.js"; export { JsonFileDb } from "./jsonFileDb.js"; export { PlainTextFileDb } from "./plainTextFileDb.js"; -export { getArchTag } from "./getArchTag.js"; export { getContainerName } from "./getContainerName.js"; export { getContainerDomain } from "./getContainerDomain.js"; export { validatePath } from "./validatePath.js"; @@ -31,9 +30,7 @@ export { writeEnvFile, createGlobalEnvsEnvFile } from "./globalEnvs.js"; export { getManifestPath } from "./getManifestPath.js"; export { getImageTag } from "./getImageTag.js"; export { getImagePath } from "./getImagePath.js"; -export { getImageName } from "./getImageName.js"; export { getIsMonoService } from "./getIsMonoService.js"; -export { getLegacyImageName } from "./getLegacyImageName.js"; export { getEnvFilePath } from "./getEnvFilePath.js"; export { getBackupPath } from "./getBackupPath.js"; export * from "./asyncFlows.js"; @@ -53,7 +50,6 @@ export { shouldUpdate } from "./shouldUpdate.js"; export { getPublicIpFromUrls } from "./getPublicIpFromUrls.js"; export { computeSemverUpdateType } from "./computeSemverUpdateType.js"; export * from "./coreVersionId.js"; -export { isEnsDomain } from "./isEnsDomain.js"; export { writeManifest } from "./writeManifest.js"; export { readManifestIfExists } from "./readManifestIfExists.js"; export { removeCidrSuffix } from "./removeCidrSuffix.js"; diff --git a/packages/utils/src/packageInstalledHasPid.ts b/packages/utils/src/packageInstalledHasPid.ts index 3492dc0fc..0e810ef7a 100644 --- a/packages/utils/src/packageInstalledHasPid.ts +++ b/packages/utils/src/packageInstalledHasPid.ts @@ -1,4 +1,4 @@ -import { Compose } from "@dappnode/common"; +import { Compose } from "@dappnode/types"; /** * Check if a compose contains pid diff --git a/packages/utils/src/pid.ts b/packages/utils/src/pid.ts index b576d5cd1..eeb299bc0 100644 --- a/packages/utils/src/pid.ts +++ b/packages/utils/src/pid.ts @@ -1,8 +1,4 @@ -import { - InstallPackageData, - PackageContainer, - Compose, -} from "@dappnode/common"; +import { Compose, InstallPackageData, PackageContainer } from "@dappnode/types"; import { packageInstalledHasPid } from "./packageInstalledHasPid.js"; export interface ComposeServicesSharingPid { diff --git a/packages/utils/src/readManifestIfExists.ts b/packages/utils/src/readManifestIfExists.ts index 13474607c..94db4f4dd 100644 --- a/packages/utils/src/readManifestIfExists.ts +++ b/packages/utils/src/readManifestIfExists.ts @@ -1,5 +1,5 @@ import fs from "fs"; -import { Manifest } from "@dappnode/common"; +import { Manifest } from "@dappnode/types"; import { getManifestPath } from "./getManifestPath.js"; import { isNotFoundError } from "./isNotFoundError.js"; import { validatePath } from "./validatePath.js"; diff --git a/packages/utils/src/stakerUtils.ts b/packages/utils/src/stakerUtils.ts index bf29c0ac6..8b8f1f9f0 100644 --- a/packages/utils/src/stakerUtils.ts +++ b/packages/utils/src/stakerUtils.ts @@ -1,4 +1,4 @@ -import { UserSettingsAllDnps, Network } from "@dappnode/common"; +import { UserSettingsAllDnps, Network } from "@dappnode/types"; /** * Get the validator service name. diff --git a/packages/utils/src/writeManifest.ts b/packages/utils/src/writeManifest.ts index 5905544a7..00cc398a1 100644 --- a/packages/utils/src/writeManifest.ts +++ b/packages/utils/src/writeManifest.ts @@ -1,5 +1,5 @@ import fs from "fs"; -import { Manifest } from "@dappnode/common"; +import { Manifest } from "@dappnode/types"; export function writeManifest(manfiestPath: string, manifest: Manifest): void { fs.writeFileSync(manfiestPath, JSON.stringify(manifest, null, 2));