From bcc76dd60ac442523778c23f2622451860411629 Mon Sep 17 00:00:00 2001 From: J H Date: Wed, 27 Mar 2024 11:11:55 -0600 Subject: [PATCH 01/25] fix: The db dump on the private --- core/startos/src/db/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/startos/src/db/mod.rs b/core/startos/src/db/mod.rs index 874733ca6..99602ba5a 100644 --- a/core/startos/src/db/mod.rs +++ b/core/startos/src/db/mod.rs @@ -206,7 +206,7 @@ async fn cli_dump( from_value::( ctx.call_remote( "db.dump", - imbl_value::json!({ "include-private":include_private }), + imbl_value::json!({ "includePrivate":include_private }), ) .await?, )? From 5698b830ed2b42149106c83d57ef130143d90afb Mon Sep 17 00:00:00 2001 From: J H Date: Wed, 27 Mar 2024 12:40:23 -0600 Subject: [PATCH 02/25] Fix: Fix the issue where the restart after a service install and update, would mak the system crash --- core/startos/Cargo.toml | 3 ++- core/startos/src/db/model/package.rs | 6 ++---- core/startos/src/service/mod.rs | 4 ++-- core/startos/src/service/service_map.rs | 4 ++-- core/startos/src/util/serde.rs | 12 ++++++++++++ 5 files changed, 20 insertions(+), 9 deletions(-) diff --git a/core/startos/Cargo.toml b/core/startos/Cargo.toml index 301602e2d..8106c800b 100644 --- a/core/startos/Cargo.toml +++ b/core/startos/Cargo.toml @@ -70,11 +70,12 @@ current_platform = "0.2.0" digest = "0.10.7" divrem = "1.0.0" ed25519 = { version = "2.2.3", features = ["pkcs8", "pem", "alloc"] } -ed25519-dalek = { version = "2.0.0", features = [ +ed25519-dalek = { version = "2.1.1", features = [ "serde", "zeroize", "rand_core", "digest", + "pkcs8" ] } ed25519-dalek-v1 = { package = "ed25519-dalek", version = "1" } emver = { version = "0.1.7", git = "https://github.com/Start9Labs/emver-rs.git", features = [ diff --git a/core/startos/src/db/model/package.rs b/core/startos/src/db/model/package.rs index 05d6e73b7..fc3c2751c 100644 --- a/core/startos/src/db/model/package.rs +++ b/core/startos/src/db/model/package.rs @@ -10,11 +10,11 @@ use reqwest::Url; use serde::{Deserialize, Serialize}; use ts_rs::TS; -use crate::net::host::HostInfo; use crate::prelude::*; use crate::progress::FullProgress; use crate::s9pk::manifest::Manifest; use crate::status::Status; +use crate::{net::host::HostInfo, util::serde::Pem}; #[derive(Debug, Default, Deserialize, Serialize)] pub struct AllPackageData(pub BTreeMap); @@ -294,9 +294,7 @@ pub struct PackageDataEntry { pub state_info: PackageState, pub status: Status, pub marketplace_url: Option, - #[serde(default)] - #[serde(with = "crate::util::serde::ed25519_pubkey")] - pub developer_key: ed25519_dalek::VerifyingKey, + pub developer_key: Pem, pub icon: DataUrl<'static>, pub last_backup: Option>, pub dependency_info: BTreeMap, diff --git a/core/startos/src/service/mod.rs b/core/startos/src/service/mod.rs index 2feb4ca34..a10857c5a 100644 --- a/core/startos/src/service/mod.rs +++ b/core/startos/src/service/mod.rs @@ -12,7 +12,6 @@ use serde::{Deserialize, Serialize}; use start_stop::StartStop; use tokio::sync::Notify; -use crate::action::ActionResult; use crate::config::action::ConfigRes; use crate::context::{CliContext, RpcContext}; use crate::core::rpc_continuations::RequestGuid; @@ -30,6 +29,7 @@ use crate::status::health_check::HealthCheckResult; use crate::status::MainStatus; use crate::util::actor::{Actor, BackgroundJobs, SimpleActor}; use crate::volume::data_dir; +use crate::{action::ActionResult, util::serde::Pem}; pub mod cli; mod config; @@ -280,7 +280,7 @@ impl Service { entry .as_state_info_mut() .ser(&PackageState::Installed(InstalledState { manifest }))?; - entry.as_developer_key_mut().ser(&developer_key)?; + entry.as_developer_key_mut().ser(&Pem::new(developer_key))?; entry.as_icon_mut().ser(&icon)?; // TODO: marketplace url // TODO: dependency info diff --git a/core/startos/src/service/service_map.rs b/core/startos/src/service/service_map.rs index 1a9d2342c..e56b1d7dd 100644 --- a/core/startos/src/service/service_map.rs +++ b/core/startos/src/service/service_map.rs @@ -10,7 +10,6 @@ use imbl_value::InternedString; use tokio::sync::{Mutex, OwnedRwLockReadGuard, OwnedRwLockWriteGuard, RwLock}; use tracing::instrument; -use crate::context::RpcContext; use crate::db::model::package::{ InstallingInfo, InstallingState, PackageDataEntry, PackageState, UpdatingState, }; @@ -27,6 +26,7 @@ use crate::s9pk::merkle_archive::source::FileSource; use crate::s9pk::S9pk; use crate::service::{LoadDisposition, Service}; use crate::status::{MainStatus, Status}; +use crate::{context::RpcContext, util::serde::Pem}; pub type DownloadInstallFuture = BoxFuture<'static, Result>; pub type InstallFuture = BoxFuture<'static, Result<(), Error>>; @@ -167,7 +167,7 @@ impl ServiceMap { dependency_config_errors: Default::default(), }, marketplace_url: None, - developer_key, + developer_key: Pem::new(developer_key), icon, last_backup: None, dependency_info: Default::default(), diff --git a/core/startos/src/util/serde.rs b/core/startos/src/util/serde.rs index de25e0505..cd414f66e 100644 --- a/core/startos/src/util/serde.rs +++ b/core/startos/src/util/serde.rs @@ -1128,6 +1128,18 @@ impl PemEncoding for ssh_key::PrivateKey { } } +impl PemEncoding for ed25519_dalek::VerifyingKey { + fn from_pem(pem: &str) -> Result { + use ed25519_dalek::pkcs8::DecodePublicKey; + ed25519_dalek::VerifyingKey::from_public_key_pem(pem).map_err(E::custom) + } + fn to_pem(&self) -> Result { + use ed25519_dalek::pkcs8::EncodePublicKey; + self.to_public_key_pem(pkcs8::LineEnding::LF) + .map_err(E::custom) + } +} + pub mod pem { use serde::{Deserialize, Deserializer, Serializer}; From f770d5072e7a73a0747b092a5f79fbd14f04fff7 Mon Sep 17 00:00:00 2001 From: Aiden McClelland Date: Wed, 27 Mar 2024 13:58:42 -0600 Subject: [PATCH 03/25] export patchdb types --- core/Cargo.lock | 452 ++++++++---------- core/models/Cargo.toml | 2 +- core/models/src/data_url.rs | 4 +- core/models/src/id/action.rs | 4 +- core/models/src/id/health_check.rs | 4 +- core/models/src/id/host.rs | 4 +- core/models/src/id/image.rs | 4 +- core/models/src/id/mod.rs | 4 +- core/models/src/id/package.rs | 1 + core/models/src/id/volume.rs | 4 +- core/startos/Cargo.toml | 2 +- core/startos/bindings/AddSslOptions.ts | 3 +- core/startos/bindings/Alerts.ts | 3 + core/startos/bindings/AllPackageData.ts | 5 + core/startos/bindings/AlpnInfo.ts | 4 + core/startos/bindings/BackupProgress.ts | 3 + core/startos/bindings/BindInfo.ts | 4 + core/startos/bindings/BindOptions.ts | 3 +- core/startos/bindings/ConnectionAddresses.ts | 3 + core/startos/bindings/CurrentDependencies.ts | 5 + .../startos/bindings/CurrentDependencyInfo.ts | 4 + core/startos/bindings/DataUrl.ts | 3 + core/startos/bindings/DepInfo.ts | 3 + core/startos/bindings/Dependencies.ts | 5 + .../bindings/DependencyConfigErrors.ts | 4 + .../startos/bindings/DependencyRequirement.ts | 2 +- core/startos/bindings/Description.ts | 3 + core/startos/bindings/Duration.ts | 3 + core/startos/bindings/ExposeUiParams.ts | 3 - core/startos/bindings/ExposedUI.ts | 3 - core/startos/bindings/FullProgress.ts | 5 + core/startos/bindings/Governor.ts | 3 + core/startos/bindings/HardwareRequirements.ts | 3 + core/startos/bindings/HealthCheckId.ts | 3 + core/startos/bindings/HealthCheckResult.ts | 3 + core/startos/bindings/Host.ts | 6 + core/startos/bindings/HostAddress.ts | 3 + core/startos/bindings/HostId.ts | 3 + core/startos/bindings/HostInfo.ts | 5 + core/startos/bindings/HostKind.ts | 3 + core/startos/bindings/ImageId.ts | 3 + core/startos/bindings/InstalledState.ts | 4 + core/startos/bindings/InstallingInfo.ts | 5 + core/startos/bindings/InstallingState.ts | 4 + core/startos/bindings/IpInfo.ts | 3 + core/startos/bindings/MainStatus.ts | 6 + core/startos/bindings/Manifest.ts | 10 + core/startos/bindings/MaybeUtf8String.ts | 3 + core/startos/bindings/NamedProgress.ts | 4 + core/startos/bindings/PackageDataEntry.ts | 8 + core/startos/bindings/PackageId.ts | 3 + core/startos/bindings/PackageState.ts | 6 + core/startos/bindings/Progress.ts | 3 + core/startos/bindings/Public.ts | 5 + core/startos/bindings/ServerInfo.ts | 16 + core/startos/bindings/ServerSpecs.ts | 3 + core/startos/bindings/ServerStatus.ts | 6 + core/startos/bindings/Status.ts | 4 +- core/startos/bindings/UpdateProgress.ts | 3 + core/startos/bindings/UpdatingState.ts | 5 + core/startos/bindings/VolumeId.ts | 3 + core/startos/bindings/WifiInfo.ts | 3 + core/startos/src/db/model/mod.rs | 1 + core/startos/src/db/model/package.rs | 102 ++-- core/startos/src/db/model/public.rs | 41 +- core/startos/src/dependencies.rs | 29 +- core/startos/src/net/host/address.rs | 9 +- core/startos/src/net/host/binding.rs | 12 +- core/startos/src/net/host/mod.rs | 10 +- core/startos/src/net/vhost.rs | 4 +- core/startos/src/progress.rs | 10 +- core/startos/src/properties.rs | 5 +- core/startos/src/s9pk/v1/manifest.rs | 27 +- core/startos/src/s9pk/v2/compat.rs | 17 +- core/startos/src/s9pk/v2/manifest.rs | 22 +- .../src/service/service_effect_handler.rs | 61 ++- core/startos/src/service/service_map.rs | 6 +- core/startos/src/status/health_check.rs | 3 +- core/startos/src/status/mod.rs | 17 +- core/startos/src/util/cpupower.rs | 6 +- core/startos/src/util/serde.rs | 7 +- 81 files changed, 646 insertions(+), 441 deletions(-) create mode 100644 core/startos/bindings/Alerts.ts create mode 100644 core/startos/bindings/AllPackageData.ts create mode 100644 core/startos/bindings/AlpnInfo.ts create mode 100644 core/startos/bindings/BackupProgress.ts create mode 100644 core/startos/bindings/BindInfo.ts create mode 100644 core/startos/bindings/ConnectionAddresses.ts create mode 100644 core/startos/bindings/CurrentDependencies.ts create mode 100644 core/startos/bindings/CurrentDependencyInfo.ts create mode 100644 core/startos/bindings/DataUrl.ts create mode 100644 core/startos/bindings/DepInfo.ts create mode 100644 core/startos/bindings/Dependencies.ts create mode 100644 core/startos/bindings/DependencyConfigErrors.ts create mode 100644 core/startos/bindings/Description.ts create mode 100644 core/startos/bindings/Duration.ts delete mode 100644 core/startos/bindings/ExposeUiParams.ts delete mode 100644 core/startos/bindings/ExposedUI.ts create mode 100644 core/startos/bindings/FullProgress.ts create mode 100644 core/startos/bindings/Governor.ts create mode 100644 core/startos/bindings/HardwareRequirements.ts create mode 100644 core/startos/bindings/HealthCheckId.ts create mode 100644 core/startos/bindings/HealthCheckResult.ts create mode 100644 core/startos/bindings/Host.ts create mode 100644 core/startos/bindings/HostAddress.ts create mode 100644 core/startos/bindings/HostId.ts create mode 100644 core/startos/bindings/HostInfo.ts create mode 100644 core/startos/bindings/HostKind.ts create mode 100644 core/startos/bindings/ImageId.ts create mode 100644 core/startos/bindings/InstalledState.ts create mode 100644 core/startos/bindings/InstallingInfo.ts create mode 100644 core/startos/bindings/InstallingState.ts create mode 100644 core/startos/bindings/IpInfo.ts create mode 100644 core/startos/bindings/MainStatus.ts create mode 100644 core/startos/bindings/Manifest.ts create mode 100644 core/startos/bindings/MaybeUtf8String.ts create mode 100644 core/startos/bindings/NamedProgress.ts create mode 100644 core/startos/bindings/PackageDataEntry.ts create mode 100644 core/startos/bindings/PackageId.ts create mode 100644 core/startos/bindings/PackageState.ts create mode 100644 core/startos/bindings/Progress.ts create mode 100644 core/startos/bindings/Public.ts create mode 100644 core/startos/bindings/ServerInfo.ts create mode 100644 core/startos/bindings/ServerSpecs.ts create mode 100644 core/startos/bindings/ServerStatus.ts create mode 100644 core/startos/bindings/UpdateProgress.ts create mode 100644 core/startos/bindings/UpdatingState.ts create mode 100644 core/startos/bindings/VolumeId.ts create mode 100644 core/startos/bindings/WifiInfo.ts diff --git a/core/Cargo.lock b/core/Cargo.lock index 24a641819..602c16ae3 100644 --- a/core/Cargo.lock +++ b/core/Cargo.lock @@ -62,9 +62,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] @@ -155,9 +155,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.80" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ad32ce52e4161730f7098c077cd2ed6229b5804ccf99e5366be1ab72a98b4e1" +checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" [[package]] name = "arrayref" @@ -224,18 +224,18 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] name = "async-trait" -version = "0.1.77" +version = "0.1.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" +checksum = "a507401cad91ec6a857ed5513a2073c82a9b9048762b885bb98655b306964681" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -247,16 +247,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "atomic-write-file" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8204db279bf648d64fe845bd8840f78b39c8132ed4d6a4194c3b10d4b4cfb0b" -dependencies = [ - "nix 0.28.0", - "rand 0.8.5", -] - [[package]] name = "atty" version = "0.2.14" @@ -270,9 +260,9 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "axum" @@ -296,7 +286,7 @@ dependencies = [ "pin-project-lite", "rustversion", "serde", - "sync_wrapper", + "sync_wrapper 0.1.2", "tower", "tower-layer", "tower-service", @@ -304,9 +294,9 @@ dependencies = [ [[package]] name = "axum" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1236b4b292f6c4d6dc34604bb5120d85c3fe1d1aa596bd5cc52ca054d13e7b9e" +checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf" dependencies = [ "async-trait", "axum-core 0.4.3", @@ -330,7 +320,7 @@ dependencies = [ "serde_path_to_error", "serde_urlencoded", "sha1", - "sync_wrapper", + "sync_wrapper 1.0.0", "tokio", "tokio-tungstenite", "tower", @@ -371,7 +361,7 @@ dependencies = [ "mime", "pin-project-lite", "rustversion", - "sync_wrapper", + "sync_wrapper 0.1.2", "tower-layer", "tower-service", "tracing", @@ -398,9 +388,9 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.69" +version = "0.3.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" dependencies = [ "addr2line", "cc", @@ -478,9 +468,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" dependencies = [ "serde", ] @@ -516,9 +506,9 @@ dependencies = [ [[package]] name = "blake3" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0231f06152bf547e9c2b5194f247cd97aacf6dcd8b15d8e5ec0663f64580da87" +checksum = "30cca6d3674597c30ddf2c587bf8d9d65c9a84d2326d941cc79c9842dfe0ef52" dependencies = [ "arrayref", "arrayvec", @@ -547,9 +537,9 @@ dependencies = [ [[package]] name = "brotli" -version = "3.4.0" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "516074a47ef4bce09577a3b379392300159ce5b1ba2e501ff1c819950066100f" +checksum = "d640d25bc63c50fb1f0b545ffd80207d2e10a4c965530809b40ba3386825c391" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -580,9 +570,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "cc" @@ -596,17 +586,11 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "cfg_aliases" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" - [[package]] name = "chrono" -version = "0.4.35" +version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eaf5903dcbc0a39312feb77df2ff4c76387d591b9fc7b04a238dcf8bb62639a" +checksum = "8a0d04d43504c61aa6c7531f1871dd0d418d91130162063b789da00fd7057a5e" dependencies = [ "android-tzdata", "iana-time-zone", @@ -689,9 +673,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.2" +version = "4.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b230ab84b0ffdf890d5a10abdbc8b83ae1c4918275daea1ab8801f71536b2651" +checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" dependencies = [ "clap_builder", "clap_derive", @@ -711,14 +695,14 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.0" +version = "4.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "307bc0538d5f0f83b8248db3087aa92fe504e4691294d0c96c0eabc33f47ba47" +checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" dependencies = [ - "heck", + "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -738,9 +722,9 @@ checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" [[package]] name = "color-eyre" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a667583cca8c4f8436db8de46ea8233c42a7d9ae424a82d338f2e4675229204" +checksum = "55146f5e46f237f7423d74111267d4597b59b0dad0ffaf7303bce9945d843ad5" dependencies = [ "backtrace", "color-spantrace", @@ -888,9 +872,9 @@ dependencies = [ [[package]] name = "cookie" -version = "0.18.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cd91cf61412820176e137621345ee43b3f4423e589e7ae4e50d601d93e35ef8" +checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747" dependencies = [ "time", "version_check", @@ -992,7 +976,7 @@ version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "crossterm_winapi", "futures-core", "libc", @@ -1114,7 +1098,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -1138,7 +1122,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.10.0", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -1149,7 +1133,7 @@ checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" dependencies = [ "darling_core", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -1401,10 +1385,10 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ffccbb6966c05b32ef8fbac435df276c4ae4d3dc55a8cd0eb9745e6c12f546a" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -1452,9 +1436,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.0.1" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984" [[package]] name = "fd-lock-rs" @@ -1477,9 +1461,9 @@ dependencies = [ [[package]] name = "fiat-crypto" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1676f435fc1dadde4d03e43f5d62b259e1ce5f40bd4ffb21db2b42ebe59c1382" +checksum = "c007b1ae3abe1cb6f85a16305acd418b7ca6343b953633fee2b76d8f108b830f" [[package]] name = "filetime" @@ -1638,7 +1622,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -1716,7 +1700,7 @@ version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8283e7331b8c93b9756e0cfdbcfb90312852f953c6faf9bf741e684cc3b6ad69" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "crc", "log", "uuid", @@ -1735,9 +1719,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" +checksum = "4fbd2820c5e49886948654ab546d0688ff24530286bdcf8fca3cefb16d4618eb" dependencies = [ "bytes", "fnv", @@ -1745,7 +1729,7 @@ dependencies = [ "futures-sink", "futures-util", "http 0.2.12", - "indexmap 2.2.5", + "indexmap 2.2.6", "slab", "tokio", "tokio-util", @@ -1754,9 +1738,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31d030e59af851932b72ceebadf4a2b5986dba4c3b99dd2493f8273a0f151943" +checksum = "51ee2dd2e4f378392eeff5d51618cd9a63166a2513846bbc55f21cfacd9199d4" dependencies = [ "bytes", "fnv", @@ -1764,7 +1748,7 @@ dependencies = [ "futures-sink", "futures-util", "http 1.1.0", - "indexmap 2.2.5", + "indexmap 2.2.6", "slab", "tokio", "tokio-util", @@ -1843,6 +1827,12 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + [[package]] name = "helpers" version = "0.1.0" @@ -1883,9 +1873,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hifijson" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85ef6b41c333e6dd2a4aaa59125a19b633cd17e7aaf372b2260809777bcdef4a" +checksum = "18ae468bcb4dfecf0e4949ee28abbc99076b6a0077f51ddbc94dbfff8e6a870c" [[package]] name = "hkdf" @@ -1959,12 +1949,12 @@ dependencies = [ [[package]] name = "http-body-util" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cb79eb393015dadd30fc252023adb0b2400a0caee0fa2a077e6e21a551e840" +checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" dependencies = [ "bytes", - "futures-util", + "futures-core", "http 1.1.0", "http-body 1.0.0", "pin-project-lite", @@ -1998,7 +1988,7 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2 0.3.24", + "h2 0.3.25", "http 0.2.12", "http-body 0.4.6", "httparse", @@ -2021,7 +2011,7 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "h2 0.4.2", + "h2 0.4.3", "http 1.1.0", "http-body 1.0.0", "httparse", @@ -2214,9 +2204,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.5" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", "hashbrown 0.14.3", @@ -2343,9 +2333,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jaq-core" @@ -2387,9 +2377,9 @@ dependencies = [ [[package]] name = "josekit" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd20997283339a19226445db97d632c8dc7adb6b8172537fe0e9e540fb141df2" +checksum = "0953340cf63354cec4a385f1fbcb3f409a5823778cae236078892f6030ed4565" dependencies = [ "anyhow", "base64", @@ -2466,7 +2456,7 @@ dependencies = [ "petgraph", "pico-args", "regex", - "regex-syntax 0.8.2", + "regex-syntax 0.8.3", "string_cache", "term", "tiny-keccak", @@ -2526,7 +2516,7 @@ version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "libc", "redox_syscall 0.4.1", ] @@ -2685,7 +2675,7 @@ dependencies = [ "tokio", "torut", "tracing", - "ts-rs 7.1.1", + "ts-rs", "yasi", ] @@ -2709,9 +2699,9 @@ dependencies = [ [[package]] name = "new_debug_unreachable" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" [[package]] name = "new_mime_guess" @@ -2754,23 +2744,11 @@ version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "cfg-if", "libc", ] -[[package]] -name = "nix" -version = "0.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4" -dependencies = [ - "bitflags 2.4.2", - "cfg-if", - "cfg_aliases", - "libc", -] - [[package]] name = "nom" version = "7.1.3" @@ -2918,7 +2896,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -2967,7 +2945,7 @@ version = "0.10.64" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "cfg-if", "foreign-types", "libc", @@ -2984,7 +2962,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -3135,7 +3113,7 @@ dependencies = [ name = "patch-db-macro-internals" version = "0.1.0" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", "syn 1.0.109", @@ -3173,7 +3151,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", - "indexmap 2.2.5", + "indexmap 2.2.6", ] [[package]] @@ -3208,7 +3186,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -3252,9 +3230,9 @@ checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "platforms" -version = "3.3.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "626dec3cac7cc0e1577a2ec3fc496277ec2baa084bebad95bb6fdbfae235f84c" +checksum = "db23d408679286588f4d4644f965003d056e3dd5abcaaa938116871d7ce2fee7" [[package]] name = "portable-atomic" @@ -3314,9 +3292,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.78" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" dependencies = [ "unicode-ident", ] @@ -3329,13 +3307,13 @@ checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf" dependencies = [ "bit-set", "bit-vec", - "bitflags 2.4.2", + "bitflags 2.5.0", "lazy_static", "num-traits", "rand 0.8.5", "rand_chacha 0.3.1", "rand_xorshift", - "regex-syntax 0.8.2", + "regex-syntax 0.8.3", "rusty-fork", "tempfile", "unarray", @@ -3372,7 +3350,7 @@ dependencies = [ "itertools 0.11.0", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -3547,14 +3525,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.3" +version = "1.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" dependencies = [ "aho-corasick", "memchr", "regex-automata 0.4.6", - "regex-syntax 0.8.2", + "regex-syntax 0.8.3", ] [[package]] @@ -3574,7 +3552,7 @@ checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.2", + "regex-syntax 0.8.3", ] [[package]] @@ -3585,15 +3563,15 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "reqwest" -version = "0.11.25" +version = "0.11.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eea5a9eb898d3783f17c6407670e3592fd174cb81a10e51d4c37f49450b9946" +checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" dependencies = [ "base64", "bytes", @@ -3602,7 +3580,7 @@ dependencies = [ "encoding_rs", "futures-core", "futures-util", - "h2 0.3.24", + "h2 0.3.25", "http 0.2.12", "http-body 0.4.6", "hyper 0.14.28", @@ -3619,7 +3597,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", - "sync_wrapper", + "sync_wrapper 0.1.2", "system-configuration", "tokio", "tokio-native-tls", @@ -3711,8 +3689,8 @@ source = "git+https://github.com/Start9Labs/rpc-toolkit.git?branch=refactor/trai dependencies = [ "async-stream", "async-trait", - "axum 0.7.4", - "clap 4.5.2", + "axum 0.7.5", + "clap 4.5.4", "futures", "http 1.1.0", "http-body-util", @@ -3835,11 +3813,11 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.31" +version = "0.38.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" +checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "errno", "libc", "linux-raw-sys", @@ -3859,9 +3837,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.22.2" +version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e87c9956bd9807afa1f77e0f7594af32566e830e088a5576d27c5b6f30f49d41" +checksum = "99008d7ad0bbbea527ec27bddbc0e432c5b87d8175178cee68d2eec9c4a1813c" dependencies = [ "log", "ring", @@ -3882,9 +3860,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.3.1" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ede67b28608b4c60685c7d54122d4400d90f62b40caee7700e700380a390fa8" +checksum = "ecd36cc4259e3e4514335c4a138c6b43171a8d61d8f5c9348f9fc7529416f247" [[package]] name = "rustls-webpki" @@ -4071,16 +4049,16 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] name = "serde_json" -version = "1.0.114" +version = "1.0.115" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" +checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd" dependencies = [ - "indexmap 2.2.5", + "indexmap 2.2.6", "itoa", "ryu", "serde", @@ -4088,9 +4066,9 @@ dependencies = [ [[package]] name = "serde_path_to_error" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebd154a240de39fdebcf5775d2675c204d7c13cf39a4c697be6493c8e734337c" +checksum = "af99884400da37c88f5e9146b7f1fd0fbcae8f6eec4e9da38b67d05486f814a6" dependencies = [ "itoa", "serde", @@ -4119,15 +4097,15 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.6.1" +version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15d167997bd841ec232f5b2b8e0e26606df2e7caa4c31b95ea9ca52b200bd270" +checksum = "ee80b0e361bbf88fd2f6e242ccd19cfda072cb0faa6ae694ecee08199938569a" dependencies = [ "base64", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.2.5", + "indexmap 2.2.6", "serde", "serde_derive", "serde_json", @@ -4137,23 +4115,23 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.6.1" +version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "865f9743393e638991566a8b7a479043c2c8da94a33e0a31f18214c9cae0a64d" +checksum = "6561dc161a9224638a31d876ccdfefbc1df91d3f3a8342eddb35f055d48c7655" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] name = "serde_yaml" -version = "0.9.32" +version = "0.9.34+deprecated" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fd075d994154d4a774f95b51fb96bdc2832b0ea48425c92546073816cda1f2f" +checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" dependencies = [ - "indexmap 2.2.5", + "indexmap 2.2.6", "itoa", "ryu", "serde", @@ -4294,9 +4272,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.13.1" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" @@ -4346,9 +4324,9 @@ dependencies = [ [[package]] name = "sqlx" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dba03c279da73694ef99763320dea58b51095dfe87d001b1d4b5fe78ba8763cf" +checksum = "c9a2ccff1a000a5a59cd33da541d9f2fdcd9e6e8229cc200565942bff36d0aaa" dependencies = [ "sqlx-core", "sqlx-macros", @@ -4359,9 +4337,9 @@ dependencies = [ [[package]] name = "sqlx-core" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d84b0a3c3739e220d94b3239fd69fb1f74bc36e16643423bd99de3b43c21bfbd" +checksum = "24ba59a9342a3d9bab6c56c118be528b27c9b60e490080e9711a04dccac83ef6" dependencies = [ "ahash 0.8.11", "atoi", @@ -4370,7 +4348,6 @@ dependencies = [ "chrono", "crc", "crossbeam-queue", - "dotenvy", "either", "event-listener", "futures-channel", @@ -4380,7 +4357,7 @@ dependencies = [ "futures-util", "hashlink", "hex", - "indexmap 2.2.5", + "indexmap 2.2.6", "log", "memchr", "once_cell", @@ -4403,9 +4380,9 @@ dependencies = [ [[package]] name = "sqlx-macros" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89961c00dc4d7dffb7aee214964b065072bff69e36ddb9e2c107541f75e4f2a5" +checksum = "4ea40e2345eb2faa9e1e5e326db8c34711317d2b5e08d0d5741619048a803127" dependencies = [ "proc-macro2", "quote", @@ -4416,14 +4393,13 @@ dependencies = [ [[package]] name = "sqlx-macros-core" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0bd4519486723648186a08785143599760f7cc81c52334a55d6a83ea1e20841" +checksum = "5833ef53aaa16d860e92123292f1f6a3d53c34ba8b1969f152ef1a7bb803f3c8" dependencies = [ - "atomic-write-file", "dotenvy", "either", - "heck", + "heck 0.4.1", "hex", "once_cell", "proc-macro2", @@ -4443,13 +4419,13 @@ dependencies = [ [[package]] name = "sqlx-mysql" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e37195395df71fd068f6e2082247891bc11e3289624bbc776a0cdfa1ca7f1ea4" +checksum = "1ed31390216d20e538e447a7a9b959e06ed9fc51c37b514b46eb758016ecd418" dependencies = [ "atoi", "base64", - "bitflags 2.4.2", + "bitflags 2.5.0", "byteorder", "bytes", "chrono", @@ -4486,13 +4462,13 @@ dependencies = [ [[package]] name = "sqlx-postgres" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6ac0ac3b7ccd10cc96c7ab29791a7dd236bd94021f31eec7ba3d46a74aa1c24" +checksum = "7c824eb80b894f926f89a0b9da0c7f435d27cdd35b8c655b114e58223918577e" dependencies = [ "atoi", "base64", - "bitflags 2.4.2", + "bitflags 2.5.0", "byteorder", "chrono", "crc", @@ -4514,7 +4490,6 @@ dependencies = [ "rand 0.8.5", "serde", "serde_json", - "sha1", "sha2 0.10.8", "smallvec", "sqlx-core", @@ -4526,9 +4501,9 @@ dependencies = [ [[package]] name = "sqlx-sqlite" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "210976b7d948c7ba9fced8ca835b11cbb2d677c59c79de41ac0d397e14547490" +checksum = "b244ef0a8414da0bed4bb1910426e890b19e5e9bccc27ada6b797d05c55ae0aa" dependencies = [ "atoi", "chrono", @@ -4571,7 +4546,7 @@ dependencies = [ "quote", "regex-syntax 0.6.29", "strsim 0.10.0", - "syn 2.0.52", + "syn 2.0.55", "unicode-width", ] @@ -4598,9 +4573,9 @@ dependencies = [ [[package]] name = "ssh-key" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01f8f4ea73476c0aa5d5e6a75ce1e8634e2c3f82005ef3bbed21547ac57f2bf7" +checksum = "3b71299a724c8d84956caaf8fc3b3ea57c3587fe2d0b800cd0dc1f3599905d7e" dependencies = [ "ed25519-dalek 2.1.1", "p256", @@ -4625,7 +4600,7 @@ dependencies = [ "async-compression", "async-stream", "async-trait", - "axum 0.7.4", + "axum 0.7.5", "axum-server", "base32", "base64", @@ -4635,11 +4610,11 @@ dependencies = [ "bytes", "chrono", "ciborium", - "clap 4.5.2", + "clap 4.5.4", "color-eyre", "console", "console-subscriber", - "cookie 0.18.0", + "cookie 0.18.1", "cookie_store", "current_platform", "digest 0.10.7", @@ -4659,7 +4634,7 @@ dependencies = [ "imbl", "imbl-value", "include_dir", - "indexmap 2.2.5", + "indexmap 2.2.6", "indicatif", "integer-encoding", "ipnet", @@ -4722,7 +4697,7 @@ dependencies = [ "tokio-tar", "tokio-tungstenite", "tokio-util", - "toml 0.8.10", + "toml 0.8.12", "torut", "tracing", "tracing-error", @@ -4730,7 +4705,7 @@ dependencies = [ "tracing-journald", "tracing-subscriber", "trust-dns-server", - "ts-rs 8.1.0", + "ts-rs", "typed-builder", "url", "urlencoding", @@ -4806,9 +4781,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.52" +version = "2.0.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07" +checksum = "002a1b3dbf967edfafc32655d0f377ab0bb7b994aa1d32c8cc7e9b8bf3ebb8f0" dependencies = [ "proc-macro2", "quote", @@ -4822,21 +4797,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" [[package]] -name = "system-configuration" -version = "0.6.0" +name = "sync_wrapper" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "658bc6ee10a9b4fcf576e9b0819d95ec16f4d2c02d39fd83ac1c8789785c4a42" +checksum = "384595c11a4e2969895cad5a8c4029115f5ab956a9e5ef4de79d11a426e5f20c" + +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" dependencies = [ - "bitflags 2.4.2", + "bitflags 1.3.2", "core-foundation", "system-configuration-sys", ] [[package]] name = "system-configuration-sys" -version = "0.6.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" dependencies = [ "core-foundation-sys", "libc", @@ -4909,22 +4890,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.57" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" +checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.57" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" +checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -5041,7 +5022,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -5060,7 +5041,7 @@ version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" dependencies = [ - "rustls 0.22.2", + "rustls 0.22.3", "rustls-pki-types", "tokio", ] @@ -5079,9 +5060,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" +checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" dependencies = [ "futures-core", "pin-project-lite", @@ -5145,14 +5126,14 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.10" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a9aad4a3066010876e8dcf5a8a06e70a558751117a145c6ce2b82c2e2054290" +checksum = "e9dd1545e8208b4a5af1aa9bbd0b4cf7e9ea08fabc5d0a5c67fcaafa17433aa3" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.6", + "toml_edit 0.22.9", ] [[package]] @@ -5170,7 +5151,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.2.5", + "indexmap 2.2.6", "serde", "serde_spanned", "toml_datetime", @@ -5183,18 +5164,18 @@ version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" dependencies = [ - "indexmap 2.2.5", + "indexmap 2.2.6", "toml_datetime", "winnow 0.5.40", ] [[package]] name = "toml_edit" -version = "0.22.6" +version = "0.22.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c1b5fd4128cc8d3e0cb74d4ed9a9cc7c7284becd4df68f5f940e1ad123606f6" +checksum = "8e40bb779c5187258fd7aad0eb68cb8706a0a81fa712fbea808ab43c4b8374c4" dependencies = [ - "indexmap 2.2.5", + "indexmap 2.2.6", "serde", "serde_spanned", "toml_datetime", @@ -5212,7 +5193,7 @@ dependencies = [ "axum 0.6.20", "base64", "bytes", - "h2 0.3.24", + "h2 0.3.25", "http 0.2.12", "http-body 0.4.6", "hyper 0.14.28", @@ -5299,7 +5280,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -5434,49 +5415,24 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" -[[package]] -name = "ts-rs" -version = "7.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc2cae1fc5d05d47aa24b64f9a4f7cba24cdc9187a2084dd97ac57bef5eccae6" -dependencies = [ - "thiserror", - "ts-rs-macros 7.1.1", -] - [[package]] name = "ts-rs" version = "8.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d3fa4606cdab1e9b668cc65ce2545941d01f52bc27536a195c66c55b91cb84" +source = "git+https://github.com/dr-bonez/ts-rs.git?branch=feature/top-level-type-override#f37e51abbf3b4afc6dc2fdea72100ed0ee463a06" dependencies = [ "thiserror", - "ts-rs-macros 8.1.0", -] - -[[package]] -name = "ts-rs-macros" -version = "7.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73f7f9b821696963053a89a7bd8b292dc34420aea8294d7b225274d488f3ec92" -dependencies = [ - "Inflector", - "proc-macro2", - "quote", - "syn 2.0.52", - "termcolor", + "ts-rs-macros", ] [[package]] name = "ts-rs-macros" version = "8.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f86ae36cbb2d58b86677ad413054feeb0712e382e822131cf9a4a1e580c419b5" +source = "git+https://github.com/dr-bonez/ts-rs.git?branch=feature/top-level-type-override#f37e51abbf3b4afc6dc2fdea72100ed0ee463a06" dependencies = [ "Inflector", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", "termcolor", ] @@ -5517,7 +5473,7 @@ checksum = "563b3b88238ec95680aef36bdece66896eaa7ce3c0f1b4f39d38fb2435261352" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -5588,9 +5544,9 @@ checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" [[package]] name = "unsafe-libyaml" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab4c90930b95a82d00dc9e9ac071b4991924390d46cbd0dfe566148667605e4b" +checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" [[package]] name = "untrusted" @@ -5630,9 +5586,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uuid" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" +checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" dependencies = [ "getrandom 0.2.12", ] @@ -5722,7 +5678,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", "wasm-bindgen-shared", ] @@ -5756,7 +5712,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -5798,9 +5754,9 @@ checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" [[package]] name = "whoami" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fec781d48b41f8163426ed18e8fc2864c12937df9ce54c88ede7bd47270893e" +checksum = "a44ab49fad634e88f55bf8f9bb3abd2f27d7204172a112c7c9987e01c1c94ea9" dependencies = [ "redox_syscall 0.4.1", "wasite", @@ -6076,7 +6032,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -6096,5 +6052,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] diff --git a/core/models/Cargo.toml b/core/models/Cargo.toml index 9f6a53443..b6a506774 100644 --- a/core/models/Cargo.toml +++ b/core/models/Cargo.toml @@ -32,7 +32,7 @@ sqlx = { version = "0.7.2", features = [ "postgres", ] } ssh-key = "0.6.2" -ts-rs = "7" +ts-rs = { git = "https://github.com/dr-bonez/ts-rs.git", branch = "feature/top-level-type-override" } # "8" thiserror = "1.0" tokio = { version = "1", features = ["full"] } torut = { git = "https://github.com/Start9Labs/torut.git", branch = "update/dependencies" } diff --git a/core/models/src/data_url.rs b/core/models/src/data_url.rs index e2141b15a..9757d7f6a 100644 --- a/core/models/src/data_url.rs +++ b/core/models/src/data_url.rs @@ -6,11 +6,13 @@ use color_eyre::eyre::eyre; use reqwest::header::CONTENT_TYPE; use serde::{Deserialize, Serialize}; use tokio::io::{AsyncRead, AsyncReadExt}; +use ts_rs::TS; use yasi::InternedString; use crate::{mime, Error, ErrorKind, ResultExt}; -#[derive(Clone)] +#[derive(Clone, TS)] +#[ts(type = "string")] pub struct DataUrl<'a> { mime: InternedString, data: Cow<'a, [u8]>, diff --git a/core/models/src/id/action.rs b/core/models/src/id/action.rs index 992c995f7..3f17048e2 100644 --- a/core/models/src/id/action.rs +++ b/core/models/src/id/action.rs @@ -2,10 +2,12 @@ use std::path::Path; use std::str::FromStr; use serde::{Deserialize, Serialize}; +use ts_rs::TS; use crate::{Id, InvalidId}; -#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, ts_rs::TS)] +#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, TS)] +#[ts(type = "string")] pub struct ActionId(Id); impl FromStr for ActionId { type Err = InvalidId; diff --git a/core/models/src/id/health_check.rs b/core/models/src/id/health_check.rs index c416ab1e6..937f31aa3 100644 --- a/core/models/src/id/health_check.rs +++ b/core/models/src/id/health_check.rs @@ -2,10 +2,12 @@ use std::path::Path; use std::str::FromStr; use serde::{Deserialize, Deserializer, Serialize}; +use ts_rs::TS; use crate::{Id, InvalidId}; -#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, ts_rs::TS)] +#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, TS)] +#[ts(type = "string")] pub struct HealthCheckId(Id); impl std::fmt::Display for HealthCheckId { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { diff --git a/core/models/src/id/host.rs b/core/models/src/id/host.rs index 6bca7d0ff..2a1595bd8 100644 --- a/core/models/src/id/host.rs +++ b/core/models/src/id/host.rs @@ -2,11 +2,13 @@ use std::path::Path; use std::str::FromStr; use serde::{Deserialize, Deserializer, Serialize}; +use ts_rs::TS; use yasi::InternedString; use crate::{Id, InvalidId}; -#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize)] +#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, TS)] +#[ts(type = "string")] pub struct HostId(Id); impl FromStr for HostId { type Err = InvalidId; diff --git a/core/models/src/id/image.rs b/core/models/src/id/image.rs index 5fd91a5a1..bbb0a601e 100644 --- a/core/models/src/id/image.rs +++ b/core/models/src/id/image.rs @@ -3,10 +3,12 @@ use std::path::Path; use std::str::FromStr; use serde::{Deserialize, Deserializer, Serialize}; +use ts_rs::TS; use crate::{Id, InvalidId, PackageId, Version}; -#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, ts_rs::TS)] +#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, TS)] +#[ts(type = "string")] pub struct ImageId(Id); impl AsRef for ImageId { fn as_ref(&self) -> &Path { diff --git a/core/models/src/id/mod.rs b/core/models/src/id/mod.rs index 29825f628..239479ed7 100644 --- a/core/models/src/id/mod.rs +++ b/core/models/src/id/mod.rs @@ -28,8 +28,8 @@ lazy_static::lazy_static! { pub static ref SYSTEM_ID: Id = Id(InternedString::intern("x_system")); } -#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Default, ts_rs::TS)] -pub struct Id(#[ts(type = "string")] InternedString); +#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] +pub struct Id(InternedString); impl TryFrom for Id { type Error = InvalidId; fn try_from(value: InternedString) -> Result { diff --git a/core/models/src/id/package.rs b/core/models/src/id/package.rs index 8f71285c6..d2665e59a 100644 --- a/core/models/src/id/package.rs +++ b/core/models/src/id/package.rs @@ -12,6 +12,7 @@ lazy_static::lazy_static! { pub static ref SYSTEM_PACKAGE_ID: PackageId = PackageId(SYSTEM_ID.clone()); } #[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash, TS)] +#[ts(type = "string")] pub struct PackageId(Id); impl FromStr for PackageId { type Err = InvalidId; diff --git a/core/models/src/id/volume.rs b/core/models/src/id/volume.rs index 16821a3cf..7425c79c6 100644 --- a/core/models/src/id/volume.rs +++ b/core/models/src/id/volume.rs @@ -2,10 +2,12 @@ use std::borrow::Borrow; use std::path::Path; use serde::{Deserialize, Deserializer, Serialize}; +use ts_rs::TS; use crate::Id; -#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, TS)] +#[ts(type = "string")] pub enum VolumeId { Backup, Custom(Id), diff --git a/core/startos/Cargo.toml b/core/startos/Cargo.toml index 8106c800b..ec4e978bf 100644 --- a/core/startos/Cargo.toml +++ b/core/startos/Cargo.toml @@ -175,7 +175,7 @@ tracing-futures = "0.2.5" tracing-journald = "0.3.0" tracing-subscriber = { version = "0.3.17", features = ["env-filter"] } trust-dns-server = "0.23.1" -ts-rs = "8.1.0" +ts-rs = { git = "https://github.com/dr-bonez/ts-rs.git", branch = "feature/top-level-type-override" } # "8.1.0" typed-builder = "0.18.0" url = { version = "2.4.1", features = ["serde"] } urlencoding = "2.1.3" diff --git a/core/startos/bindings/AddSslOptions.ts b/core/startos/bindings/AddSslOptions.ts index f0f74fe03..97035853d 100644 --- a/core/startos/bindings/AddSslOptions.ts +++ b/core/startos/bindings/AddSslOptions.ts @@ -1,3 +1,4 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { AlpnInfo } from "./AlpnInfo"; -export type AddSslOptions = { scheme: string | null, preferredExternalPort: number, addXForwardedHeaders: boolean | null, }; \ No newline at end of file +export type AddSslOptions = { scheme: string, preferredExternalPort: number, alpn: AlpnInfo, }; \ No newline at end of file diff --git a/core/startos/bindings/Alerts.ts b/core/startos/bindings/Alerts.ts new file mode 100644 index 000000000..4956bfa95 --- /dev/null +++ b/core/startos/bindings/Alerts.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type Alerts = { install: string | null, uninstall: string | null, restore: string | null, start: string | null, stop: string | null, }; \ No newline at end of file diff --git a/core/startos/bindings/AllPackageData.ts b/core/startos/bindings/AllPackageData.ts new file mode 100644 index 000000000..74827426a --- /dev/null +++ b/core/startos/bindings/AllPackageData.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { PackageDataEntry } from "./PackageDataEntry"; +import type { PackageId } from "./PackageId"; + +export type AllPackageData = { [key: PackageId]: PackageDataEntry }; \ No newline at end of file diff --git a/core/startos/bindings/AlpnInfo.ts b/core/startos/bindings/AlpnInfo.ts new file mode 100644 index 000000000..2a760d235 --- /dev/null +++ b/core/startos/bindings/AlpnInfo.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { MaybeUtf8String } from "./MaybeUtf8String"; + +export type AlpnInfo = "reflect" | { "specified": Array }; \ No newline at end of file diff --git a/core/startos/bindings/BackupProgress.ts b/core/startos/bindings/BackupProgress.ts new file mode 100644 index 000000000..4a480dc93 --- /dev/null +++ b/core/startos/bindings/BackupProgress.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type BackupProgress = { complete: boolean, }; \ No newline at end of file diff --git a/core/startos/bindings/BindInfo.ts b/core/startos/bindings/BindInfo.ts new file mode 100644 index 000000000..d42ed2d25 --- /dev/null +++ b/core/startos/bindings/BindInfo.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { BindOptions } from "./BindOptions"; + +export type BindInfo = { options: BindOptions, assignedLanPort: number | null, }; \ No newline at end of file diff --git a/core/startos/bindings/BindOptions.ts b/core/startos/bindings/BindOptions.ts index 997f2bd8b..dc8b1e5b5 100644 --- a/core/startos/bindings/BindOptions.ts +++ b/core/startos/bindings/BindOptions.ts @@ -1,5 +1,4 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { AddSslOptions } from "./AddSslOptions"; -import type { BindOptionsSecure } from "./BindOptionsSecure"; -export type BindOptions = { scheme: string | null, preferredExternalPort: number, addSsl: AddSslOptions | null, secure: BindOptionsSecure | null, }; \ No newline at end of file +export type BindOptions = { scheme: string, preferredExternalPort: number, addSsl: AddSslOptions | null, secure: boolean, ssl: boolean, }; \ No newline at end of file diff --git a/core/startos/bindings/ConnectionAddresses.ts b/core/startos/bindings/ConnectionAddresses.ts new file mode 100644 index 000000000..503bfb418 --- /dev/null +++ b/core/startos/bindings/ConnectionAddresses.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type ConnectionAddresses = { tor: Array, clearnet: Array, }; \ No newline at end of file diff --git a/core/startos/bindings/CurrentDependencies.ts b/core/startos/bindings/CurrentDependencies.ts new file mode 100644 index 000000000..55fb68501 --- /dev/null +++ b/core/startos/bindings/CurrentDependencies.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { CurrentDependencyInfo } from "./CurrentDependencyInfo"; +import type { PackageId } from "./PackageId"; + +export type CurrentDependencies = { [key: PackageId]: CurrentDependencyInfo }; \ No newline at end of file diff --git a/core/startos/bindings/CurrentDependencyInfo.ts b/core/startos/bindings/CurrentDependencyInfo.ts new file mode 100644 index 000000000..ad8d3cf36 --- /dev/null +++ b/core/startos/bindings/CurrentDependencyInfo.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { DataUrl } from "./DataUrl"; + +export type CurrentDependencyInfo = { title: string, icon: DataUrl, registry: string, versionSpec: string, } & ({ "kind": "exists" } | { "kind": "running", healthChecks: string[], }); \ No newline at end of file diff --git a/core/startos/bindings/DataUrl.ts b/core/startos/bindings/DataUrl.ts new file mode 100644 index 000000000..835512711 --- /dev/null +++ b/core/startos/bindings/DataUrl.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type DataUrl = string; \ No newline at end of file diff --git a/core/startos/bindings/DepInfo.ts b/core/startos/bindings/DepInfo.ts new file mode 100644 index 000000000..8320d83eb --- /dev/null +++ b/core/startos/bindings/DepInfo.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type DepInfo = { description: string | null, optional: boolean, }; \ No newline at end of file diff --git a/core/startos/bindings/Dependencies.ts b/core/startos/bindings/Dependencies.ts new file mode 100644 index 000000000..a84adec24 --- /dev/null +++ b/core/startos/bindings/Dependencies.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { DepInfo } from "./DepInfo"; +import type { PackageId } from "./PackageId"; + +export type Dependencies = { [key: PackageId]: DepInfo }; \ No newline at end of file diff --git a/core/startos/bindings/DependencyConfigErrors.ts b/core/startos/bindings/DependencyConfigErrors.ts new file mode 100644 index 000000000..23281aa89 --- /dev/null +++ b/core/startos/bindings/DependencyConfigErrors.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { PackageId } from "./PackageId"; + +export type DependencyConfigErrors = { [key: PackageId]: string }; \ No newline at end of file diff --git a/core/startos/bindings/DependencyRequirement.ts b/core/startos/bindings/DependencyRequirement.ts index 52bc25cd9..f6ff4aa54 100644 --- a/core/startos/bindings/DependencyRequirement.ts +++ b/core/startos/bindings/DependencyRequirement.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type DependencyRequirement = { "kind": "running", id: string, healthChecks: string[], versionSpec: string, url: string, } | { "kind": "exists", id: string, versionSpec: string, url: string, }; \ No newline at end of file +export type DependencyRequirement = { "kind": "running", id: string, healthChecks: string[], versionSpec: string, registry: string, } | { "kind": "exists", id: string, versionSpec: string, registry: string, }; \ No newline at end of file diff --git a/core/startos/bindings/Description.ts b/core/startos/bindings/Description.ts new file mode 100644 index 000000000..da4b0d1bf --- /dev/null +++ b/core/startos/bindings/Description.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type Description = { short: string, long: string, }; \ No newline at end of file diff --git a/core/startos/bindings/Duration.ts b/core/startos/bindings/Duration.ts new file mode 100644 index 000000000..ac44b7c87 --- /dev/null +++ b/core/startos/bindings/Duration.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type Duration = string; \ No newline at end of file diff --git a/core/startos/bindings/ExposeUiParams.ts b/core/startos/bindings/ExposeUiParams.ts deleted file mode 100644 index 3c2230060..000000000 --- a/core/startos/bindings/ExposeUiParams.ts +++ /dev/null @@ -1,3 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type ExposeUiParams = { "type": "object", value: {[key: string]: ExposeUiParams}, } | { "type": "string", path: string, description: string | null, masked: boolean, copyable: boolean | null, qr: boolean | null, }; \ No newline at end of file diff --git a/core/startos/bindings/ExposedUI.ts b/core/startos/bindings/ExposedUI.ts deleted file mode 100644 index bef4c8214..000000000 --- a/core/startos/bindings/ExposedUI.ts +++ /dev/null @@ -1,3 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type ExposedUI = { "type": "object", value: {[key: string]: ExposedUI}, description: string | null, } | { "type": "string", path: string, description: string | null, masked: boolean, copyable: boolean | null, qr: boolean | null, }; \ No newline at end of file diff --git a/core/startos/bindings/FullProgress.ts b/core/startos/bindings/FullProgress.ts new file mode 100644 index 000000000..0c6a96832 --- /dev/null +++ b/core/startos/bindings/FullProgress.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { NamedProgress } from "./NamedProgress"; +import type { Progress } from "./Progress"; + +export type FullProgress = { overall: Progress, phases: Array, }; \ No newline at end of file diff --git a/core/startos/bindings/Governor.ts b/core/startos/bindings/Governor.ts new file mode 100644 index 000000000..9e0bb14e2 --- /dev/null +++ b/core/startos/bindings/Governor.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type Governor = string; \ No newline at end of file diff --git a/core/startos/bindings/HardwareRequirements.ts b/core/startos/bindings/HardwareRequirements.ts new file mode 100644 index 000000000..5a28d0cbc --- /dev/null +++ b/core/startos/bindings/HardwareRequirements.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type HardwareRequirements = { device: { [key: string]: string }, ram: bigint | null, arch: Array | null, }; \ No newline at end of file diff --git a/core/startos/bindings/HealthCheckId.ts b/core/startos/bindings/HealthCheckId.ts new file mode 100644 index 000000000..d9b6b7ca8 --- /dev/null +++ b/core/startos/bindings/HealthCheckId.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type HealthCheckId = string; \ No newline at end of file diff --git a/core/startos/bindings/HealthCheckResult.ts b/core/startos/bindings/HealthCheckResult.ts new file mode 100644 index 000000000..eaba169f1 --- /dev/null +++ b/core/startos/bindings/HealthCheckResult.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type HealthCheckResult = { "result": "success" } | { "result": "disabled" } | { "result": "starting" } | { "result": "loading", message: string, } | { "result": "failure", error: string, }; \ No newline at end of file diff --git a/core/startos/bindings/Host.ts b/core/startos/bindings/Host.ts new file mode 100644 index 000000000..a08704ad2 --- /dev/null +++ b/core/startos/bindings/Host.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { BindInfo } from "./BindInfo"; +import type { HostAddress } from "./HostAddress"; +import type { HostKind } from "./HostKind"; + +export type Host = { kind: HostKind, bindings: { [key: number]: BindInfo }, addresses: Array, primary: HostAddress | null, }; \ No newline at end of file diff --git a/core/startos/bindings/HostAddress.ts b/core/startos/bindings/HostAddress.ts new file mode 100644 index 000000000..f013cb540 --- /dev/null +++ b/core/startos/bindings/HostAddress.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type HostAddress = { "kind": "onion", address: string, }; \ No newline at end of file diff --git a/core/startos/bindings/HostId.ts b/core/startos/bindings/HostId.ts new file mode 100644 index 000000000..1aef70f2a --- /dev/null +++ b/core/startos/bindings/HostId.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type HostId = string; \ No newline at end of file diff --git a/core/startos/bindings/HostInfo.ts b/core/startos/bindings/HostInfo.ts new file mode 100644 index 000000000..3d2a34f14 --- /dev/null +++ b/core/startos/bindings/HostInfo.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Host } from "./Host"; +import type { HostId } from "./HostId"; + +export type HostInfo = { [key: HostId]: Host }; \ No newline at end of file diff --git a/core/startos/bindings/HostKind.ts b/core/startos/bindings/HostKind.ts new file mode 100644 index 000000000..1ad1bd95e --- /dev/null +++ b/core/startos/bindings/HostKind.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type HostKind = "multi"; \ No newline at end of file diff --git a/core/startos/bindings/ImageId.ts b/core/startos/bindings/ImageId.ts new file mode 100644 index 000000000..9adb82d7a --- /dev/null +++ b/core/startos/bindings/ImageId.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type ImageId = string; \ No newline at end of file diff --git a/core/startos/bindings/InstalledState.ts b/core/startos/bindings/InstalledState.ts new file mode 100644 index 000000000..3608a5ba0 --- /dev/null +++ b/core/startos/bindings/InstalledState.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Manifest } from "./Manifest"; + +export type InstalledState = { manifest: Manifest, }; \ No newline at end of file diff --git a/core/startos/bindings/InstallingInfo.ts b/core/startos/bindings/InstallingInfo.ts new file mode 100644 index 000000000..c3d13c984 --- /dev/null +++ b/core/startos/bindings/InstallingInfo.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { FullProgress } from "./FullProgress"; +import type { Manifest } from "./Manifest"; + +export type InstallingInfo = { newManifest: Manifest, progress: FullProgress, }; \ No newline at end of file diff --git a/core/startos/bindings/InstallingState.ts b/core/startos/bindings/InstallingState.ts new file mode 100644 index 000000000..b7cfea14c --- /dev/null +++ b/core/startos/bindings/InstallingState.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { InstallingInfo } from "./InstallingInfo"; + +export type InstallingState = { installingInfo: InstallingInfo, }; \ No newline at end of file diff --git a/core/startos/bindings/IpInfo.ts b/core/startos/bindings/IpInfo.ts new file mode 100644 index 000000000..756d87219 --- /dev/null +++ b/core/startos/bindings/IpInfo.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type IpInfo = { ipv4Range: string | null, ipv4: string | null, ipv6Range: string | null, ipv6: string | null, }; \ No newline at end of file diff --git a/core/startos/bindings/MainStatus.ts b/core/startos/bindings/MainStatus.ts new file mode 100644 index 000000000..25482e113 --- /dev/null +++ b/core/startos/bindings/MainStatus.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Duration } from "./Duration"; +import type { HealthCheckId } from "./HealthCheckId"; +import type { HealthCheckResult } from "./HealthCheckResult"; + +export type MainStatus = { "status": "stopped" } | { "status": "restarting" } | { "status": "stopping", timeout: Duration, } | { "status": "starting" } | { "status": "running", started: string, health: { [key: HealthCheckId]: HealthCheckResult }, } | { "status": "backingUp", started: string | null, health: { [key: HealthCheckId]: HealthCheckResult }, }; \ No newline at end of file diff --git a/core/startos/bindings/Manifest.ts b/core/startos/bindings/Manifest.ts new file mode 100644 index 000000000..0eb91251b --- /dev/null +++ b/core/startos/bindings/Manifest.ts @@ -0,0 +1,10 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Alerts } from "./Alerts"; +import type { Dependencies } from "./Dependencies"; +import type { Description } from "./Description"; +import type { HardwareRequirements } from "./HardwareRequirements"; +import type { ImageId } from "./ImageId"; +import type { PackageId } from "./PackageId"; +import type { VolumeId } from "./VolumeId"; + +export type Manifest = { id: PackageId, title: string, version: string, releaseNotes: string, license: string, replaces: Array, wrapperRepo: string, upstreamRepo: string, supportSite: string, marketingSite: string, donationUrl: string | null, description: Description, images: Array, assets: Array, volumes: Array, alerts: Alerts, dependencies: Dependencies, hardwareRequirements: HardwareRequirements, gitHash: string | null, osVersion: string, hasConfig: boolean, }; \ No newline at end of file diff --git a/core/startos/bindings/MaybeUtf8String.ts b/core/startos/bindings/MaybeUtf8String.ts new file mode 100644 index 000000000..6674a135b --- /dev/null +++ b/core/startos/bindings/MaybeUtf8String.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type MaybeUtf8String = string | number[]; \ No newline at end of file diff --git a/core/startos/bindings/NamedProgress.ts b/core/startos/bindings/NamedProgress.ts new file mode 100644 index 000000000..1e4c45093 --- /dev/null +++ b/core/startos/bindings/NamedProgress.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Progress } from "./Progress"; + +export type NamedProgress = { name: string, progress: Progress, }; \ No newline at end of file diff --git a/core/startos/bindings/PackageDataEntry.ts b/core/startos/bindings/PackageDataEntry.ts new file mode 100644 index 000000000..100e38ba7 --- /dev/null +++ b/core/startos/bindings/PackageDataEntry.ts @@ -0,0 +1,8 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { CurrentDependencies } from "./CurrentDependencies"; +import type { DataUrl } from "./DataUrl"; +import type { HostInfo } from "./HostInfo"; +import type { PackageState } from "./PackageState"; +import type { Status } from "./Status"; + +export type PackageDataEntry = { stateInfo: PackageState, status: Status, marketplaceUrl: string | null, developerKey: string, icon: DataUrl, lastBackup: string | null, currentDependencies: CurrentDependencies, hosts: HostInfo, storeExposedDependents: string[], }; \ No newline at end of file diff --git a/core/startos/bindings/PackageId.ts b/core/startos/bindings/PackageId.ts new file mode 100644 index 000000000..fcf62f5e2 --- /dev/null +++ b/core/startos/bindings/PackageId.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type PackageId = string; \ No newline at end of file diff --git a/core/startos/bindings/PackageState.ts b/core/startos/bindings/PackageState.ts new file mode 100644 index 000000000..4aa0c1d97 --- /dev/null +++ b/core/startos/bindings/PackageState.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { InstalledState } from "./InstalledState"; +import type { InstallingState } from "./InstallingState"; +import type { UpdatingState } from "./UpdatingState"; + +export type PackageState = { "state": "installing" } & InstallingState | { "state": "restoring" } & InstallingState | { "state": "updating" } & UpdatingState | { "state": "installed" } & InstalledState | { "state": "removing" } & InstalledState; \ No newline at end of file diff --git a/core/startos/bindings/Progress.ts b/core/startos/bindings/Progress.ts new file mode 100644 index 000000000..d522dee5a --- /dev/null +++ b/core/startos/bindings/Progress.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type Progress = boolean | { done: bigint, total: bigint | null, }; \ No newline at end of file diff --git a/core/startos/bindings/Public.ts b/core/startos/bindings/Public.ts new file mode 100644 index 000000000..c913d8493 --- /dev/null +++ b/core/startos/bindings/Public.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { AllPackageData } from "./AllPackageData"; +import type { ServerInfo } from "./ServerInfo"; + +export type Public = { serverInfo: ServerInfo, packageData: AllPackageData, ui: any, }; \ No newline at end of file diff --git a/core/startos/bindings/ServerInfo.ts b/core/startos/bindings/ServerInfo.ts new file mode 100644 index 000000000..ee8e55157 --- /dev/null +++ b/core/startos/bindings/ServerInfo.ts @@ -0,0 +1,16 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ConnectionAddresses } from "./ConnectionAddresses"; +import type { Governor } from "./Governor"; +import type { IpInfo } from "./IpInfo"; +import type { ServerStatus } from "./ServerStatus"; +import type { WifiInfo } from "./WifiInfo"; + +export type ServerInfo = { arch: string, platform: string, id: string, hostname: string, version: string, lastBackup: string | null, +/** + * Used in the wifi to determine the region to set the system to + */ +lastWifiRegion: string | null, eosVersionCompat: string, lanAddress: string, onionAddress: string, +/** + * for backwards compatibility + */ +torAddress: string, ipInfo: { [key: string]: IpInfo }, statusInfo: ServerStatus, wifi: WifiInfo, unreadNotificationCount: bigint, connectionAddresses: ConnectionAddresses, passwordHash: string, pubkey: string, caFingerprint: string, ntpSynced: boolean, zram: boolean, governor: Governor | null, }; \ No newline at end of file diff --git a/core/startos/bindings/ServerSpecs.ts b/core/startos/bindings/ServerSpecs.ts new file mode 100644 index 000000000..ec464c8df --- /dev/null +++ b/core/startos/bindings/ServerSpecs.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type ServerSpecs = { cpu: string, disk: string, memory: string, }; \ No newline at end of file diff --git a/core/startos/bindings/ServerStatus.ts b/core/startos/bindings/ServerStatus.ts new file mode 100644 index 000000000..0d31f74ea --- /dev/null +++ b/core/startos/bindings/ServerStatus.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { BackupProgress } from "./BackupProgress"; +import type { PackageId } from "./PackageId"; +import type { UpdateProgress } from "./UpdateProgress"; + +export type ServerStatus = { backupProgress: { [key: PackageId]: BackupProgress } | null, updated: boolean, updateProgress: UpdateProgress | null, shuttingDown: boolean, restarting: boolean, }; \ No newline at end of file diff --git a/core/startos/bindings/Status.ts b/core/startos/bindings/Status.ts index fdfaea244..73894287a 100644 --- a/core/startos/bindings/Status.ts +++ b/core/startos/bindings/Status.ts @@ -1,3 +1,5 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { DependencyConfigErrors } from "./DependencyConfigErrors"; +import type { MainStatus } from "./MainStatus"; -export type Status = "running" | "stopped"; \ No newline at end of file +export type Status = { configured: boolean, main: MainStatus, dependencyConfigErrors: DependencyConfigErrors, }; \ No newline at end of file diff --git a/core/startos/bindings/UpdateProgress.ts b/core/startos/bindings/UpdateProgress.ts new file mode 100644 index 000000000..ad9750196 --- /dev/null +++ b/core/startos/bindings/UpdateProgress.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type UpdateProgress = { size: bigint | null, downloaded: bigint, }; \ No newline at end of file diff --git a/core/startos/bindings/UpdatingState.ts b/core/startos/bindings/UpdatingState.ts new file mode 100644 index 000000000..ce994ce33 --- /dev/null +++ b/core/startos/bindings/UpdatingState.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { InstallingInfo } from "./InstallingInfo"; +import type { Manifest } from "./Manifest"; + +export type UpdatingState = { manifest: Manifest, installingInfo: InstallingInfo, }; \ No newline at end of file diff --git a/core/startos/bindings/VolumeId.ts b/core/startos/bindings/VolumeId.ts new file mode 100644 index 000000000..b5e798c8b --- /dev/null +++ b/core/startos/bindings/VolumeId.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type VolumeId = string; \ No newline at end of file diff --git a/core/startos/bindings/WifiInfo.ts b/core/startos/bindings/WifiInfo.ts new file mode 100644 index 000000000..e1debf26b --- /dev/null +++ b/core/startos/bindings/WifiInfo.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type WifiInfo = { ssids: Array, selected: string | null, connected: string | null, }; \ No newline at end of file diff --git a/core/startos/src/db/model/mod.rs b/core/startos/src/db/model/mod.rs index cae1bfe51..9be0f8b68 100644 --- a/core/startos/src/db/model/mod.rs +++ b/core/startos/src/db/model/mod.rs @@ -2,6 +2,7 @@ use std::collections::BTreeMap; use patch_db::HasModel; use serde::{Deserialize, Serialize}; +use ts_rs::TS; use crate::account::AccountInfo; use crate::auth::Sessions; diff --git a/core/startos/src/db/model/package.rs b/core/startos/src/db/model/package.rs index fc3c2751c..641b0b56d 100644 --- a/core/startos/src/db/model/package.rs +++ b/core/startos/src/db/model/package.rs @@ -10,13 +10,15 @@ use reqwest::Url; use serde::{Deserialize, Serialize}; use ts_rs::TS; +use crate::net::host::HostInfo; use crate::prelude::*; use crate::progress::FullProgress; use crate::s9pk::manifest::Manifest; use crate::status::Status; -use crate::{net::host::HostInfo, util::serde::Pem}; +use crate::util::serde::Pem; -#[derive(Debug, Default, Deserialize, Serialize)] +#[derive(Debug, Default, Deserialize, Serialize, TS)] +#[ts(export)] pub struct AllPackageData(pub BTreeMap); impl Map for AllPackageData { type Key = PackageId; @@ -35,10 +37,11 @@ pub enum ManifestPreference { New, } -#[derive(Debug, Deserialize, Serialize, HasModel)] +#[derive(Debug, Deserialize, Serialize, HasModel, TS)] #[serde(rename_all = "camelCase")] #[serde(tag = "state")] #[model = "Model"] +#[ts(export)] pub enum PackageState { Installing(InstallingState), Restoring(InstallingState), @@ -257,51 +260,57 @@ impl Model { } } -#[derive(Debug, Deserialize, Serialize, HasModel)] +#[derive(Debug, Deserialize, Serialize, HasModel, TS)] #[serde(rename_all = "camelCase")] #[model = "Model"] +#[ts(export)] pub struct InstallingState { pub installing_info: InstallingInfo, } -#[derive(Debug, Deserialize, Serialize, HasModel)] +#[derive(Debug, Deserialize, Serialize, HasModel, TS)] #[serde(rename_all = "camelCase")] #[model = "Model"] +#[ts(export)] pub struct UpdatingState { pub manifest: Manifest, pub installing_info: InstallingInfo, } -#[derive(Debug, Deserialize, Serialize, HasModel)] +#[derive(Debug, Deserialize, Serialize, HasModel, TS)] #[serde(rename_all = "camelCase")] #[model = "Model"] +#[ts(export)] pub struct InstalledState { pub manifest: Manifest, } -#[derive(Debug, Deserialize, Serialize, HasModel)] +#[derive(Debug, Deserialize, Serialize, HasModel, TS)] #[serde(rename_all = "camelCase")] #[model = "Model"] +#[ts(export)] pub struct InstallingInfo { pub new_manifest: Manifest, pub progress: FullProgress, } -#[derive(Debug, Deserialize, Serialize, HasModel)] +#[derive(Debug, Deserialize, Serialize, HasModel, TS)] #[serde(rename_all = "camelCase")] #[model = "Model"] +#[ts(export)] pub struct PackageDataEntry { pub state_info: PackageState, pub status: Status, + #[ts(type = "string | null")] pub marketplace_url: Option, + #[ts(type = "string")] pub developer_key: Pem, pub icon: DataUrl<'static>, + #[ts(type = "string | null")] pub last_backup: Option>, - pub dependency_info: BTreeMap, pub current_dependencies: CurrentDependencies, - pub interface_addresses: InterfaceAddressMap, pub hosts: HostInfo, - pub store_exposed_ui: StoreExposedUI, + #[ts(type = "string[]")] pub store_exposed_dependents: Vec, } impl AsRef for PackageDataEntry { @@ -310,52 +319,8 @@ impl AsRef for PackageDataEntry { } } -#[derive(Debug, Deserialize, Serialize, HasModel)] -#[model = "Model"] -pub struct ExposedDependent { - path: String, - title: String, - description: Option, - masked: Option, - copyable: Option, - qr: Option, -} -#[derive(Default, Debug, Clone, serde::Serialize, serde::Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct StoreExposedUI(pub BTreeMap); - -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, TS)] -#[serde(rename_all = "camelCase")] -#[serde(tag = "type")] +#[derive(Debug, Clone, Default, Deserialize, Serialize, TS)] #[ts(export)] -pub enum ExposedUI { - Object { - #[ts(type = "{[key: string]: ExposedUI}")] - value: BTreeMap, - #[serde(default)] - #[ts(type = "string | null")] - description: String, - }, - String { - #[ts(type = "string")] - path: JsonPointer, - description: Option, - masked: bool, - copyable: Option, - qr: Option, - }, -} - -impl Default for ExposedUI { - fn default() -> Self { - ExposedUI::Object { - value: BTreeMap::new(), - description: "".to_string(), - } - } -} - -#[derive(Debug, Clone, Default, Deserialize, Serialize)] pub struct CurrentDependencies(pub BTreeMap); impl CurrentDependencies { pub fn map( @@ -379,31 +344,26 @@ impl Map for CurrentDependencies { } } -#[derive(Debug, Deserialize, Serialize, HasModel)] +#[derive(Clone, Debug, Deserialize, Serialize, TS)] #[serde(rename_all = "camelCase")] -#[model = "Model"] -pub struct StaticDependencyInfo { +pub struct CurrentDependencyInfo { + #[serde(flatten)] + pub kind: CurrentDependencyKind, pub title: String, pub icon: DataUrl<'static>, + #[ts(type = "string")] + pub registry: Url, + #[ts(type = "string")] + pub version_spec: VersionRange, } #[derive(Clone, Debug, Deserialize, Serialize, TS)] #[serde(rename_all = "camelCase")] #[serde(tag = "kind")] -pub enum CurrentDependencyInfo { - #[serde(rename_all = "camelCase")] - Exists { - #[ts(type = "string")] - url: Url, - #[ts(type = "string")] - version_spec: VersionRange, - }, +pub enum CurrentDependencyKind { + Exists, #[serde(rename_all = "camelCase")] Running { - #[ts(type = "string")] - url: Url, - #[ts(type = "string")] - version_spec: VersionRange, #[serde(default)] #[ts(type = "string[]")] health_checks: BTreeSet, diff --git a/core/startos/src/db/model/public.rs b/core/startos/src/db/model/public.rs index d618f8d33..ea8a3ac3d 100644 --- a/core/startos/src/db/model/public.rs +++ b/core/startos/src/db/model/public.rs @@ -13,6 +13,7 @@ use patch_db::{HasModel, Value}; use reqwest::Url; use serde::{Deserialize, Serialize}; use torut::onion::OnionAddressV3; +use ts_rs::TS; use crate::account::AccountInfo; use crate::db::model::package::AllPackageData; @@ -23,13 +24,14 @@ use crate::util::Version; use crate::version::{Current, VersionT}; use crate::{ARCH, PLATFORM}; -#[derive(Debug, Deserialize, Serialize, HasModel)] +#[derive(Debug, Deserialize, Serialize, HasModel, TS)] #[serde(rename_all = "camelCase")] #[model = "Model"] -// #[macro_debug] +#[ts(export)] pub struct Public { pub server_info: ServerInfo, pub package_data: AllPackageData, + #[ts(type = "any")] pub ui: Value, } impl Public { @@ -101,24 +103,34 @@ fn get_platform() -> InternedString { (&*PLATFORM).into() } -#[derive(Debug, Deserialize, Serialize, HasModel)] +#[derive(Debug, Deserialize, Serialize, HasModel, TS)] #[serde(rename_all = "camelCase")] #[model = "Model"] +#[ts(export)] pub struct ServerInfo { #[serde(default = "get_arch")] + #[ts(type = "string")] pub arch: InternedString, #[serde(default = "get_platform")] + #[ts(type = "string")] pub platform: InternedString, pub id: String, pub hostname: String, + #[ts(type = "string")] pub version: Version, + #[ts(type = "string | null")] pub last_backup: Option>, /// Used in the wifi to determine the region to set the system to + #[ts(type = "string | null")] pub last_wifi_region: Option, + #[ts(type = "string")] pub eos_version_compat: VersionRange, + #[ts(type = "string")] pub lan_address: Url, + #[ts(type = "string")] pub onion_address: OnionAddressV3, /// for backwards compatibility + #[ts(type = "string")] pub tor_address: Url, pub ip_info: BTreeMap, #[serde(default)] @@ -136,12 +148,15 @@ pub struct ServerInfo { pub governor: Option, } -#[derive(Debug, Deserialize, Serialize, HasModel)] +#[derive(Debug, Deserialize, Serialize, HasModel, TS)] #[serde(rename_all = "camelCase")] #[model = "Model"] +#[ts(export)] pub struct IpInfo { + #[ts(type = "string | null")] pub ipv4_range: Option, pub ipv4: Option, + #[ts(type = "string | null")] pub ipv6_range: Option, pub ipv6: Option, } @@ -158,15 +173,17 @@ impl IpInfo { } } -#[derive(Debug, Default, Deserialize, Serialize, HasModel)] +#[derive(Debug, Default, Deserialize, Serialize, HasModel, TS)] #[model = "Model"] +#[ts(export)] pub struct BackupProgress { pub complete: bool, } -#[derive(Debug, Default, Deserialize, Serialize, HasModel)] +#[derive(Debug, Default, Deserialize, Serialize, HasModel, TS)] #[serde(rename_all = "camelCase")] #[model = "Model"] +#[ts(export)] pub struct ServerStatus { pub backup_progress: Option>, pub updated: bool, @@ -177,33 +194,37 @@ pub struct ServerStatus { pub restarting: bool, } -#[derive(Debug, Deserialize, Serialize, HasModel)] +#[derive(Debug, Deserialize, Serialize, HasModel, TS)] #[serde(rename_all = "camelCase")] #[model = "Model"] +#[ts(export)] pub struct UpdateProgress { pub size: Option, pub downloaded: u64, } -#[derive(Debug, Deserialize, Serialize, HasModel)] +#[derive(Debug, Deserialize, Serialize, HasModel, TS)] #[serde(rename_all = "camelCase")] #[model = "Model"] +#[ts(export)] pub struct WifiInfo { pub ssids: Vec, pub selected: Option, pub connected: Option, } -#[derive(Debug, Deserialize, Serialize)] +#[derive(Debug, Deserialize, Serialize, TS)] #[serde(rename_all = "camelCase")] +#[ts(export)] pub struct ServerSpecs { pub cpu: String, pub disk: String, pub memory: String, } -#[derive(Debug, Deserialize, Serialize)] +#[derive(Debug, Deserialize, Serialize, TS)] #[serde(rename_all = "camelCase")] +#[ts(export)] pub struct ConnectionAddresses { pub tor: Vec, pub clearnet: Vec, diff --git a/core/startos/src/dependencies.rs b/core/startos/src/dependencies.rs index ca40bf432..d973688e9 100644 --- a/core/startos/src/dependencies.rs +++ b/core/startos/src/dependencies.rs @@ -2,18 +2,16 @@ use std::collections::BTreeMap; use std::time::Duration; use clap::Parser; -use emver::VersionRange; -use models::{OptionExt, PackageId}; +use models::PackageId; use rpc_toolkit::{command, from_fn_async, Empty, HandlerExt, ParentHandler}; use serde::{Deserialize, Serialize}; use tracing::instrument; +use ts_rs::TS; use crate::config::{Config, ConfigSpec, ConfigureContext}; use crate::context::RpcContext; use crate::db::model::package::CurrentDependencies; -use crate::db::model::Database; use crate::prelude::*; -use crate::s9pk::manifest::Manifest; use crate::status::DependencyConfigErrors; use crate::Error; @@ -21,8 +19,9 @@ pub fn dependency() -> ParentHandler { ParentHandler::new().subcommand("configure", configure()) } -#[derive(Clone, Debug, Default, Deserialize, Serialize, HasModel)] +#[derive(Clone, Debug, Default, Deserialize, Serialize, HasModel, TS)] #[model = "Model"] +#[ts(export)] pub struct Dependencies(pub BTreeMap); impl Map for Dependencies { type Key = PackageId; @@ -35,27 +34,13 @@ impl Map for Dependencies { } } -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -#[serde(tag = "type")] -pub enum DependencyRequirement { - OptIn { how: String }, - OptOut { how: String }, - Required, -} -impl DependencyRequirement { - pub fn required(&self) -> bool { - matches!(self, &DependencyRequirement::Required) - } -} - -#[derive(Clone, Debug, Deserialize, Serialize, HasModel)] +#[derive(Clone, Debug, Deserialize, Serialize, HasModel, TS)] #[serde(rename_all = "camelCase")] #[model = "Model"] +#[ts(export)] pub struct DepInfo { - pub version: VersionRange, - pub requirement: DependencyRequirement, pub description: Option, + pub optional: bool, } #[derive(Deserialize, Serialize, Parser)] diff --git a/core/startos/src/net/host/address.rs b/core/startos/src/net/host/address.rs index 6f3ff6df2..cb3b485f6 100644 --- a/core/startos/src/net/host/address.rs +++ b/core/startos/src/net/host/address.rs @@ -1,9 +1,14 @@ use serde::{Deserialize, Serialize}; use torut::onion::OnionAddressV3; +use ts_rs::TS; -#[derive(Debug, Deserialize, Serialize, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Debug, Deserialize, Serialize, PartialEq, Eq, PartialOrd, Ord, TS)] #[serde(rename_all = "camelCase")] #[serde(tag = "kind")] +#[ts(export)] pub enum HostAddress { - Onion { address: OnionAddressV3 }, + Onion { + #[ts(type = "string")] + address: OnionAddressV3, + }, } diff --git a/core/startos/src/net/host/binding.rs b/core/startos/src/net/host/binding.rs index 0584b517b..aa689b717 100644 --- a/core/startos/src/net/host/binding.rs +++ b/core/startos/src/net/host/binding.rs @@ -1,12 +1,14 @@ use imbl_value::InternedString; use serde::{Deserialize, Serialize}; +use ts_rs::TS; use crate::net::forward::AvailablePorts; use crate::net::vhost::AlpnInfo; use crate::prelude::*; -#[derive(Debug, Deserialize, Serialize)] +#[derive(Debug, Deserialize, Serialize, TS)] #[serde(rename_all = "camelCase")] +#[ts(export)] pub struct BindInfo { pub options: BindOptions, pub assigned_lan_port: Option, @@ -49,9 +51,11 @@ impl BindInfo { } } -#[derive(Debug, Deserialize, Serialize)] +#[derive(Debug, Deserialize, Serialize, TS)] #[serde(rename_all = "camelCase")] +#[ts(export)] pub struct BindOptions { + #[ts(type = "string")] pub scheme: InternedString, pub preferred_external_port: u16, pub add_ssl: Option, @@ -59,9 +63,11 @@ pub struct BindOptions { pub ssl: bool, } -#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)] +#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq, TS)] #[serde(rename_all = "camelCase")] +#[ts(export)] pub struct AddSslOptions { + #[ts(type = "string")] pub scheme: InternedString, pub preferred_external_port: u16, // #[serde(default)] diff --git a/core/startos/src/net/host/mod.rs b/core/startos/src/net/host/mod.rs index 18b86ba0e..086840bd8 100644 --- a/core/startos/src/net/host/mod.rs +++ b/core/startos/src/net/host/mod.rs @@ -3,6 +3,7 @@ use std::collections::{BTreeMap, BTreeSet}; use imbl_value::InternedString; use models::HostId; use serde::{Deserialize, Serialize}; +use ts_rs::TS; use crate::net::forward::AvailablePorts; use crate::net::host::address::HostAddress; @@ -12,9 +13,10 @@ use crate::prelude::*; pub mod address; pub mod binding; -#[derive(Debug, Deserialize, Serialize, HasModel)] +#[derive(Debug, Deserialize, Serialize, HasModel, TS)] #[serde(rename_all = "camelCase")] #[model = "Model"] +#[ts(export)] pub struct Host { pub kind: HostKind, pub bindings: BTreeMap, @@ -37,16 +39,18 @@ impl Host { } } -#[derive(Debug, Deserialize, Serialize)] +#[derive(Debug, Deserialize, Serialize, TS)] #[serde(rename_all = "camelCase")] +#[ts(export)] pub enum HostKind { Multi, // Single, // Static, } -#[derive(Debug, Default, Deserialize, Serialize, HasModel)] +#[derive(Debug, Default, Deserialize, Serialize, HasModel, TS)] #[model = "Model"] +#[ts(export)] pub struct HostInfo(BTreeMap); impl Map for HostInfo { diff --git a/core/startos/src/net/vhost.rs b/core/startos/src/net/vhost.rs index 88cb759a0..46838ed51 100644 --- a/core/startos/src/net/vhost.rs +++ b/core/startos/src/net/vhost.rs @@ -17,6 +17,7 @@ use tokio_rustls::rustls::server::Acceptor; use tokio_rustls::rustls::{RootCertStore, ServerConfig}; use tokio_rustls::{LazyConfigAcceptor, TlsConnector}; use tracing::instrument; +use ts_rs::TS; use crate::prelude::*; use crate::util::io::{BackTrackingReader, TimeoutStream}; @@ -80,8 +81,9 @@ struct TargetInfo { connect_ssl: Result<(), AlpnInfo>, } -#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Deserialize, Serialize)] +#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Deserialize, Serialize, TS)] #[serde(rename_all = "camelCase")] +#[ts(export)] pub enum AlpnInfo { Reflect, Specified(Vec), diff --git a/core/startos/src/progress.rs b/core/startos/src/progress.rs index 38e66a419..0acdca111 100644 --- a/core/startos/src/progress.rs +++ b/core/startos/src/progress.rs @@ -9,6 +9,7 @@ use itertools::Itertools; use serde::{Deserialize, Serialize}; use tokio::io::{AsyncSeek, AsyncWrite}; use tokio::sync::{mpsc, watch}; +use ts_rs::TS; use crate::db::model::DatabaseModel; use crate::prelude::*; @@ -19,7 +20,7 @@ lazy_static::lazy_static! { static ref BYTES: ProgressStyle = ProgressStyle::with_template("{spinner} {wide_msg} [{bytes}/?] [{binary_bytes_per_sec} {elapsed}]").unwrap(); } -#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq, PartialOrd, Ord, TS)] #[serde(untagged)] pub enum Progress { Complete(bool), @@ -126,13 +127,16 @@ impl std::ops::AddAssign for Progress { } } -#[derive(Debug, Clone, Deserialize, Serialize)] +#[derive(Debug, Clone, Deserialize, Serialize, TS)] +#[ts(export)] pub struct NamedProgress { + #[ts(type = "string")] pub name: InternedString, pub progress: Progress, } -#[derive(Debug, Clone, Deserialize, Serialize)] +#[derive(Debug, Clone, Deserialize, Serialize, TS)] +#[ts(export)] pub struct FullProgress { pub overall: Progress, pub phases: Vec, diff --git a/core/startos/src/properties.rs b/core/startos/src/properties.rs index 5482bdb58..5aa8a01d4 100644 --- a/core/startos/src/properties.rs +++ b/core/startos/src/properties.rs @@ -1,13 +1,10 @@ -use std::{borrow::Borrow, collections::BTreeMap}; - use clap::Parser; -use imbl_value::{json, InOMap, InternedString, Value}; +use imbl_value::Value; use models::PackageId; use rpc_toolkit::command; use serde::{Deserialize, Serialize}; use crate::context::RpcContext; -use crate::db::model::package::{ExposedUI, StoreExposedUI}; use crate::prelude::*; use crate::Error; diff --git a/core/startos/src/s9pk/v1/manifest.rs b/core/startos/src/s9pk/v1/manifest.rs index 813ad11a6..ef346ad2b 100644 --- a/core/startos/src/s9pk/v1/manifest.rs +++ b/core/startos/src/s9pk/v1/manifest.rs @@ -1,6 +1,7 @@ use std::collections::BTreeMap; use std::path::{Path, PathBuf}; +use emver::VersionRange; use imbl_value::InOMap; pub use models::PackageId; use models::VolumeId; @@ -8,7 +9,6 @@ use serde::{Deserialize, Serialize}; use url::Url; use super::git_hash::GitHash; -use crate::dependencies::Dependencies; use crate::prelude::*; use crate::s9pk::manifest::{Alerts, Description, HardwareRequirements}; use crate::util::Version; @@ -43,7 +43,7 @@ pub struct Manifest { pub alerts: Alerts, pub volumes: BTreeMap, #[serde(default)] - pub dependencies: Dependencies, + pub dependencies: BTreeMap, pub config: Option>, #[serde(default)] @@ -53,6 +53,29 @@ pub struct Manifest { pub hardware_requirements: HardwareRequirements, } +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +#[serde(tag = "type")] +pub enum DependencyRequirement { + OptIn { how: String }, + OptOut { how: String }, + Required, +} +impl DependencyRequirement { + pub fn required(&self) -> bool { + matches!(self, &DependencyRequirement::Required) + } +} + +#[derive(Clone, Debug, Deserialize, Serialize, HasModel)] +#[serde(rename_all = "camelCase")] +#[model = "Model"] +pub struct DepInfo { + pub version: VersionRange, + pub requirement: DependencyRequirement, + pub description: Option, +} + #[derive(Clone, Debug, Default, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct Assets { diff --git a/core/startos/src/s9pk/v2/compat.rs b/core/startos/src/s9pk/v2/compat.rs index 423491e7a..5a98538dc 100644 --- a/core/startos/src/s9pk/v2/compat.rs +++ b/core/startos/src/s9pk/v2/compat.rs @@ -7,6 +7,7 @@ use tokio::fs::File; use tokio::io::{AsyncRead, AsyncSeek, AsyncWriteExt}; use tokio::process::Command; +use crate::dependencies::{DepInfo, Dependencies}; use crate::prelude::*; use crate::s9pk::manifest::Manifest; use crate::s9pk::merkle_archive::directory_contents::DirectoryContents; @@ -347,7 +348,21 @@ impl From for Manifest { .map(|(id, _)| id.clone()) .collect(), alerts: value.alerts, - dependencies: value.dependencies, + dependencies: Dependencies( + value + .dependencies + .into_iter() + .map(|(id, value)| { + ( + id, + DepInfo { + description: value.description, + optional: !value.requirement.required(), + }, + ) + }) + .collect(), + ), hardware_requirements: value.hardware_requirements, git_hash: value.git_hash, os_version: value.eos_version, diff --git a/core/startos/src/s9pk/v2/manifest.rs b/core/startos/src/s9pk/v2/manifest.rs index 119bbb466..ea4524400 100644 --- a/core/startos/src/s9pk/v2/manifest.rs +++ b/core/startos/src/s9pk/v2/manifest.rs @@ -5,6 +5,7 @@ use helpers::const_true; pub use models::PackageId; use models::{ImageId, VolumeId}; use serde::{Deserialize, Serialize}; +use ts_rs::TS; use url::Url; use crate::dependencies::Dependencies; @@ -18,21 +19,28 @@ fn current_version() -> Version { Current::new().semver().into() } -#[derive(Clone, Debug, Deserialize, Serialize, HasModel)] +#[derive(Clone, Debug, Deserialize, Serialize, HasModel, TS)] #[serde(rename_all = "camelCase")] #[model = "Model"] +#[ts(export)] pub struct Manifest { pub id: PackageId, pub title: String, + #[ts(type = "string")] pub version: Version, pub release_notes: String, pub license: String, // type of license #[serde(default)] pub replaces: Vec, + #[ts(type = "string")] pub wrapper_repo: Url, + #[ts(type = "string")] pub upstream_repo: Url, + #[ts(type = "string")] pub support_site: Url, + #[ts(type = "string")] pub marketing_site: Url, + #[ts(type = "string | null")] pub donation_url: Option, pub description: Description, pub images: Vec, @@ -45,23 +53,28 @@ pub struct Manifest { #[serde(default)] pub hardware_requirements: HardwareRequirements, #[serde(default)] + #[ts(type = "string | null")] pub git_hash: Option, #[serde(default = "current_version")] + #[ts(type = "string")] pub os_version: Version, #[serde(default = "const_true")] pub has_config: bool, } -#[derive(Clone, Debug, Default, Deserialize, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, Serialize, TS)] #[serde(rename_all = "camelCase")] +#[ts(export)] pub struct HardwareRequirements { #[serde(default)] + #[ts(type = "{ [key: string]: string }")] device: BTreeMap, ram: Option, pub arch: Option>, } -#[derive(Clone, Debug, Deserialize, Serialize)] +#[derive(Clone, Debug, Deserialize, Serialize, TS)] +#[ts(export)] pub struct Description { pub short: String, pub long: String, @@ -84,8 +97,9 @@ impl Description { } } -#[derive(Clone, Debug, Default, Deserialize, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, Serialize, TS)] #[serde(rename_all = "camelCase")] +#[ts(export)] pub struct Alerts { pub install: Option, pub uninstall: Option, diff --git a/core/startos/src/service/service_effect_handler.rs b/core/startos/src/service/service_effect_handler.rs index b3eaf365c..ed82138b1 100644 --- a/core/startos/src/service/service_effect_handler.rs +++ b/core/startos/src/service/service_effect_handler.rs @@ -20,7 +20,7 @@ use ts_rs::TS; use url::Url; use crate::db::model::package::{ - CurrentDependencies, CurrentDependencyInfo, ExposedUI, StoreExposedUI, + CurrentDependencies, CurrentDependencyInfo, CurrentDependencyKind, }; use crate::disk::mount::filesystem::idmapped::IdMapped; use crate::disk::mount::filesystem::loop_dev::LoopDev; @@ -114,7 +114,6 @@ pub fn service_effect_handler() -> ParentHandler { "exposeForDependents", from_fn_async(expose_for_dependents).no_cli(), ) - .subcommand("exposeUi", from_fn_async(expose_ui).no_cli()) .subcommand( "createOverlayedImage", from_fn_async(create_overlayed_image) @@ -699,23 +698,6 @@ async fn expose_for_dependents( Ok(()) } -async fn expose_ui(context: EffectContext, params: StoreExposedUI) -> Result<(), Error> { - let context = context.deref()?; - let package_id = context.id.clone(); - context - .ctx - .db - .mutate(|db| { - db.as_public_mut() - .as_package_data_mut() - .as_idx_mut(&package_id) - .or_not_found(&package_id)? - .as_store_exposed_ui_mut() - .ser(¶ms) - }) - .await?; - Ok(()) -} #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Parser, TS)] #[ts(export)] #[serde(rename_all = "camelCase")] @@ -1101,7 +1083,7 @@ enum DependencyRequirement { #[ts(type = "string")] version_spec: VersionRange, #[ts(type = "string")] - url: Url, + registry: Url, }, #[serde(rename_all = "camelCase")] Exists { @@ -1110,7 +1092,7 @@ enum DependencyRequirement { #[ts(type = "string")] version_spec: VersionRange, #[ts(type = "string")] - url: Url, + registry: Url, }, } // filebrowser:exists,bitcoind:running:foo+bar+baz @@ -1120,7 +1102,7 @@ impl FromStr for DependencyRequirement { match s.split_once(':') { Some((id, "e")) | Some((id, "exists")) => Ok(Self::Exists { id: id.parse()?, - url: "".parse()?, // TODO + registry: "".parse()?, // TODO version_spec: "*".parse()?, // TODO }), Some((id, rest)) => { @@ -1144,14 +1126,14 @@ impl FromStr for DependencyRequirement { Ok(Self::Running { id: id.parse()?, health_checks, - url: "".parse()?, // TODO + registry: "".parse()?, // TODO version_spec: "*".parse()?, // TODO }) } None => Ok(Self::Running { id: s.parse()?, health_checks: BTreeSet::new(), - url: "".parse()?, // TODO + registry: "".parse()?, // TODO version_spec: "*".parse()?, // TODO }), } @@ -1187,20 +1169,31 @@ async fn set_dependencies( .map(|dependency| match dependency { DependencyRequirement::Exists { id, - url, - version_spec, - } => (id, CurrentDependencyInfo::Exists { url, version_spec }), - DependencyRequirement::Running { - id, - health_checks, - url, + registry, version_spec, } => ( id, - CurrentDependencyInfo::Running { - url, + CurrentDependencyInfo { + kind: CurrentDependencyKind::Exists, + registry, version_spec, - health_checks, + icon: todo!(), + title: todo!(), + }, + ), + DependencyRequirement::Running { + id, + health_checks, + registry, + version_spec, + } => ( + id, + CurrentDependencyInfo { + kind: CurrentDependencyKind::Running { health_checks }, + registry, + version_spec, + icon: todo!(), + title: todo!(), }, ), }) diff --git a/core/startos/src/service/service_map.rs b/core/startos/src/service/service_map.rs index e56b1d7dd..1eebfced6 100644 --- a/core/startos/src/service/service_map.rs +++ b/core/startos/src/service/service_map.rs @@ -10,6 +10,7 @@ use imbl_value::InternedString; use tokio::sync::{Mutex, OwnedRwLockReadGuard, OwnedRwLockWriteGuard, RwLock}; use tracing::instrument; +use crate::context::RpcContext; use crate::db::model::package::{ InstallingInfo, InstallingState, PackageDataEntry, PackageState, UpdatingState, }; @@ -26,7 +27,7 @@ use crate::s9pk::merkle_archive::source::FileSource; use crate::s9pk::S9pk; use crate::service::{LoadDisposition, Service}; use crate::status::{MainStatus, Status}; -use crate::{context::RpcContext, util::serde::Pem}; +use crate::util::serde::Pem; pub type DownloadInstallFuture = BoxFuture<'static, Result>; pub type InstallFuture = BoxFuture<'static, Result<(), Error>>; @@ -170,11 +171,8 @@ impl ServiceMap { developer_key: Pem::new(developer_key), icon, last_backup: None, - dependency_info: Default::default(), current_dependencies: Default::default(), - interface_addresses: Default::default(), hosts: Default::default(), - store_exposed_ui: Default::default(), store_exposed_dependents: Default::default(), }, )?; diff --git a/core/startos/src/status/health_check.rs b/core/startos/src/status/health_check.rs index 7a6cb0430..c2af46490 100644 --- a/core/startos/src/status/health_check.rs +++ b/core/startos/src/status/health_check.rs @@ -1,7 +1,8 @@ pub use models::HealthCheckId; use serde::{Deserialize, Serialize}; +use ts_rs::TS; -#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] +#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq, TS)] #[serde(rename_all = "camelCase")] #[serde(tag = "result")] pub enum HealthCheckResult { diff --git a/core/startos/src/status/mod.rs b/core/startos/src/status/mod.rs index 13b0568e2..2faa90e79 100644 --- a/core/startos/src/status/mod.rs +++ b/core/startos/src/status/mod.rs @@ -4,15 +4,17 @@ use chrono::{DateTime, Utc}; use imbl::OrdMap; use models::PackageId; use serde::{Deserialize, Serialize}; +use ts_rs::TS; use self::health_check::HealthCheckId; use crate::prelude::*; use crate::status::health_check::HealthCheckResult; pub mod health_check; -#[derive(Clone, Debug, Deserialize, Serialize, HasModel)] +#[derive(Clone, Debug, Deserialize, Serialize, HasModel, TS)] #[serde(rename_all = "camelCase")] #[model = "Model"] +#[ts(export)] pub struct Status { pub configured: bool, pub main: MainStatus, @@ -20,9 +22,9 @@ pub struct Status { pub dependency_config_errors: DependencyConfigErrors, } -#[derive(Clone, Debug, Deserialize, Serialize, HasModel, Default)] -#[serde(rename_all = "camelCase")] +#[derive(Clone, Debug, Deserialize, Serialize, HasModel, Default, TS)] #[model = "Model"] +#[ts(export)] pub struct DependencyConfigErrors(pub BTreeMap); impl Map for DependencyConfigErrors { type Key = PackageId; @@ -35,22 +37,29 @@ impl Map for DependencyConfigErrors { } } -#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)] +#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq, TS)] #[serde(tag = "status")] #[serde(rename_all = "camelCase")] pub enum MainStatus { Stopped, Restarting, + #[serde(rename_all = "camelCase")] Stopping { timeout: crate::util::serde::Duration, }, Starting, + #[serde(rename_all = "camelCase")] Running { + #[ts(type = "string")] started: DateTime, + #[ts(as = "BTreeMap")] health: OrdMap, }, + #[serde(rename_all = "camelCase")] BackingUp { + #[ts(type = "string | null")] started: Option>, + #[ts(as = "BTreeMap")] health: OrdMap, }, } diff --git a/core/startos/src/util/cpupower.rs b/core/startos/src/util/cpupower.rs index cc4ac5ef4..db625f90e 100644 --- a/core/startos/src/util/cpupower.rs +++ b/core/startos/src/util/cpupower.rs @@ -3,6 +3,7 @@ use std::collections::BTreeSet; use imbl::OrdMap; use tokio::process::Command; +use ts_rs::TS; use crate::prelude::*; use crate::util::Invoke; @@ -13,7 +14,10 @@ pub const GOVERNOR_HEIRARCHY: &[Governor] = &[ Governor(Cow::Borrowed("conservative")), ]; -#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, serde::Serialize, serde::Deserialize)] +#[derive( + Debug, Clone, PartialEq, Eq, PartialOrd, Ord, serde::Serialize, serde::Deserialize, TS, +)] +#[ts(export, type = "string")] pub struct Governor(Cow<'static, str>); impl std::str::FromStr for Governor { type Err = std::convert::Infallible; diff --git a/core/startos/src/util/serde.rs b/core/startos/src/util/serde.rs index cd414f66e..2fa992abd 100644 --- a/core/startos/src/util/serde.rs +++ b/core/startos/src/util/serde.rs @@ -15,6 +15,7 @@ use serde::de::DeserializeOwned; use serde::ser::{SerializeMap, SerializeSeq}; use serde::{Deserialize, Deserializer, Serialize, Serializer}; use serde_json::Value; +use ts_rs::TS; use super::IntoDoubleEndedIterator; use crate::util::clap::FromStrParser; @@ -633,7 +634,8 @@ where } } -#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, TS)] +#[ts(export, type = "string")] pub struct Duration(std::time::Duration); impl Deref for Duration { type Target = std::time::Duration; @@ -1175,7 +1177,8 @@ impl Pem { } } -#[derive(Clone, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, TS)] +#[ts(export, type = "string | number[]")] pub struct MaybeUtf8String(pub Vec); impl std::fmt::Debug for MaybeUtf8String { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { From 9cf62f03fafdf78b213cad094c5a36bc7277ccb3 Mon Sep 17 00:00:00 2001 From: J H Date: Wed, 27 Mar 2024 15:28:54 -0600 Subject: [PATCH 04/25] Add some extra export action --- .../Systems/SystemForEmbassy/index.ts | 30 ++++++++ core/startos/src/db/model/package.rs | 25 ++++++- .../src/service/service_effect_handler.rs | 71 ++++++++++++------- 3 files changed, 98 insertions(+), 28 deletions(-) diff --git a/container-runtime/src/Adapters/Systems/SystemForEmbassy/index.ts b/container-runtime/src/Adapters/Systems/SystemForEmbassy/index.ts index fb99795cc..ade166eff 100644 --- a/container-runtime/src/Adapters/Systems/SystemForEmbassy/index.ts +++ b/container-runtime/src/Adapters/Systems/SystemForEmbassy/index.ts @@ -29,6 +29,7 @@ import { import { HostSystemStartOs } from "../../HostSystemStartOs" import { JsonPath, unNestPath } from "../../../Models/JsonPath" import { RpcResult, matchRpcResult } from "../../RpcListener" +import { InputSpec } from "@start9labs/start-sdk/cjs/sdk/lib/config/configTypes" type Optional = A | undefined | null function todo(): never { @@ -259,6 +260,35 @@ export class SystemForEmbassy implements System { ): Promise { if (previousVersion) await this.migration(effects, previousVersion) await effects.setMainStatus({ status: "stopped" }) + await this.exportActions(effects) + } + async exportActions(effects: HostSystemStartOs) { + const manifest = this.manifest + if (!manifest.actions) return + for (const [actionId, action] of Object.entries(manifest.actions)) { + const hasRunning = !!action["allowed-statuses"].find( + (x) => x === "running", + ) + const hasStopped = !!action["allowed-statuses"].find( + (x) => x === "stopped", + ) + // prettier-ignore + const allowedStatuses = hasRunning && hasStopped ? "any": + hasRunning ? "onlyRunning" : + "onlyStopped" + await effects.exportAction({ + id: actionId, + metadata: { + name: action.name, + description: action.description, + warning: action.warning || null, + input: action["input-spec"] as InputSpec, + disabled: false, + allowedStatuses, + group: null, + }, + }) + } } private async uninit( effects: HostSystemStartOs, diff --git a/core/startos/src/db/model/package.rs b/core/startos/src/db/model/package.rs index 641b0b56d..0c82bf80c 100644 --- a/core/startos/src/db/model/package.rs +++ b/core/startos/src/db/model/package.rs @@ -3,7 +3,7 @@ use std::collections::{BTreeMap, BTreeSet}; use chrono::{DateTime, Utc}; use emver::VersionRange; use imbl_value::InternedString; -use models::{DataUrl, HealthCheckId, HostId, PackageId}; +use models::{ActionId, DataUrl, HealthCheckId, HostId, PackageId}; use patch_db::json_ptr::JsonPointer; use patch_db::HasModel; use reqwest::Url; @@ -293,6 +293,28 @@ pub struct InstallingInfo { pub new_manifest: Manifest, pub progress: FullProgress, } +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, TS)] +#[ts(export)] +#[serde(rename_all = "camelCase")] +pub enum AllowedStatuses { + OnlyRunning, // onlyRunning + OnlyStopped, + Any, +} + +#[derive(Clone, Debug, Deserialize, Serialize, HasModel, TS)] +#[serde(rename_all = "camelCase")] +#[model = "Model"] +pub struct ActionMetadata { + name: String, + description: String, + warning: Option, + #[ts(type = "any")] + input: Value, + disabled: bool, + allowedStatuses: AllowedStatuses, + group: Option, +} #[derive(Debug, Deserialize, Serialize, HasModel, TS)] #[serde(rename_all = "camelCase")] @@ -312,6 +334,7 @@ pub struct PackageDataEntry { pub hosts: HostInfo, #[ts(type = "string[]")] pub store_exposed_dependents: Vec, + pub exposed_actions: BTreeMap, } impl AsRef for PackageDataEntry { fn as_ref(&self) -> &PackageDataEntry { diff --git a/core/startos/src/service/service_effect_handler.rs b/core/startos/src/service/service_effect_handler.rs index ed82138b1..7bd1c0ab8 100644 --- a/core/startos/src/service/service_effect_handler.rs +++ b/core/startos/src/service/service_effect_handler.rs @@ -20,7 +20,7 @@ use ts_rs::TS; use url::Url; use crate::db::model::package::{ - CurrentDependencies, CurrentDependencyInfo, CurrentDependencyKind, + ActionMetadata, CurrentDependencies, CurrentDependencyInfo, CurrentDependencyKind, }; use crate::disk::mount::filesystem::idmapped::IdMapped; use crate::disk::mount::filesystem::loop_dev::LoopDev; @@ -254,14 +254,6 @@ struct ListServiceInterfacesParams { struct RemoveAddressParams { id: String, } -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, TS)] -#[ts(export)] -#[serde(rename_all = "camelCase")] -enum AllowedStatuses { - OnlyRunning, // onlyRunning - OnlyStopped, - Any, -} #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, TS)] #[ts(export)] @@ -274,21 +266,9 @@ struct ExportActionParams { #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, TS)] #[ts(export)] #[serde(rename_all = "camelCase")] -struct ActionMetadata { - name: String, - description: String, - warning: Option, - disabled: bool, - #[ts(type = "{[key: string]: any}")] - input: Value, - allowed_statuses: AllowedStatuses, - group: Option, -} -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, TS)] -#[ts(export)] -#[serde(rename_all = "camelCase")] struct RemoveActionParams { - id: String, + #[ts(type = "string")] + id: ActionId, } #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, TS)] #[ts(export)] @@ -387,11 +367,48 @@ async fn list_service_interfaces( async fn remove_address(context: EffectContext, data: RemoveAddressParams) -> Result { todo!() } -async fn export_action(context: EffectContext, data: ExportActionParams) -> Result { - todo!() +async fn export_action(context: EffectContext, data: ExportActionParams) -> Result<(), Error> { + let context = context.deref()?; + let package_id = context.id.clone(); + context + .ctx + .db + .mutate(|db| { + let model = db + .as_public_mut() + .as_package_data_mut() + .as_idx_mut(&package_id) + .or_not_found(&package_id)? + .as_exposed_actions_mut(); + let mut value = model.de()?; + value + .insert(data.id, data.metadata) + .map(|_| ()) + .unwrap_or_default(); + model.ser(&value) + }) + .await?; + Ok(()) } -async fn remove_action(context: EffectContext, data: RemoveActionParams) -> Result { - todo!() +async fn remove_action(context: EffectContext, data: RemoveActionParams) -> Result<(), Error> { + let context = context.deref()?; + let package_id = context.id.clone(); + context + .ctx + .db + .mutate(|db| { + let model = db + .as_public_mut() + .as_package_data_mut() + .as_idx_mut(&package_id) + .or_not_found(&package_id)? + .as_exposed_actions_mut(); + let mut value = model.de()?; + value.remove(&data.id).map(|_| ()).unwrap_or_default(); + model.ser(&value) + }) + .await?; + Ok(()) } async fn reverse_proxy(context: EffectContext, data: ReverseProxyParams) -> Result { todo!() From f41f5ebebd18778fc3466711d77ced5af79a2306 Mon Sep 17 00:00:00 2001 From: Aiden McClelland Date: Wed, 27 Mar 2024 17:47:12 -0600 Subject: [PATCH 05/25] export patchdb ts types from rust --- Makefile | 2 +- .../bindings/ServiceInterfaceId.ts} | 2 +- core/models/src/id/mod.rs | 4 +- .../id/{address.rs => service_interface.rs} | 24 +-- .../bindings/{BindKind.ts => ActionId.ts} | 2 +- core/startos/bindings/ActionMetadata.ts | 2 +- core/startos/bindings/AddSslOptions.ts | 2 +- core/startos/bindings/AddressInfo.ts | 3 +- core/startos/bindings/BindOptions.ts | 3 +- core/startos/bindings/BindParams.ts | 7 +- .../startos/bindings/CurrentDependencyInfo.ts | 2 +- .../startos/bindings/DependencyRequirement.ts | 2 +- core/startos/bindings/ExportedHostInfo.ts | 6 + core/startos/bindings/ExportedHostnameInfo.ts | 5 + core/startos/bindings/ExportedIpHostname.ts | 3 + .../startos/bindings/ExportedOnionHostname.ts | 3 + core/startos/bindings/HealthCheckResult.ts | 2 +- core/startos/bindings/PackageDataEntry.ts | 6 +- core/startos/bindings/Progress.ts | 2 +- .../{ConnectionAddresses.ts => Security.ts} | 2 +- core/startos/bindings/ServerInfo.ts | 3 +- core/startos/bindings/ServiceInterface.ts | 6 + ...thCheckString.ts => ServiceInterfaceId.ts} | 2 +- .../bindings/ServiceInterfaceWithHostInfo.ts | 7 + core/startos/bindings/SetHealth.ts | 4 +- core/startos/bindings/UpdateProgress.ts | 2 +- core/startos/src/db/model/package.rs | 22 ++- core/startos/src/db/model/public.rs | 16 +- core/startos/src/net/host/binding.rs | 24 ++- core/startos/src/net/host/mod.rs | 2 +- core/startos/src/net/mod.rs | 1 + core/startos/src/net/net_controller.rs | 2 +- core/startos/src/net/service_interface.rs | 115 +++++++++++ core/startos/src/progress.rs | 7 +- .../src/service/service_effect_handler.rs | 127 ++++-------- core/startos/src/service/service_map.rs | 2 + core/startos/src/status/health_check.rs | 40 ++-- sdk/lib/Dependency.ts | 4 +- sdk/lib/interfaces/Host.ts | 50 ++--- sdk/lib/test/startosTypeValidation.test.ts | 2 - sdk/lib/types.ts | 32 ++- web/projects/marketplace/src/types.ts | 30 +-- .../ui/src/app/app/menu/menu.component.ts | 12 +- .../backup-select/backup-select.page.ts | 4 +- .../app-actions/app-actions.page.ts | 3 +- .../app-interfaces/app-interfaces.page.ts | 13 +- .../app-list-pkg/app-list-pkg.component.ts | 11 +- .../app-properties/app-properties.page.ts | 7 +- .../apps-routes/app-show/app-show.page.ts | 2 +- .../app-show-additional.component.ts | 2 +- .../app-show-health-checks.component.ts | 15 +- .../app-show-progress.component.ts | 2 +- .../app-show-status.component.ts | 7 +- .../app-show/pipes/health-color.pipe.ts | 14 +- .../app-show/pipes/to-buttons.pipe.ts | 2 +- .../app-show/pipes/to-health-checks.pipe.ts | 12 +- .../marketplace-show-controls.component.ts | 1 - .../backing-up/backing-up.component.html | 2 +- .../backing-up/backing-up.component.ts | 8 +- .../server-routes/sideload/sideload.page.ts | 2 +- .../ui/src/app/pages/updates/updates.page.ts | 2 +- .../install-progress/install-progress.pipe.ts | 2 +- .../app/pipes/launchable/launchable.pipe.ts | 11 +- web/projects/ui/src/app/pipes/ui/ui.pipe.ts | 2 +- .../ui/src/app/services/api/api.fixures.ts | 68 +++++-- .../ui/src/app/services/api/api.types.ts | 9 +- .../services/api/embassy-mock-api.service.ts | 40 ++-- .../ui/src/app/services/api/mock-patch.ts | 48 +++-- .../ui/src/app/services/config.service.ts | 44 ++--- .../ui/src/app/services/dep-error.service.ts | 18 +- .../src/app/services/marketplace.service.ts | 8 +- .../src/app/services/patch-db/data-model.ts | 184 +----------------- .../services/pkg-status-rendering.service.ts | 15 +- .../ui/src/app/util/get-package-data.ts | 13 +- .../ui/src/app/util/get-server-info.ts | 3 +- 75 files changed, 536 insertions(+), 634 deletions(-) rename core/{startos/bindings/BindOptionsSecure.ts => models/bindings/ServiceInterfaceId.ts} (68%) rename core/models/src/id/{address.rs => service_interface.rs} (67%) rename core/startos/bindings/{BindKind.ts => ActionId.ts} (67%) create mode 100644 core/startos/bindings/ExportedHostInfo.ts create mode 100644 core/startos/bindings/ExportedHostnameInfo.ts create mode 100644 core/startos/bindings/ExportedIpHostname.ts create mode 100644 core/startos/bindings/ExportedOnionHostname.ts rename core/startos/bindings/{ConnectionAddresses.ts => Security.ts} (56%) create mode 100644 core/startos/bindings/ServiceInterface.ts rename core/startos/bindings/{HealthCheckString.ts => ServiceInterfaceId.ts} (54%) create mode 100644 core/startos/bindings/ServiceInterfaceWithHostInfo.ts create mode 100644 core/startos/src/net/service_interface.rs diff --git a/Makefile b/Makefile index 48a28c388..f19b40b47 100644 --- a/Makefile +++ b/Makefile @@ -174,8 +174,8 @@ container-runtime/node_modules: container-runtime/package.json container-runtime touch container-runtime/node_modules core/startos/bindings: $(shell git ls-files core) $(ENVIRONMENT_FILE) $(PLATFORM_FILE) + rm -rf core/startos/bindings (cd core/ && cargo test) - touch core/startos/bindings sdk/lib/test: $(shell git ls-files sdk) core/startos/bindings (cd sdk && make test) diff --git a/core/startos/bindings/BindOptionsSecure.ts b/core/models/bindings/ServiceInterfaceId.ts similarity index 68% rename from core/startos/bindings/BindOptionsSecure.ts rename to core/models/bindings/ServiceInterfaceId.ts index c7b1b69af..87edd8694 100644 --- a/core/startos/bindings/BindOptionsSecure.ts +++ b/core/models/bindings/ServiceInterfaceId.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type BindOptionsSecure = { ssl: boolean, }; \ No newline at end of file +export type ServiceInterfaceId = string; \ No newline at end of file diff --git a/core/models/src/id/mod.rs b/core/models/src/id/mod.rs index 239479ed7..11644c71d 100644 --- a/core/models/src/id/mod.rs +++ b/core/models/src/id/mod.rs @@ -6,21 +6,21 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer}; use yasi::InternedString; mod action; -mod address; mod health_check; mod host; mod image; mod invalid_id; mod package; +mod service_interface; mod volume; pub use action::ActionId; -pub use address::AddressId; pub use health_check::HealthCheckId; pub use host::HostId; pub use image::ImageId; pub use invalid_id::InvalidId; pub use package::{PackageId, SYSTEM_PACKAGE_ID}; +pub use service_interface::ServiceInterfaceId; pub use volume::VolumeId; lazy_static::lazy_static! { diff --git a/core/models/src/id/address.rs b/core/models/src/id/service_interface.rs similarity index 67% rename from core/models/src/id/address.rs rename to core/models/src/id/service_interface.rs index 1bd670525..25aec0aba 100644 --- a/core/models/src/id/address.rs +++ b/core/models/src/id/service_interface.rs @@ -1,46 +1,48 @@ use std::path::Path; use serde::{Deserialize, Deserializer, Serialize}; +use ts_rs::TS; use crate::Id; -#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize)] -pub struct AddressId(Id); -impl From for AddressId { +#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, TS)] +#[ts(export, type = "string")] +pub struct ServiceInterfaceId(Id); +impl From for ServiceInterfaceId { fn from(id: Id) -> Self { Self(id) } } -impl std::fmt::Display for AddressId { +impl std::fmt::Display for ServiceInterfaceId { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{}", &self.0) } } -impl std::ops::Deref for AddressId { +impl std::ops::Deref for ServiceInterfaceId { type Target = str; fn deref(&self) -> &Self::Target { &*self.0 } } -impl AsRef for AddressId { +impl AsRef for ServiceInterfaceId { fn as_ref(&self) -> &str { self.0.as_ref() } } -impl<'de> Deserialize<'de> for AddressId { +impl<'de> Deserialize<'de> for ServiceInterfaceId { fn deserialize(deserializer: D) -> Result where D: Deserializer<'de>, { - Ok(AddressId(Deserialize::deserialize(deserializer)?)) + Ok(ServiceInterfaceId(Deserialize::deserialize(deserializer)?)) } } -impl AsRef for AddressId { +impl AsRef for ServiceInterfaceId { fn as_ref(&self) -> &Path { self.0.as_ref().as_ref() } } -impl<'q> sqlx::Encode<'q, sqlx::Postgres> for AddressId { +impl<'q> sqlx::Encode<'q, sqlx::Postgres> for ServiceInterfaceId { fn encode_by_ref( &self, buf: &mut >::ArgumentBuffer, @@ -48,7 +50,7 @@ impl<'q> sqlx::Encode<'q, sqlx::Postgres> for AddressId { <&str as sqlx::Encode<'q, sqlx::Postgres>>::encode_by_ref(&&**self, buf) } } -impl sqlx::Type for AddressId { +impl sqlx::Type for ServiceInterfaceId { fn type_info() -> sqlx::postgres::PgTypeInfo { <&str as sqlx::Type>::type_info() } diff --git a/core/startos/bindings/BindKind.ts b/core/startos/bindings/ActionId.ts similarity index 67% rename from core/startos/bindings/BindKind.ts rename to core/startos/bindings/ActionId.ts index e026fb081..7c05d2b3c 100644 --- a/core/startos/bindings/BindKind.ts +++ b/core/startos/bindings/ActionId.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type BindKind = "static" | "single" | "multi"; \ No newline at end of file +export type ActionId = string; \ No newline at end of file diff --git a/core/startos/bindings/ActionMetadata.ts b/core/startos/bindings/ActionMetadata.ts index 91af02b7b..e787190c8 100644 --- a/core/startos/bindings/ActionMetadata.ts +++ b/core/startos/bindings/ActionMetadata.ts @@ -1,4 +1,4 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { AllowedStatuses } from "./AllowedStatuses"; -export type ActionMetadata = { name: string, description: string, warning: string | null, disabled: boolean, input: {[key: string]: any}, allowedStatuses: AllowedStatuses, group: string | null, }; \ No newline at end of file +export type ActionMetadata = { name: string, description: string, warning: string | null, input: any, disabled: boolean, allowedStatuses: AllowedStatuses, group: string | null, }; \ No newline at end of file diff --git a/core/startos/bindings/AddSslOptions.ts b/core/startos/bindings/AddSslOptions.ts index 97035853d..fcf2d63d4 100644 --- a/core/startos/bindings/AddSslOptions.ts +++ b/core/startos/bindings/AddSslOptions.ts @@ -1,4 +1,4 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { AlpnInfo } from "./AlpnInfo"; -export type AddSslOptions = { scheme: string, preferredExternalPort: number, alpn: AlpnInfo, }; \ No newline at end of file +export type AddSslOptions = { scheme: string | null, preferredExternalPort: number, alpn: AlpnInfo, }; \ No newline at end of file diff --git a/core/startos/bindings/AddressInfo.ts b/core/startos/bindings/AddressInfo.ts index b253ab823..6bc42c0e9 100644 --- a/core/startos/bindings/AddressInfo.ts +++ b/core/startos/bindings/AddressInfo.ts @@ -1,4 +1,5 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { BindOptions } from "./BindOptions"; +import type { HostId } from "./HostId"; -export type AddressInfo = { username: string | null, hostId: string, bindOptions: BindOptions, suffix: string, }; \ No newline at end of file +export type AddressInfo = { username: string | null, hostId: HostId, bindOptions: BindOptions, suffix: string, }; \ No newline at end of file diff --git a/core/startos/bindings/BindOptions.ts b/core/startos/bindings/BindOptions.ts index dc8b1e5b5..9043c5f57 100644 --- a/core/startos/bindings/BindOptions.ts +++ b/core/startos/bindings/BindOptions.ts @@ -1,4 +1,5 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { AddSslOptions } from "./AddSslOptions"; +import type { Security } from "./Security"; -export type BindOptions = { scheme: string, preferredExternalPort: number, addSsl: AddSslOptions | null, secure: boolean, ssl: boolean, }; \ No newline at end of file +export type BindOptions = { scheme: string | null, preferredExternalPort: number, addSsl: AddSslOptions | null, secure: Security | null, }; \ No newline at end of file diff --git a/core/startos/bindings/BindParams.ts b/core/startos/bindings/BindParams.ts index 319666538..07a8033bc 100644 --- a/core/startos/bindings/BindParams.ts +++ b/core/startos/bindings/BindParams.ts @@ -1,6 +1,7 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { AddSslOptions } from "./AddSslOptions"; -import type { BindKind } from "./BindKind"; -import type { BindOptionsSecure } from "./BindOptionsSecure"; +import type { HostId } from "./HostId"; +import type { HostKind } from "./HostKind"; +import type { Security } from "./Security"; -export type BindParams = { kind: BindKind, id: string, internalPort: number, scheme: string, preferredExternalPort: number, addSsl: AddSslOptions | null, secure: BindOptionsSecure | null, }; \ No newline at end of file +export type BindParams = { kind: HostKind, id: HostId, internalPort: number, scheme: string | null, preferredExternalPort: number, addSsl: AddSslOptions | null, secure: Security | null, }; \ No newline at end of file diff --git a/core/startos/bindings/CurrentDependencyInfo.ts b/core/startos/bindings/CurrentDependencyInfo.ts index ad8d3cf36..a253afa38 100644 --- a/core/startos/bindings/CurrentDependencyInfo.ts +++ b/core/startos/bindings/CurrentDependencyInfo.ts @@ -1,4 +1,4 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { DataUrl } from "./DataUrl"; -export type CurrentDependencyInfo = { title: string, icon: DataUrl, registry: string, versionSpec: string, } & ({ "kind": "exists" } | { "kind": "running", healthChecks: string[], }); \ No newline at end of file +export type CurrentDependencyInfo = { title: string, icon: DataUrl, registryUrl: string, versionSpec: string, } & ({ "kind": "exists" } | { "kind": "running", healthChecks: string[], }); \ No newline at end of file diff --git a/core/startos/bindings/DependencyRequirement.ts b/core/startos/bindings/DependencyRequirement.ts index f6ff4aa54..40b78b473 100644 --- a/core/startos/bindings/DependencyRequirement.ts +++ b/core/startos/bindings/DependencyRequirement.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type DependencyRequirement = { "kind": "running", id: string, healthChecks: string[], versionSpec: string, registry: string, } | { "kind": "exists", id: string, versionSpec: string, registry: string, }; \ No newline at end of file +export type DependencyRequirement = { "kind": "running", id: string, healthChecks: string[], versionSpec: string, registryUrl: string, } | { "kind": "exists", id: string, versionSpec: string, registryUrl: string, }; \ No newline at end of file diff --git a/core/startos/bindings/ExportedHostInfo.ts b/core/startos/bindings/ExportedHostInfo.ts new file mode 100644 index 000000000..c4d36bd61 --- /dev/null +++ b/core/startos/bindings/ExportedHostInfo.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ExportedHostnameInfo } from "./ExportedHostnameInfo"; +import type { HostId } from "./HostId"; +import type { HostKind } from "./HostKind"; + +export type ExportedHostInfo = { id: HostId, kind: HostKind, hostnames: Array, }; \ No newline at end of file diff --git a/core/startos/bindings/ExportedHostnameInfo.ts b/core/startos/bindings/ExportedHostnameInfo.ts new file mode 100644 index 000000000..086fd95b1 --- /dev/null +++ b/core/startos/bindings/ExportedHostnameInfo.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ExportedIpHostname } from "./ExportedIpHostname"; +import type { ExportedOnionHostname } from "./ExportedOnionHostname"; + +export type ExportedHostnameInfo = { "kind": "ip", networkInterfaceId: string, public: boolean, hostname: ExportedIpHostname, } | { "kind": "onion", hostname: ExportedOnionHostname, }; \ No newline at end of file diff --git a/core/startos/bindings/ExportedIpHostname.ts b/core/startos/bindings/ExportedIpHostname.ts new file mode 100644 index 000000000..7d012fecc --- /dev/null +++ b/core/startos/bindings/ExportedIpHostname.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type ExportedIpHostname = { "kind": "ipv4", value: string, port: number | null, sslPort: number | null, } | { "kind": "ipv6", value: string, port: number | null, sslPort: number | null, } | { "kind": "local", value: string, port: number | null, sslPort: number | null, } | { "kind": "domain", domain: string, subdomain: string | null, port: number | null, sslPort: number | null, }; \ No newline at end of file diff --git a/core/startos/bindings/ExportedOnionHostname.ts b/core/startos/bindings/ExportedOnionHostname.ts new file mode 100644 index 000000000..82fee09e3 --- /dev/null +++ b/core/startos/bindings/ExportedOnionHostname.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type ExportedOnionHostname = { value: string, port: number | null, sslPort: number | null, }; \ No newline at end of file diff --git a/core/startos/bindings/HealthCheckResult.ts b/core/startos/bindings/HealthCheckResult.ts index eaba169f1..a539fc805 100644 --- a/core/startos/bindings/HealthCheckResult.ts +++ b/core/startos/bindings/HealthCheckResult.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type HealthCheckResult = { "result": "success" } | { "result": "disabled" } | { "result": "starting" } | { "result": "loading", message: string, } | { "result": "failure", error: string, }; \ No newline at end of file +export type HealthCheckResult = { name: string, } & ({ "result": "success", message: string, } | { "result": "disabled" } | { "result": "starting" } | { "result": "loading", message: string, } | { "result": "failure", message: string, }); \ No newline at end of file diff --git a/core/startos/bindings/PackageDataEntry.ts b/core/startos/bindings/PackageDataEntry.ts index 100e38ba7..7abb7503a 100644 --- a/core/startos/bindings/PackageDataEntry.ts +++ b/core/startos/bindings/PackageDataEntry.ts @@ -1,8 +1,12 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ActionId } from "./ActionId"; +import type { ActionMetadata } from "./ActionMetadata"; import type { CurrentDependencies } from "./CurrentDependencies"; import type { DataUrl } from "./DataUrl"; import type { HostInfo } from "./HostInfo"; import type { PackageState } from "./PackageState"; +import type { ServiceInterfaceId } from "./ServiceInterfaceId"; +import type { ServiceInterfaceWithHostInfo } from "./ServiceInterfaceWithHostInfo"; import type { Status } from "./Status"; -export type PackageDataEntry = { stateInfo: PackageState, status: Status, marketplaceUrl: string | null, developerKey: string, icon: DataUrl, lastBackup: string | null, currentDependencies: CurrentDependencies, hosts: HostInfo, storeExposedDependents: string[], }; \ No newline at end of file +export type PackageDataEntry = { stateInfo: PackageState, status: Status, marketplaceUrl: string | null, developerKey: string, icon: DataUrl, lastBackup: string | null, currentDependencies: CurrentDependencies, actions: { [key: ActionId]: ActionMetadata }, serviceInterfaces: { [key: ServiceInterfaceId]: ServiceInterfaceWithHostInfo }, hosts: HostInfo, storeExposedDependents: string[], }; \ No newline at end of file diff --git a/core/startos/bindings/Progress.ts b/core/startos/bindings/Progress.ts index d522dee5a..acddd8582 100644 --- a/core/startos/bindings/Progress.ts +++ b/core/startos/bindings/Progress.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type Progress = boolean | { done: bigint, total: bigint | null, }; \ No newline at end of file +export type Progress = boolean | { done: number, total: number | null, }; \ No newline at end of file diff --git a/core/startos/bindings/ConnectionAddresses.ts b/core/startos/bindings/Security.ts similarity index 56% rename from core/startos/bindings/ConnectionAddresses.ts rename to core/startos/bindings/Security.ts index 503bfb418..390b6a91f 100644 --- a/core/startos/bindings/ConnectionAddresses.ts +++ b/core/startos/bindings/Security.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type ConnectionAddresses = { tor: Array, clearnet: Array, }; \ No newline at end of file +export type Security = { ssl: boolean, }; \ No newline at end of file diff --git a/core/startos/bindings/ServerInfo.ts b/core/startos/bindings/ServerInfo.ts index ee8e55157..97cd77888 100644 --- a/core/startos/bindings/ServerInfo.ts +++ b/core/startos/bindings/ServerInfo.ts @@ -1,5 +1,4 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ConnectionAddresses } from "./ConnectionAddresses"; import type { Governor } from "./Governor"; import type { IpInfo } from "./IpInfo"; import type { ServerStatus } from "./ServerStatus"; @@ -13,4 +12,4 @@ lastWifiRegion: string | null, eosVersionCompat: string, lanAddress: string, oni /** * for backwards compatibility */ -torAddress: string, ipInfo: { [key: string]: IpInfo }, statusInfo: ServerStatus, wifi: WifiInfo, unreadNotificationCount: bigint, connectionAddresses: ConnectionAddresses, passwordHash: string, pubkey: string, caFingerprint: string, ntpSynced: boolean, zram: boolean, governor: Governor | null, }; \ No newline at end of file +torAddress: string, ipInfo: { [key: string]: IpInfo }, statusInfo: ServerStatus, wifi: WifiInfo, unreadNotificationCount: number, passwordHash: string, pubkey: string, caFingerprint: string, ntpSynced: boolean, zram: boolean, governor: Governor | null, }; \ No newline at end of file diff --git a/core/startos/bindings/ServiceInterface.ts b/core/startos/bindings/ServiceInterface.ts new file mode 100644 index 000000000..2d484d749 --- /dev/null +++ b/core/startos/bindings/ServiceInterface.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { AddressInfo } from "./AddressInfo"; +import type { ServiceInterfaceId } from "./ServiceInterfaceId"; +import type { ServiceInterfaceType } from "./ServiceInterfaceType"; + +export type ServiceInterface = { id: ServiceInterfaceId, name: string, description: string, hasPrimary: boolean, disabled: boolean, masked: boolean, addressInfo: AddressInfo, type: ServiceInterfaceType, }; \ No newline at end of file diff --git a/core/startos/bindings/HealthCheckString.ts b/core/startos/bindings/ServiceInterfaceId.ts similarity index 54% rename from core/startos/bindings/HealthCheckString.ts rename to core/startos/bindings/ServiceInterfaceId.ts index efe9f42bd..87edd8694 100644 --- a/core/startos/bindings/HealthCheckString.ts +++ b/core/startos/bindings/ServiceInterfaceId.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type HealthCheckString = "passing" | "disabled" | "starting" | "warning" | "failure"; \ No newline at end of file +export type ServiceInterfaceId = string; \ No newline at end of file diff --git a/core/startos/bindings/ServiceInterfaceWithHostInfo.ts b/core/startos/bindings/ServiceInterfaceWithHostInfo.ts new file mode 100644 index 000000000..449c5b29d --- /dev/null +++ b/core/startos/bindings/ServiceInterfaceWithHostInfo.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { AddressInfo } from "./AddressInfo"; +import type { ExportedHostInfo } from "./ExportedHostInfo"; +import type { ServiceInterfaceId } from "./ServiceInterfaceId"; +import type { ServiceInterfaceType } from "./ServiceInterfaceType"; + +export type ServiceInterfaceWithHostInfo = { hostInfo: ExportedHostInfo, id: ServiceInterfaceId, name: string, description: string, hasPrimary: boolean, disabled: boolean, masked: boolean, addressInfo: AddressInfo, type: ServiceInterfaceType, }; \ No newline at end of file diff --git a/core/startos/bindings/SetHealth.ts b/core/startos/bindings/SetHealth.ts index 321b5c97b..cc8193863 100644 --- a/core/startos/bindings/SetHealth.ts +++ b/core/startos/bindings/SetHealth.ts @@ -1,4 +1,4 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { HealthCheckString } from "./HealthCheckString"; +import type { HealthCheckId } from "./HealthCheckId"; -export type SetHealth = { name: string, status: HealthCheckString, message: string | null, }; \ No newline at end of file +export type SetHealth = { id: HealthCheckId, name: string, } & ({ "result": "success", message: string, } | { "result": "disabled" } | { "result": "starting" } | { "result": "loading", message: string, } | { "result": "failure", message: string, }); \ No newline at end of file diff --git a/core/startos/bindings/UpdateProgress.ts b/core/startos/bindings/UpdateProgress.ts index ad9750196..ef6473f37 100644 --- a/core/startos/bindings/UpdateProgress.ts +++ b/core/startos/bindings/UpdateProgress.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type UpdateProgress = { size: bigint | null, downloaded: bigint, }; \ No newline at end of file +export type UpdateProgress = { size: number | null, downloaded: number, }; \ No newline at end of file diff --git a/core/startos/src/db/model/package.rs b/core/startos/src/db/model/package.rs index 0c82bf80c..83a35d086 100644 --- a/core/startos/src/db/model/package.rs +++ b/core/startos/src/db/model/package.rs @@ -3,7 +3,7 @@ use std::collections::{BTreeMap, BTreeSet}; use chrono::{DateTime, Utc}; use emver::VersionRange; use imbl_value::InternedString; -use models::{ActionId, DataUrl, HealthCheckId, HostId, PackageId}; +use models::{ActionId, DataUrl, HealthCheckId, HostId, PackageId, ServiceInterfaceId}; use patch_db::json_ptr::JsonPointer; use patch_db::HasModel; use reqwest::Url; @@ -11,6 +11,7 @@ use serde::{Deserialize, Serialize}; use ts_rs::TS; use crate::net::host::HostInfo; +use crate::net::service_interface::ServiceInterfaceWithHostInfo; use crate::prelude::*; use crate::progress::FullProgress; use crate::s9pk::manifest::Manifest; @@ -306,14 +307,14 @@ pub enum AllowedStatuses { #[serde(rename_all = "camelCase")] #[model = "Model"] pub struct ActionMetadata { - name: String, - description: String, - warning: Option, + pub name: String, + pub description: String, + pub warning: Option, #[ts(type = "any")] - input: Value, - disabled: bool, - allowedStatuses: AllowedStatuses, - group: Option, + pub input: Value, + pub disabled: bool, + pub allowed_statuses: AllowedStatuses, + pub group: Option, } #[derive(Debug, Deserialize, Serialize, HasModel, TS)] @@ -331,10 +332,11 @@ pub struct PackageDataEntry { #[ts(type = "string | null")] pub last_backup: Option>, pub current_dependencies: CurrentDependencies, + pub actions: BTreeMap, + pub service_interfaces: BTreeMap, pub hosts: HostInfo, #[ts(type = "string[]")] pub store_exposed_dependents: Vec, - pub exposed_actions: BTreeMap, } impl AsRef for PackageDataEntry { fn as_ref(&self) -> &PackageDataEntry { @@ -375,7 +377,7 @@ pub struct CurrentDependencyInfo { pub title: String, pub icon: DataUrl<'static>, #[ts(type = "string")] - pub registry: Url, + pub registry_url: Url, #[ts(type = "string")] pub version_spec: VersionRange, } diff --git a/core/startos/src/db/model/public.rs b/core/startos/src/db/model/public.rs index ea8a3ac3d..d1eec5443 100644 --- a/core/startos/src/db/model/public.rs +++ b/core/startos/src/db/model/public.rs @@ -66,10 +66,6 @@ impl Public { selected: None, }, unread_notification_count: 0, - connection_addresses: ConnectionAddresses { - tor: Vec::new(), - clearnet: Vec::new(), - }, password_hash: account.password.clone(), pubkey: ssh_key::PublicKey::from(&account.ssh_key) .to_openssh() @@ -136,8 +132,8 @@ pub struct ServerInfo { #[serde(default)] pub status_info: ServerStatus, pub wifi: WifiInfo, + #[ts(type = "number")] pub unread_notification_count: u64, - pub connection_addresses: ConnectionAddresses, pub password_hash: String, pub pubkey: String, pub ca_fingerprint: String, @@ -199,7 +195,9 @@ pub struct ServerStatus { #[model = "Model"] #[ts(export)] pub struct UpdateProgress { + #[ts(type = "number | null")] pub size: Option, + #[ts(type = "number")] pub downloaded: u64, } @@ -221,11 +219,3 @@ pub struct ServerSpecs { pub disk: String, pub memory: String, } - -#[derive(Debug, Deserialize, Serialize, TS)] -#[serde(rename_all = "camelCase")] -#[ts(export)] -pub struct ConnectionAddresses { - pub tor: Vec, - pub clearnet: Vec, -} diff --git a/core/startos/src/net/host/binding.rs b/core/startos/src/net/host/binding.rs index aa689b717..8301821f5 100644 --- a/core/startos/src/net/host/binding.rs +++ b/core/startos/src/net/host/binding.rs @@ -16,7 +16,7 @@ pub struct BindInfo { impl BindInfo { pub fn new(available_ports: &mut AvailablePorts, options: BindOptions) -> Result { let mut assigned_lan_port = None; - if options.add_ssl.is_some() || options.secure { + if options.add_ssl.is_some() || options.secure.is_some() { assigned_lan_port = Some(available_ports.alloc()?); } Ok(Self { @@ -33,7 +33,7 @@ impl BindInfo { mut assigned_lan_port, .. } = self; - if options.add_ssl.is_some() || options.secure { + if options.add_ssl.is_some() || options.secure.is_some() { assigned_lan_port = if let Some(port) = assigned_lan_port.take() { Some(port) } else { @@ -51,24 +51,30 @@ impl BindInfo { } } -#[derive(Debug, Deserialize, Serialize, TS)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, TS)] +#[ts(export)] +#[serde(rename_all = "camelCase")] +pub struct Security { + pub ssl: bool, +} + +#[derive(Clone, Debug, Deserialize, Serialize, TS)] #[serde(rename_all = "camelCase")] #[ts(export)] pub struct BindOptions { - #[ts(type = "string")] - pub scheme: InternedString, + #[ts(type = "string | null")] + pub scheme: Option, pub preferred_external_port: u16, pub add_ssl: Option, - pub secure: bool, - pub ssl: bool, + pub secure: Option, } #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq, TS)] #[serde(rename_all = "camelCase")] #[ts(export)] pub struct AddSslOptions { - #[ts(type = "string")] - pub scheme: InternedString, + #[ts(type = "string | null")] + pub scheme: Option, pub preferred_external_port: u16, // #[serde(default)] // pub add_x_forwarded_headers: bool, // TODO diff --git a/core/startos/src/net/host/mod.rs b/core/startos/src/net/host/mod.rs index 086840bd8..2d50df15a 100644 --- a/core/startos/src/net/host/mod.rs +++ b/core/startos/src/net/host/mod.rs @@ -39,7 +39,7 @@ impl Host { } } -#[derive(Debug, Deserialize, Serialize, TS)] +#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Deserialize, Serialize, TS)] #[serde(rename_all = "camelCase")] #[ts(export)] pub enum HostKind { diff --git a/core/startos/src/net/mod.rs b/core/startos/src/net/mod.rs index f6e5ddee5..aaf019e66 100644 --- a/core/startos/src/net/mod.rs +++ b/core/startos/src/net/mod.rs @@ -7,6 +7,7 @@ pub mod host; pub mod keys; pub mod mdns; pub mod net_controller; +pub mod service_interface; pub mod ssl; pub mod static_server; pub mod tor; diff --git a/core/startos/src/net/net_controller.rs b/core/startos/src/net/net_controller.rs index c9338cdff..a4c9ea507 100644 --- a/core/startos/src/net/net_controller.rs +++ b/core/startos/src/net/net_controller.rs @@ -247,7 +247,7 @@ impl NetService { None, external, (self.ip, *port).into(), - if bind.options.ssl { + if bind.options.secure.as_ref().map_or(false, |s| s.ssl) { Ok(()) } else { Err(ssl.alpn.clone()) diff --git a/core/startos/src/net/service_interface.rs b/core/startos/src/net/service_interface.rs new file mode 100644 index 000000000..9a4659cfd --- /dev/null +++ b/core/startos/src/net/service_interface.rs @@ -0,0 +1,115 @@ +use std::net::{Ipv4Addr, Ipv6Addr}; + +use models::{HostId, ServiceInterfaceId}; +use serde::{Deserialize, Serialize}; +use ts_rs::TS; + +use crate::net::host::binding::BindOptions; +use crate::net::host::HostKind; +use crate::prelude::*; + +#[derive(Clone, Debug, Deserialize, Serialize, TS)] +#[ts(export)] +#[serde(rename_all = "camelCase")] +pub struct ServiceInterfaceWithHostInfo { + #[serde(flatten)] + pub service_interface: ServiceInterface, + pub host_info: ExportedHostInfo, +} + +#[derive(Clone, Debug, Deserialize, Serialize, TS)] +#[ts(export)] +#[serde(rename_all = "camelCase")] +pub struct ExportedHostInfo { + pub id: HostId, + pub kind: HostKind, + pub hostnames: Vec, +} + +#[derive(Clone, Debug, Deserialize, Serialize, TS)] +#[ts(export)] +#[serde(rename_all = "camelCase")] +#[serde(rename_all_fields = "camelCase")] +#[serde(tag = "kind")] +pub enum ExportedHostnameInfo { + Ip { + network_interface_id: String, + public: bool, + hostname: ExportedIpHostname, + }, + Onion { + hostname: ExportedOnionHostname, + }, +} + +#[derive(Clone, Debug, Deserialize, Serialize, TS)] +#[ts(export)] +#[serde(rename_all = "camelCase")] +pub struct ExportedOnionHostname { + pub value: String, + pub port: Option, + pub ssl_port: Option, +} + +#[derive(Clone, Debug, Deserialize, Serialize, TS)] +#[ts(export)] +#[serde(rename_all = "camelCase")] +#[serde(rename_all_fields = "camelCase")] +#[serde(tag = "kind")] +pub enum ExportedIpHostname { + Ipv4 { + value: Ipv4Addr, + port: Option, + ssl_port: Option, + }, + Ipv6 { + value: Ipv6Addr, + port: Option, + ssl_port: Option, + }, + Local { + value: String, + port: Option, + ssl_port: Option, + }, + Domain { + domain: String, + subdomain: Option, + port: Option, + ssl_port: Option, + }, +} + +#[derive(Clone, Debug, Deserialize, Serialize, TS)] +#[ts(export)] +#[serde(rename_all = "camelCase")] +pub struct ServiceInterface { + pub id: ServiceInterfaceId, + pub name: String, + pub description: String, + pub has_primary: bool, + pub disabled: bool, + pub masked: bool, + pub address_info: AddressInfo, + #[serde(rename = "type")] + pub interface_type: ServiceInterfaceType, +} + +#[derive(Clone, Debug, Deserialize, Serialize, TS)] +#[ts(export)] +#[serde(rename_all = "camelCase")] +pub enum ServiceInterfaceType { + Ui, + P2p, + Api, +} + +#[derive(Clone, Debug, Deserialize, Serialize, TS)] +#[ts(export)] +#[serde(rename_all = "camelCase")] +pub struct AddressInfo { + pub username: Option, + pub host_id: HostId, + pub bind_options: BindOptions, + pub suffix: String, +} diff --git a/core/startos/src/progress.rs b/core/startos/src/progress.rs index 0acdca111..eec637575 100644 --- a/core/startos/src/progress.rs +++ b/core/startos/src/progress.rs @@ -24,7 +24,12 @@ lazy_static::lazy_static! { #[serde(untagged)] pub enum Progress { Complete(bool), - Progress { done: u64, total: Option }, + Progress { + #[ts(type = "number")] + done: u64, + #[ts(type = "number | null")] + total: Option, + }, } impl Progress { pub fn new() -> Self { diff --git a/core/startos/src/service/service_effect_handler.rs b/core/startos/src/service/service_effect_handler.rs index 7bd1c0ab8..4041cbb98 100644 --- a/core/startos/src/service/service_effect_handler.rs +++ b/core/startos/src/service/service_effect_handler.rs @@ -11,7 +11,7 @@ use clap::Parser; use emver::VersionRange; use imbl::OrdMap; use imbl_value::{json, InternedString}; -use models::{ActionId, HealthCheckId, ImageId, PackageId, VolumeId}; +use models::{ActionId, HealthCheckId, HostId, ImageId, PackageId, VolumeId}; use patch_db::json_ptr::JsonPointer; use rpc_toolkit::{from_fn, from_fn_async, AnyContext, Context, Empty, HandlerExt, ParentHandler}; use serde::{Deserialize, Serialize}; @@ -25,11 +25,13 @@ use crate::db::model::package::{ use crate::disk::mount::filesystem::idmapped::IdMapped; use crate::disk::mount::filesystem::loop_dev::LoopDev; use crate::disk::mount::filesystem::overlayfs::OverlayGuard; +use crate::net::host::binding::BindOptions; +use crate::net::host::HostKind; use crate::prelude::*; use crate::s9pk::rpc::SKIP_ENV; use crate::service::cli::ContainerCliContext; use crate::service::ServiceActorSeed; -use crate::status::health_check::{HealthCheckResult, HealthCheckString}; +use crate::status::health_check::HealthCheckResult; use crate::status::MainStatus; use crate::util::clap::FromStrParser; use crate::util::{new_guid, Invoke}; @@ -185,21 +187,7 @@ struct GetServicePortForwardParams { package_id: Option, internal_port: u32, } -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, TS)] -#[ts(export)] -#[serde(rename_all = "camelCase")] -struct BindOptionsSecure { - ssl: bool, -} -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, TS)] -#[ts(export)] -#[serde(rename_all = "camelCase")] -struct BindOptions { - scheme: Option, - preferred_external_port: u32, - add_ssl: Option, - secure: Option, -} + #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, TS)] #[ts(export)] #[serde(rename_all = "camelCase")] @@ -379,7 +367,7 @@ async fn export_action(context: EffectContext, data: ExportActionParams) -> Resu .as_package_data_mut() .as_idx_mut(&package_id) .or_not_found(&package_id)? - .as_exposed_actions_mut(); + .as_actions_mut(); let mut value = model.de()?; value .insert(data.id, data.metadata) @@ -402,7 +390,7 @@ async fn remove_action(context: EffectContext, data: RemoveActionParams) -> Resu .as_package_data_mut() .as_idx_mut(&package_id) .or_not_found(&package_id)? - .as_exposed_actions_mut(); + .as_actions_mut(); let mut value = model.de()?; value.remove(&data.id).map(|_| ()).unwrap_or_default(); model.ser(&value) @@ -447,35 +435,16 @@ async fn get_host_info( async fn clear_bindings(context: EffectContext, _: Empty) -> Result { todo!() } -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, TS)] -#[serde(rename_all = "camelCase")] -#[ts(export)] -enum BindKind { - Static, - Single, - Multi, -} -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, TS)] -#[serde(rename_all = "camelCase")] -#[ts(export)] - -struct AddSslOptions { - scheme: Option, - preferred_external_port: u32, - add_x_forwarded_headers: Option, -} #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, TS)] #[serde(rename_all = "camelCase")] #[ts(export)] struct BindParams { - kind: BindKind, - id: String, - internal_port: u32, - scheme: String, - preferred_external_port: u32, - add_ssl: Option, - secure: Option, + kind: HostKind, + id: HostId, + internal_port: u16, + #[serde(flatten)] + options: BindOptions, } async fn bind(_: AnyContext, BindParams { .. }: BindParams) -> Result { todo!() @@ -918,19 +887,14 @@ async fn set_main_status(context: EffectContext, params: SetMainStatus) -> Resul #[serde(rename_all = "camelCase")] #[ts(export)] struct SetHealth { - #[ts(type = "string")] - name: HealthCheckId, - status: HealthCheckString, - message: Option, + id: HealthCheckId, + #[serde(flatten)] + result: HealthCheckResult, } async fn set_health( context: EffectContext, - SetHealth { - name, - status, - message, - }: SetHealth, + SetHealth { id, result }: SetHealth, ) -> Result { let context = context.deref()?; @@ -939,43 +903,22 @@ async fn set_health( .ctx .db .mutate(move |db| { - let mut main = db - .as_public() - .as_package_data() - .as_idx(package_id) - .or_not_found(package_id)? - .as_status() - .as_main() - .de()?; - match &mut main { - &mut MainStatus::Running { ref mut health, .. } - | &mut MainStatus::BackingUp { ref mut health, .. } => { - health.remove(&name); - - health.insert( - name, - match status { - HealthCheckString::Disabled => HealthCheckResult::Disabled, - HealthCheckString::Passing => HealthCheckResult::Success, - HealthCheckString::Starting => HealthCheckResult::Starting, - HealthCheckString::Warning => HealthCheckResult::Loading { - message: message.unwrap_or_default(), - }, - HealthCheckString::Failure => HealthCheckResult::Failure { - error: message.unwrap_or_default(), - }, - }, - ); - } - _ => return Ok(()), - }; db.as_public_mut() .as_package_data_mut() .as_idx_mut(package_id) .or_not_found(package_id)? .as_status_mut() .as_main_mut() - .ser(&main) + .mutate(|main| { + match main { + &mut MainStatus::Running { ref mut health, .. } + | &mut MainStatus::BackingUp { ref mut health, .. } => { + health.insert(id, result); + } + _ => (), + } + Ok(()) + }) }) .await?; Ok(json!(())) @@ -1100,7 +1043,7 @@ enum DependencyRequirement { #[ts(type = "string")] version_spec: VersionRange, #[ts(type = "string")] - registry: Url, + registry_url: Url, }, #[serde(rename_all = "camelCase")] Exists { @@ -1109,7 +1052,7 @@ enum DependencyRequirement { #[ts(type = "string")] version_spec: VersionRange, #[ts(type = "string")] - registry: Url, + registry_url: Url, }, } // filebrowser:exists,bitcoind:running:foo+bar+baz @@ -1119,7 +1062,7 @@ impl FromStr for DependencyRequirement { match s.split_once(':') { Some((id, "e")) | Some((id, "exists")) => Ok(Self::Exists { id: id.parse()?, - registry: "".parse()?, // TODO + registry_url: "".parse()?, // TODO version_spec: "*".parse()?, // TODO }), Some((id, rest)) => { @@ -1143,14 +1086,14 @@ impl FromStr for DependencyRequirement { Ok(Self::Running { id: id.parse()?, health_checks, - registry: "".parse()?, // TODO + registry_url: "".parse()?, // TODO version_spec: "*".parse()?, // TODO }) } None => Ok(Self::Running { id: s.parse()?, health_checks: BTreeSet::new(), - registry: "".parse()?, // TODO + registry_url: "".parse()?, // TODO version_spec: "*".parse()?, // TODO }), } @@ -1186,13 +1129,13 @@ async fn set_dependencies( .map(|dependency| match dependency { DependencyRequirement::Exists { id, - registry, + registry_url, version_spec, } => ( id, CurrentDependencyInfo { kind: CurrentDependencyKind::Exists, - registry, + registry_url, version_spec, icon: todo!(), title: todo!(), @@ -1201,13 +1144,13 @@ async fn set_dependencies( DependencyRequirement::Running { id, health_checks, - registry, + registry_url, version_spec, } => ( id, CurrentDependencyInfo { kind: CurrentDependencyKind::Running { health_checks }, - registry, + registry_url, version_spec, icon: todo!(), title: todo!(), diff --git a/core/startos/src/service/service_map.rs b/core/startos/src/service/service_map.rs index 1eebfced6..934497eb9 100644 --- a/core/startos/src/service/service_map.rs +++ b/core/startos/src/service/service_map.rs @@ -172,6 +172,8 @@ impl ServiceMap { icon, last_backup: None, current_dependencies: Default::default(), + actions: Default::default(), + service_interfaces: Default::default(), hosts: Default::default(), store_exposed_dependents: Default::default(), }, diff --git a/core/startos/src/status/health_check.rs b/core/startos/src/status/health_check.rs index c2af46490..8629976a0 100644 --- a/core/startos/src/status/health_check.rs +++ b/core/startos/src/status/health_check.rs @@ -2,35 +2,35 @@ pub use models::HealthCheckId; use serde::{Deserialize, Serialize}; use ts_rs::TS; +#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq, TS)] +#[serde(rename_all = "camelCase")] +pub struct HealthCheckResult { + pub name: String, + #[serde(flatten)] + pub kind: HealthCheckResultKind, +} + #[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq, TS)] #[serde(rename_all = "camelCase")] #[serde(tag = "result")] -pub enum HealthCheckResult { - Success, +pub enum HealthCheckResultKind { + Success { message: String }, Disabled, Starting, Loading { message: String }, - Failure { error: String }, + Failure { message: String }, } impl std::fmt::Display for HealthCheckResult { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - HealthCheckResult::Success => write!(f, "Succeeded"), - HealthCheckResult::Disabled => write!(f, "Disabled"), - HealthCheckResult::Starting => write!(f, "Starting"), - HealthCheckResult::Loading { message } => write!(f, "Loading ({})", message), - HealthCheckResult::Failure { error } => write!(f, "Failed ({})", error), + let name = &self.name; + match &self.kind { + HealthCheckResultKind::Success { message } => { + write!(f, "{name}: Succeeded ({message})") + } + HealthCheckResultKind::Disabled => write!(f, "{name}: Disabled"), + HealthCheckResultKind::Starting => write!(f, "{name}: Starting"), + HealthCheckResultKind::Loading { message } => write!(f, "{name}: Loading ({message})"), + HealthCheckResultKind::Failure { message } => write!(f, "{name}: Failed ({message})"), } } } - -#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq, ts_rs::TS)] -#[serde(rename_all = "camelCase")] -#[ts(export)] -pub enum HealthCheckString { - Passing, - Disabled, - Starting, - Warning, - Failure, -} diff --git a/sdk/lib/Dependency.ts b/sdk/lib/Dependency.ts index 71cc05890..1e70629da 100644 --- a/sdk/lib/Dependency.ts +++ b/sdk/lib/Dependency.ts @@ -6,13 +6,13 @@ export class Dependency { | { type: "running" versionSpec: Checker - url: string + registryUrl: string healthChecks: string[] } | { type: "exists" versionSpec: Checker - url: string + registryUrl: string }, ) {} } diff --git a/sdk/lib/interfaces/Host.ts b/sdk/lib/interfaces/Host.ts index 250f42075..de54f7dc0 100644 --- a/sdk/lib/interfaces/Host.ts +++ b/sdk/lib/interfaces/Host.ts @@ -1,71 +1,58 @@ import { object, string } from "ts-matches" import { Effects } from "../types" import { Origin } from "./Origin" +import { AddSslOptions } from "../../../core/startos/bindings/AddSslOptions" +import { Security } from "../../../core/startos/bindings/Security" +import { BindOptions } from "../../../core/startos/bindings/BindOptions" +import { AlpnInfo } from "../../../core/startos/bindings/AlpnInfo" + +export { AddSslOptions, Security, BindOptions } const knownProtocols = { http: { - secure: false, - ssl: false, + secure: null, defaultPort: 80, withSsl: "https", + alpn: { specified: ["http/1.1"] } as AlpnInfo, }, https: { - secure: true, - ssl: true, + secure: { ssl: true }, defaultPort: 443, }, ws: { - secure: false, - ssl: false, + secure: null, defaultPort: 80, withSsl: "wss", + alpn: { specified: ["http/1.1"] } as AlpnInfo, }, wss: { - secure: true, - ssl: true, + secure: { ssl: true }, defaultPort: 443, }, ssh: { - secure: true, - ssl: false, + secure: { ssl: false }, defaultPort: 22, }, bitcoin: { - secure: true, - ssl: false, + secure: { ssl: false }, defaultPort: 8333, }, lightning: { - secure: true, - ssl: true, + secure: { ssl: true }, defaultPort: 9735, }, grpc: { - secure: true, - ssl: true, + secure: { ssl: true }, defaultPort: 50051, }, dns: { - secure: true, - ssl: false, + secure: { ssl: false }, defaultPort: 53, }, } as const export type Scheme = string | null -type AddSslOptions = { - scheme: Scheme - preferredExternalPort: number - addXForwardedHeaders: boolean | null /** default: false */ -} -type Security = { ssl: boolean } -export type BindOptions = { - scheme: Scheme - preferredExternalPort: number - addSsl: AddSslOptions | null - secure: Security | null -} type KnownProtocols = typeof knownProtocols type ProtocolsWithSslVariants = { [K in keyof KnownProtocols]: KnownProtocols[K] extends { @@ -177,9 +164,10 @@ export class Host { if ("noAddSsl" in options && options.noAddSsl) return null if ("withSsl" in protoInfo && protoInfo.withSsl) return { - addXForwardedHeaders: null, + // addXForwardedHeaders: null, preferredExternalPort: knownProtocols[protoInfo.withSsl].defaultPort, scheme: protoInfo.withSsl, + alpn: protoInfo.alpn, ...("addSsl" in options ? options.addSsl : null), } return null diff --git a/sdk/lib/test/startosTypeValidation.test.ts b/sdk/lib/test/startosTypeValidation.test.ts index f2e86de74..5fa3f74b3 100644 --- a/sdk/lib/test/startosTypeValidation.test.ts +++ b/sdk/lib/test/startosTypeValidation.test.ts @@ -9,7 +9,6 @@ import { ParamsMaybePackageId } from "../../../core/startos/bindings/ParamsMaybe import { SetConfigured } from "../../../core/startos/bindings/SetConfigured" import { SetHealth } from "../../../core/startos/bindings/SetHealth" import { ExposeForDependentsParams } from "../../../core/startos/bindings/ExposeForDependentsParams" -import { ExposeUiParams } from "../../../core/startos/bindings/ExposeUiParams" import { GetSslCertificateParams } from "../../../core/startos/bindings/GetSslCertificateParams" import { GetSslKeyParams } from "../../../core/startos/bindings/GetSslKeyParams" import { GetServiceInterfaceParams } from "../../../core/startos/bindings/GetServiceInterfaceParams" @@ -24,7 +23,6 @@ import { ExportActionParams } from "../../../core/startos/bindings/ExportActionP import { RemoveActionParams } from "../../../core/startos/bindings/RemoveActionParams" import { ReverseProxyParams } from "../../../core/startos/bindings/ReverseProxyParams" import { MountParams } from "../../../core/startos/bindings/MountParams" -import { ExposedUI } from "../../../core/startos/bindings/ExposedUI" function typeEquality(_a: ExpectedType) {} describe("startosTypeValidation ", () => { test(`checking the params match`, () => { diff --git a/sdk/lib/types.ts b/sdk/lib/types.ts index fa77d2c02..daa7ffe43 100644 --- a/sdk/lib/types.ts +++ b/sdk/lib/types.ts @@ -1,5 +1,6 @@ export * as configTypes from "./config/configTypes" -import { AddSslOptions } from "../../core/startos/bindings/AddSslOptions" +import { HealthCheckId } from "../../core/startos/bindings/HealthCheckId" +import { HealthCheckResult } from "../../core/startos/bindings/HealthCheckResult" import { MainEffects, ServiceInterfaceType, Signals } from "./StartSdk" import { InputSpec } from "./config/configTypes" import { DependenciesReceipt } from "./config/setupConfig" @@ -324,16 +325,13 @@ export type Effects = { /** Removes all network bindings */ clearBindings(): Promise /** Creates a host connected to the specified port with the provided options */ - bind(options: { - kind: "static" | "single" | "multi" - id: string - internalPort: number - - scheme: Scheme - preferredExternalPort: number - addSsl: AddSslOptions | null - secure: { ssl: boolean } | null - }): Promise + bind( + options: { + kind: "static" | "single" | "multi" + id: string + internalPort: number + } & BindOptions, + ): Promise /** Retrieves the current hostname(s) associated with a host id */ // getHostInfo(options: { // kind: "static" | "single" @@ -479,11 +477,11 @@ export type Effects = { algorithm: "ecdsa" | "ed25519" | null }) => Promise - setHealth(o: { - name: string - status: HealthStatus - message: string | null - }): Promise + setHealth( + o: HealthCheckResult & { + id: HealthCheckId + }, + ): Promise /** Set the dependencies of what the service needs, usually ran during the set config as a best practice */ setDependencies(options: { @@ -590,7 +588,7 @@ export type KnownError = export type Dependency = { id: PackageId versionSpec: string - url: string + registryUrl: string } & ({ kind: "exists" } | { kind: "running"; healthChecks: string[] }) export type Dependencies = Array diff --git a/web/projects/marketplace/src/types.ts b/web/projects/marketplace/src/types.ts index 7f69c3747..bc7c70f80 100644 --- a/web/projects/marketplace/src/types.ts +++ b/web/projects/marketplace/src/types.ts @@ -1,4 +1,5 @@ import { Url } from '@start9labs/shared' +import { Manifest } from '../../../../core/startos/bindings/Manifest' export type StoreURL = string export type StoreName = string @@ -41,35 +42,6 @@ export interface DependencyMetadata { hidden: boolean } -export interface Manifest { - id: string - title: string - version: string - gitHash?: string - description: { - short: string - long: string - } - replaces?: string[] - releaseNotes: string - license: string // name of license - wrapperRepo: Url - upstreamRepo: Url - supportSite: Url - marketingSite: Url - donationUrl: Url | null - alerts: { - install: string | null - uninstall: string | null - restore: string | null - start: string | null - stop: string | null - } - dependencies: Record - osVersion: string - hasConfig: boolean -} - export interface Dependency { description: string | null optional: boolean diff --git a/web/projects/ui/src/app/app/menu/menu.component.ts b/web/projects/ui/src/app/app/menu/menu.component.ts index d44781a41..7a7eb5d29 100644 --- a/web/projects/ui/src/app/app/menu/menu.component.ts +++ b/web/projects/ui/src/app/app/menu/menu.component.ts @@ -18,7 +18,7 @@ import { } from 'rxjs' import { AbstractMarketplaceService } from '@start9labs/marketplace' import { MarketplaceService } from 'src/app/services/marketplace.service' -import { DataModel, PackageState } from 'src/app/services/patch-db/data-model' +import { DataModel } from 'src/app/services/patch-db/data-model' import { SplitPaneTracker } from 'src/app/services/split-pane.service' import { Emver, THEME } from '@start9labs/shared' import { ConnectionService } from 'src/app/services/connection.service' @@ -77,12 +77,10 @@ export class MenuComponent { filter(([prev, curr]) => Object.values(prev).some( p => - [ - PackageState.Installing, - PackageState.Updating, - PackageState.Restoring, - ].includes(p.stateInfo.state) && - [PackageState.Installed, PackageState.Removing].includes( + ['installing', 'updating', 'restoring'].includes( + p.stateInfo.state, + ) && + ['installed', 'removing'].includes( curr[getManifest(p).id].stateInfo.state, ), ), diff --git a/web/projects/ui/src/app/modals/backup-select/backup-select.page.ts b/web/projects/ui/src/app/modals/backup-select/backup-select.page.ts index 861e4c29f..2b6934c39 100644 --- a/web/projects/ui/src/app/modals/backup-select/backup-select.page.ts +++ b/web/projects/ui/src/app/modals/backup-select/backup-select.page.ts @@ -1,7 +1,7 @@ import { Component } from '@angular/core' import { ModalController } from '@ionic/angular' import { map, take } from 'rxjs/operators' -import { DataModel, PackageState } from 'src/app/services/patch-db/data-model' +import { DataModel } from 'src/app/services/patch-db/data-model' import { PatchDB } from 'patch-db-client' import { firstValueFrom } from 'rxjs' import { getManifest } from 'src/app/util/get-package-data' @@ -38,7 +38,7 @@ export class BackupSelectPage { id, title, icon: pkg.icon, - disabled: pkg.stateInfo.state !== PackageState.Installed, + disabled: pkg.stateInfo.state !== 'installed', checked: false, } }) diff --git a/web/projects/ui/src/app/pages/apps-routes/app-actions/app-actions.page.ts b/web/projects/ui/src/app/pages/apps-routes/app-actions/app-actions.page.ts index c836b6206..62038e78b 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-actions/app-actions.page.ts +++ b/web/projects/ui/src/app/pages/apps-routes/app-actions/app-actions.page.ts @@ -11,8 +11,6 @@ import { PatchDB } from 'patch-db-client' import { DataModel, PackageDataEntry, - PackageMainStatus, - Status, } from 'src/app/services/patch-db/data-model' import { GenericFormPage } from 'src/app/modals/generic-form/generic-form.page' import { isEmptyObject, ErrorToastService, getPkgId } from '@start9labs/shared' @@ -20,6 +18,7 @@ import { ActionSuccessPage } from 'src/app/modals/action-success/action-success. import { hasCurrentDeps } from 'src/app/util/has-deps' import { getAllPackages, getManifest } from 'src/app/util/get-package-data' import { ActionMetadata } from '@start9labs/start-sdk/cjs/sdk/lib/types' +import { Status } from '../../../../../../../../core/startos/bindings/Status' @Component({ selector: 'app-actions', diff --git a/web/projects/ui/src/app/pages/apps-routes/app-interfaces/app-interfaces.page.ts b/web/projects/ui/src/app/pages/apps-routes/app-interfaces/app-interfaces.page.ts index c390e122c..5f7227464 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-interfaces/app-interfaces.page.ts +++ b/web/projects/ui/src/app/pages/apps-routes/app-interfaces/app-interfaces.page.ts @@ -8,9 +8,8 @@ import { PatchDB } from 'patch-db-client' import { QRComponent } from 'src/app/components/qr/qr.component' import { map } from 'rxjs' import { types as T } from '@start9labs/start-sdk' - -type ServiceInterface = T.ServiceInterface -type ServiceInterfaceWithHostInfo = T.ServiceInterfaceWithHostInfo +import { ServiceInterface } from '../../../../../../../../core/startos/bindings/ServiceInterface' +import { ServiceInterfaceWithHostInfo } from '../../../../../../../../core/startos/bindings/ServiceInterfaceWithHostInfo' type MappedInterface = ServiceInterface & { addresses: MappedAddress[] @@ -109,12 +108,10 @@ function getAddresses( const username = addressInfo.username ? addressInfo.username + '@' : '' const suffix = addressInfo.suffix || '' - const hostnames = - host.kind === 'multi' - ? host.hostnames - : host.hostname + const hostnames = host.kind === 'multi' ? host.hostnames : [] // TODO: non-multi + /* host.hostname ? [host.hostname] - : [] + : [] */ const addresses: MappedAddress[] = [] diff --git a/web/projects/ui/src/app/pages/apps-routes/app-list/app-list-pkg/app-list-pkg.component.ts b/web/projects/ui/src/app/pages/apps-routes/app-list/app-list-pkg/app-list-pkg.component.ts index 04d05a1d8..b1c62618d 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-list/app-list-pkg/app-list-pkg.component.ts +++ b/web/projects/ui/src/app/pages/apps-routes/app-list/app-list-pkg/app-list-pkg.component.ts @@ -1,11 +1,8 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core' -import { - MainStatus, - PackageDataEntry, - PackageMainStatus, -} from 'src/app/services/patch-db/data-model' +import { PackageDataEntry } from 'src/app/services/patch-db/data-model' import { PkgInfo } from 'src/app/util/get-package-info' import { UiLauncherService } from 'src/app/services/ui-launcher.service' +import { MainStatus } from '../../../../../../../../../core/startos/bindings/MainStatus' @Component({ selector: 'app-list-pkg', @@ -21,13 +18,13 @@ export class AppListPkgComponent { get pkgMainStatus(): MainStatus { return ( this.pkg.entry.status.main || { - status: PackageMainStatus.Stopped, + status: 'stopped', } ) } get sigtermTimeout(): string | null { - return this.pkgMainStatus.status === PackageMainStatus.Stopping + return this.pkgMainStatus.status === 'stopping' ? this.pkgMainStatus.timeout : null } diff --git a/web/projects/ui/src/app/pages/apps-routes/app-properties/app-properties.page.ts b/web/projects/ui/src/app/pages/apps-routes/app-properties/app-properties.page.ts index e3b4508a7..d9b6bbc3e 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-properties/app-properties.page.ts +++ b/web/projects/ui/src/app/pages/apps-routes/app-properties/app-properties.page.ts @@ -11,10 +11,7 @@ import { import { PackageProperties } from 'src/app/util/properties.util' import { QRComponent } from 'src/app/components/qr/qr.component' import { PatchDB } from 'patch-db-client' -import { - DataModel, - PackageMainStatus, -} from 'src/app/services/patch-db/data-model' +import { DataModel } from 'src/app/services/patch-db/data-model' import { ErrorToastService, getPkgId, @@ -42,7 +39,7 @@ export class AppPropertiesPage { stopped$ = this.patch .watch$('packageData', this.pkgId, 'status', 'main', 'status') - .pipe(map(status => status === PackageMainStatus.Stopped)) + .pipe(map(status => status === 'stopped')) @ViewChild(IonBackButtonDelegate, { static: false }) backButton?: IonBackButtonDelegate diff --git a/web/projects/ui/src/app/pages/apps-routes/app-show/app-show.page.ts b/web/projects/ui/src/app/pages/apps-routes/app-show/app-show.page.ts index 0c32c0ba2..52404aea3 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-show/app-show.page.ts +++ b/web/projects/ui/src/app/pages/apps-routes/app-show/app-show.page.ts @@ -26,7 +26,7 @@ import { isRestoring, isUpdating, } from 'src/app/util/get-package-data' -import { Manifest } from '@start9labs/marketplace' +import { Manifest } from '../../../../../../../../core/startos/bindings/Manifest' export interface DependencyInfo { id: string diff --git a/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-additional/app-show-additional.component.ts b/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-additional/app-show-additional.component.ts index 26281bb80..b639b216f 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-additional/app-show-additional.component.ts +++ b/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-additional/app-show-additional.component.ts @@ -3,7 +3,7 @@ import { ModalController, ToastController } from '@ionic/angular' import { copyToClipboard, MarkdownComponent } from '@start9labs/shared' import { from } from 'rxjs' import { ApiService } from 'src/app/services/api/embassy-api.service' -import { Manifest } from '@start9labs/marketplace' +import { Manifest } from '../../../../../../../../../../core/startos/bindings/Manifest' @Component({ selector: 'app-show-additional', diff --git a/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-health-checks/app-show-health-checks.component.ts b/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-health-checks/app-show-health-checks.component.ts index 5ecdf9a0f..ccf46a6e8 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-health-checks/app-show-health-checks.component.ts +++ b/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-health-checks/app-show-health-checks.component.ts @@ -1,11 +1,6 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core' import { ConnectionService } from 'src/app/services/connection.service' -import { - HealthCheckResult, - HealthResult, - MainStatus, -} from 'src/app/services/patch-db/data-model' -import { Manifest } from '@start9labs/marketplace' +import { HealthCheckResult } from '../../../../../../../../../../core/startos/bindings/HealthCheckResult' @Component({ selector: 'app-show-health-checks', @@ -21,12 +16,12 @@ export class AppShowHealthChecksComponent { constructor(private readonly connectionService: ConnectionService) {} - isLoading(result: HealthResult): boolean { - return result === HealthResult.Starting || result === HealthResult.Loading + isLoading(result: HealthCheckResult['result']): boolean { + return result === 'starting' || result === 'loading' } - isReady(result: HealthResult): boolean { - return result !== HealthResult.Failure && result !== HealthResult.Loading + isReady(result: HealthCheckResult['result']): boolean { + return result !== 'failure' && result !== 'loading' } asIsOrder() { diff --git a/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-progress/app-show-progress.component.ts b/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-progress/app-show-progress.component.ts index ab5c8e416..474b62f62 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-progress/app-show-progress.component.ts +++ b/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-progress/app-show-progress.component.ts @@ -1,5 +1,5 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core' -import { FullProgress } from 'src/app/services/patch-db/data-model' +import { FullProgress } from '../../../../../../../../../../core/startos/bindings/FullProgress' @Component({ selector: 'app-show-progress', diff --git a/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-status/app-show-status.component.ts b/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-status/app-show-status.component.ts index 2a1c47af7..d67ce2941 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-status/app-show-status.component.ts +++ b/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-status/app-show-status.component.ts @@ -8,8 +8,6 @@ import { import { DataModel, PackageDataEntry, - PackageMainStatus, - Status, } from 'src/app/services/patch-db/data-model' import { ErrorToastService } from '@start9labs/shared' import { AlertController, LoadingController } from '@ionic/angular' @@ -22,8 +20,9 @@ import { getManifest, getAllPackages, } from 'src/app/util/get-package-data' -import { Manifest } from '@start9labs/marketplace' import { PatchDB } from 'patch-db-client' +import { Status } from '../../../../../../../../../../core/startos/bindings/Status' +import { Manifest } from '../../../../../../../../../../core/startos/bindings/Manifest' @Component({ selector: 'app-show-status', @@ -84,7 +83,7 @@ export class AppShowStatusComponent { } get sigtermTimeout(): string | null { - return this.pkgStatus?.main.status === PackageMainStatus.Stopping + return this.pkgStatus?.main.status === 'stopping' ? this.pkgStatus.main.timeout : null } diff --git a/web/projects/ui/src/app/pages/apps-routes/app-show/pipes/health-color.pipe.ts b/web/projects/ui/src/app/pages/apps-routes/app-show/pipes/health-color.pipe.ts index a274aa8c0..a676c28f7 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-show/pipes/health-color.pipe.ts +++ b/web/projects/ui/src/app/pages/apps-routes/app-show/pipes/health-color.pipe.ts @@ -1,20 +1,20 @@ import { Pipe, PipeTransform } from '@angular/core' -import { HealthResult } from 'src/app/services/patch-db/data-model' +import { HealthCheckResult } from '../../../../../../../../../core/startos/bindings/HealthCheckResult' @Pipe({ name: 'healthColor', }) export class HealthColorPipe implements PipeTransform { - transform(val: HealthResult): string { + transform(val: HealthCheckResult['result']): string { switch (val) { - case HealthResult.Success: + case 'success': return 'success' - case HealthResult.Failure: + case 'failure': return 'warning' - case HealthResult.Disabled: + case 'disabled': return 'dark' - case HealthResult.Starting: - case HealthResult.Loading: + case 'starting': + case 'loading': return 'primary' } } diff --git a/web/projects/ui/src/app/pages/apps-routes/app-show/pipes/to-buttons.pipe.ts b/web/projects/ui/src/app/pages/apps-routes/app-show/pipes/to-buttons.pipe.ts index f26addee9..c51b4cac7 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-show/pipes/to-buttons.pipe.ts +++ b/web/projects/ui/src/app/pages/apps-routes/app-show/pipes/to-buttons.pipe.ts @@ -11,7 +11,7 @@ import { ModalService } from 'src/app/services/modal.service' import { ApiService } from 'src/app/services/api/embassy-api.service' import { from, map, Observable } from 'rxjs' import { PatchDB } from 'patch-db-client' -import { Manifest } from '@start9labs/marketplace' +import { Manifest } from '../../../../../../../../../core/startos/bindings/Manifest' export interface Button { title: string diff --git a/web/projects/ui/src/app/pages/apps-routes/app-show/pipes/to-health-checks.pipe.ts b/web/projects/ui/src/app/pages/apps-routes/app-show/pipes/to-health-checks.pipe.ts index 98265152b..63c31263a 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-show/pipes/to-health-checks.pipe.ts +++ b/web/projects/ui/src/app/pages/apps-routes/app-show/pipes/to-health-checks.pipe.ts @@ -1,14 +1,11 @@ import { Pipe, PipeTransform } from '@angular/core' -import { - DataModel, - HealthCheckResult, - PackageMainStatus, -} from 'src/app/services/patch-db/data-model' +import { DataModel } from 'src/app/services/patch-db/data-model' import { isEmptyObject } from '@start9labs/shared' import { map, startWith } from 'rxjs/operators' import { PatchDB } from 'patch-db-client' import { Observable } from 'rxjs' -import { Manifest } from '@start9labs/marketplace' +import { HealthCheckResult } from '../../../../../../../../../core/startos/bindings/HealthCheckResult' +import { Manifest } from '../../../../../../../../../core/startos/bindings/Manifest' @Pipe({ name: 'toHealthChecks', @@ -21,8 +18,7 @@ export class ToHealthChecksPipe implements PipeTransform { ): Observable | null> { return this.patch.watch$('packageData', manifest.id, 'status', 'main').pipe( map(main => { - return main.status === PackageMainStatus.Running && - !isEmptyObject(main.health) + return main.status === 'running' && !isEmptyObject(main.health) ? main.health : null }), diff --git a/web/projects/ui/src/app/pages/marketplace-routes/marketplace-show/marketplace-show-controls/marketplace-show-controls.component.ts b/web/projects/ui/src/app/pages/marketplace-routes/marketplace-show/marketplace-show-controls/marketplace-show-controls.component.ts index 10717cc19..a2e94aee0 100644 --- a/web/projects/ui/src/app/pages/marketplace-routes/marketplace-show/marketplace-show-controls/marketplace-show-controls.component.ts +++ b/web/projects/ui/src/app/pages/marketplace-routes/marketplace-show/marketplace-show-controls/marketplace-show-controls.component.ts @@ -7,7 +7,6 @@ import { import { AlertController, LoadingController } from '@ionic/angular' import { AbstractMarketplaceService, - Manifest, MarketplacePkg, } from '@start9labs/marketplace' import { diff --git a/web/projects/ui/src/app/pages/server-routes/server-backup/backing-up/backing-up.component.html b/web/projects/ui/src/app/pages/server-routes/server-backup/backing-up/backing-up.component.html index 7dcf4d793..d70291de9 100644 --- a/web/projects/ui/src/app/pages/server-routes/server-backup/backing-up/backing-up.component.html +++ b/web/projects/ui/src/app/pages/server-routes/server-backup/backing-up/backing-up.component.html @@ -35,7 +35,7 @@ > diff --git a/web/projects/ui/src/app/pages/server-routes/server-backup/backing-up/backing-up.component.ts b/web/projects/ui/src/app/pages/server-routes/server-backup/backing-up/backing-up.component.ts index 31d3bce1e..4a5d8951d 100644 --- a/web/projects/ui/src/app/pages/server-routes/server-backup/backing-up/backing-up.component.ts +++ b/web/projects/ui/src/app/pages/server-routes/server-backup/backing-up/backing-up.component.ts @@ -6,11 +6,9 @@ import { } from '@angular/core' import { PatchDB } from 'patch-db-client' import { take } from 'rxjs/operators' -import { - DataModel, - PackageMainStatus, -} from 'src/app/services/patch-db/data-model' +import { DataModel } from 'src/app/services/patch-db/data-model' import { Observable } from 'rxjs' +import { MainStatus } from '../../../../../../../../../core/startos/bindings/MainStatus' @Component({ selector: 'backing-up', @@ -32,7 +30,7 @@ export class BackingUpComponent { name: 'pkgMainStatus', }) export class PkgMainStatusPipe implements PipeTransform { - transform(pkgId: string): Observable { + transform(pkgId: string): Observable { return this.patch.watch$('packageData', pkgId, 'status', 'main', 'status') } diff --git a/web/projects/ui/src/app/pages/server-routes/sideload/sideload.page.ts b/web/projects/ui/src/app/pages/server-routes/sideload/sideload.page.ts index b834d084c..242b94172 100644 --- a/web/projects/ui/src/app/pages/server-routes/sideload/sideload.page.ts +++ b/web/projects/ui/src/app/pages/server-routes/sideload/sideload.page.ts @@ -4,7 +4,7 @@ import { ApiService } from 'src/app/services/api/embassy-api.service' import { ConfigService } from 'src/app/services/config.service' import cbor from 'cbor' import { ErrorToastService } from '@start9labs/shared' -import { Manifest } from '@start9labs/marketplace' +import { Manifest } from '../../../../../../../../core/startos/bindings/Manifest' interface Positions { [key: string]: [bigint, bigint] // [position, length] diff --git a/web/projects/ui/src/app/pages/updates/updates.page.ts b/web/projects/ui/src/app/pages/updates/updates.page.ts index 11d627cb5..a77dcb34f 100644 --- a/web/projects/ui/src/app/pages/updates/updates.page.ts +++ b/web/projects/ui/src/app/pages/updates/updates.page.ts @@ -10,7 +10,6 @@ import { MarketplaceService } from 'src/app/services/marketplace.service' import { AbstractMarketplaceService, Marketplace, - Manifest, MarketplacePkg, StoreIdentity, } from '@start9labs/marketplace' @@ -25,6 +24,7 @@ import { isUpdating, } from 'src/app/util/get-package-data' import { dryUpdate } from 'src/app/util/dry-update' +import { Manifest } from '../../../../../../../core/startos/bindings/Manifest' interface UpdatesData { hosts: StoreIdentity[] diff --git a/web/projects/ui/src/app/pipes/install-progress/install-progress.pipe.ts b/web/projects/ui/src/app/pipes/install-progress/install-progress.pipe.ts index 93e826bf7..7d6a646d0 100644 --- a/web/projects/ui/src/app/pipes/install-progress/install-progress.pipe.ts +++ b/web/projects/ui/src/app/pipes/install-progress/install-progress.pipe.ts @@ -1,5 +1,5 @@ import { Pipe, PipeTransform } from '@angular/core' -import { Progress } from 'src/app/services/patch-db/data-model' +import { Progress } from '../../../../../../../core/startos/bindings/Progress' @Pipe({ name: 'installingProgressString', diff --git a/web/projects/ui/src/app/pipes/launchable/launchable.pipe.ts b/web/projects/ui/src/app/pipes/launchable/launchable.pipe.ts index 668328820..d99e69c87 100644 --- a/web/projects/ui/src/app/pipes/launchable/launchable.pipe.ts +++ b/web/projects/ui/src/app/pipes/launchable/launchable.pipe.ts @@ -1,9 +1,7 @@ import { Pipe, PipeTransform } from '@angular/core' -import { - PackageMainStatus, - PackageState, -} from 'src/app/services/patch-db/data-model' import { ConfigService } from '../../services/config.service' +import { PackageState } from '../../../../../../../core/startos/bindings/PackageState' +import { MainStatus } from '../../../../../../../core/startos/bindings/MainStatus' @Pipe({ name: 'isLaunchable', @@ -11,7 +9,10 @@ import { ConfigService } from '../../services/config.service' export class LaunchablePipe implements PipeTransform { constructor(private configService: ConfigService) {} - transform(state: PackageState, status: PackageMainStatus): boolean { + transform( + state: PackageState['state'], + status: MainStatus['status'], + ): boolean { return this.configService.isLaunchable(state, status) } } diff --git a/web/projects/ui/src/app/pipes/ui/ui.pipe.ts b/web/projects/ui/src/app/pipes/ui/ui.pipe.ts index a6bbb52be..49ad380ad 100644 --- a/web/projects/ui/src/app/pipes/ui/ui.pipe.ts +++ b/web/projects/ui/src/app/pipes/ui/ui.pipe.ts @@ -2,7 +2,7 @@ import { Pipe, PipeTransform } from '@angular/core' import { PackageDataEntry } from '../../services/patch-db/data-model' import { hasUi } from '../../services/config.service' import { getManifest } from 'src/app/util/get-package-data' -import { Manifest } from '@start9labs/marketplace' +import { Manifest } from '../../../../../../../core/startos/bindings/Manifest' @Pipe({ name: 'hasUi', diff --git a/web/projects/ui/src/app/services/api/api.fixures.ts b/web/projects/ui/src/app/services/api/api.fixures.ts index 77c0a684c..4ceaff1f9 100644 --- a/web/projects/ui/src/app/services/api/api.fixures.ts +++ b/web/projects/ui/src/app/services/api/api.fixures.ts @@ -1,21 +1,16 @@ import { InstalledState, PackageDataEntry, - PackageMainStatus, - PackageState, - ServerStatusInfo, } from 'src/app/services/patch-db/data-model' import { Metric, NotificationLevel, RR, ServerNotifications } from './api.types' import { BTC_ICON, LND_ICON, PROXY_ICON } from './api-icons' -import { - DependencyMetadata, - Manifest, - MarketplacePkg, -} from '@start9labs/marketplace' +import { DependencyMetadata, MarketplacePkg } from '@start9labs/marketplace' import { Log } from '@start9labs/shared' +import { ServerStatus } from '../../../../../../../core/startos/bindings/ServerStatus' +import { Manifest } from '../../../../../../../core/startos/bindings/Manifest' export module Mock { - export const ServerUpdated: ServerStatusInfo = { + export const ServerUpdated: ServerStatus = { backupProgress: null, updateProgress: null, updated: true, @@ -75,16 +70,26 @@ export module Mock { osVersion: '0.2.12', dependencies: {}, hasConfig: true, + images: ['main'], + assets: [], + volumes: ['main'], + hardwareRequirements: { + device: {}, + arch: null, + ram: null, + }, } export const MockManifestLnd: Manifest = { id: 'lnd', title: 'Lightning Network Daemon', version: '0.11.1', + gitHash: 'abcdefgh', description: { short: 'A bolt spec compliant client.', long: 'More info about LND. More info about LND. More info about LND.', }, + replaces: ['banks', 'governments'], releaseNotes: 'Dual funded channels!', license: 'MIT', wrapperRepo: 'https://github.com/start9labs/lnd-wrapper', @@ -113,6 +118,14 @@ export module Mock { }, }, hasConfig: true, + images: ['main'], + assets: [], + volumes: ['main'], + hardwareRequirements: { + device: {}, + arch: null, + ram: null, + }, } export const MockManifestBitcoinProxy: Manifest = { @@ -145,7 +158,16 @@ export module Mock { optional: false, }, }, + replaces: [], hasConfig: false, + images: ['main'], + assets: [], + volumes: ['main'], + hardwareRequirements: { + device: {}, + arch: null, + ram: null, + }, } export const BitcoinDep: DependencyMetadata = { @@ -1376,7 +1398,7 @@ export module Mock { export const bitcoind: PackageDataEntry = { stateInfo: { - state: PackageState.Installed, + state: 'installed', manifest: MockManifestBitcoind, }, icon: '/assets/img/service-icons/bitcoind.svg', @@ -1384,7 +1406,7 @@ export module Mock { status: { configured: true, main: { - status: PackageMainStatus.Running, + status: 'running', started: new Date().toISOString(), health: {}, }, @@ -1408,9 +1430,10 @@ export module Mock { scheme: 'http', preferredExternalPort: 80, addSsl: { - addXForwardedHeaders: false, + // addXForwardedHeaders: false, preferredExternalPort: 443, scheme: 'https', + alpn: { specified: ['http/1.1', 'h2'] }, }, secure: null, }, @@ -1480,9 +1503,10 @@ export module Mock { scheme: 'http', preferredExternalPort: 80, addSsl: { - addXForwardedHeaders: false, + // addXForwardedHeaders: false, preferredExternalPort: 443, scheme: 'https', + alpn: { specified: ['http/1.1'] }, }, secure: null, }, @@ -1608,13 +1632,15 @@ export module Mock { }, }, currentDependencies: {}, + hosts: {}, + storeExposedDependents: [], marketplaceUrl: 'https://registry.start9.com/', developerKey: 'developer-key', } export const bitcoinProxy: PackageDataEntry = { stateInfo: { - state: PackageState.Installed, + state: 'installed', manifest: MockManifestBitcoinProxy, }, icon: '/assets/img/service-icons/btc-rpc-proxy.png', @@ -1622,7 +1648,7 @@ export module Mock { status: { configured: false, main: { - status: PackageMainStatus.Stopped, + status: 'stopped', }, dependencyConfigErrors: {}, }, @@ -1643,9 +1669,10 @@ export module Mock { scheme: 'http', preferredExternalPort: 80, addSsl: { - addXForwardedHeaders: false, + // addXForwardedHeaders: false, preferredExternalPort: 443, scheme: 'https', + alpn: { specified: ['http/1.1', 'h2'] }, }, secure: { ssl: true, @@ -1745,13 +1772,15 @@ export module Mock { healthChecks: [], }, }, + hosts: {}, + storeExposedDependents: [], marketplaceUrl: 'https://registry.start9.com/', developerKey: 'developer-key', } export const lnd: PackageDataEntry = { stateInfo: { - state: PackageState.Installed, + state: 'installed', manifest: MockManifestLnd, }, icon: '/assets/img/service-icons/lnd.png', @@ -1759,7 +1788,7 @@ export module Mock { status: { configured: true, main: { - status: PackageMainStatus.Stopped, + status: 'stopped', }, dependencyConfigErrors: { 'btc-rpc-proxy': 'Username not found', @@ -1993,9 +2022,10 @@ export module Mock { kind: 'exists', registryUrl: 'https://community-registry.start9.com', versionSpec: '>2.0.0', // @TODO - healthChecks: [], }, }, + hosts: {}, + storeExposedDependents: [], marketplaceUrl: 'https://registry.start9.com/', developerKey: 'developer-key', } diff --git a/web/projects/ui/src/app/services/api/api.types.ts b/web/projects/ui/src/app/services/api/api.types.ts index 0bab23a5a..43edea08e 100644 --- a/web/projects/ui/src/app/services/api/api.types.ts +++ b/web/projects/ui/src/app/services/api/api.types.ts @@ -1,12 +1,11 @@ import { Dump, Revision } from 'patch-db-client' -import { Manifest, MarketplacePkg, StoreInfo } from '@start9labs/marketplace' +import { MarketplacePkg, StoreInfo } from '@start9labs/marketplace' import { PackagePropertiesVersioned } from 'src/app/util/properties.util' import { ConfigSpec } from 'src/app/pkg-config/config-types' -import { - DataModel, - HealthCheckResult, -} from 'src/app/services/patch-db/data-model' +import { DataModel } from 'src/app/services/patch-db/data-model' import { StartOSDiskInfo, LogsRes, ServerLogsReq } from '@start9labs/shared' +import { HealthCheckResult } from '../../../../../../../core/startos/bindings/HealthCheckResult' +import { Manifest } from '../../../../../../../core/startos/bindings/Manifest' export module RR { // DB diff --git a/web/projects/ui/src/app/services/api/embassy-mock-api.service.ts b/web/projects/ui/src/app/services/api/embassy-mock-api.service.ts index 5f9b1b3bc..5cbc841ef 100644 --- a/web/projects/ui/src/app/services/api/embassy-mock-api.service.ts +++ b/web/projects/ui/src/app/services/api/embassy-mock-api.service.ts @@ -10,12 +10,8 @@ import { } from 'patch-db-client' import { DataModel, - FullProgress, InstallingState, PackageDataEntry, - PackageMainStatus, - PackageState, - ServerStatus, StateInfo, UpdatingState, } from 'src/app/services/patch-db/data-model' @@ -41,6 +37,8 @@ import { WebSocketSubjectConfig } from 'rxjs/webSocket' import { AuthService } from '../auth.service' import { ConnectionService } from '../connection.service' import { StoreInfo } from '@start9labs/marketplace' +import { FullProgress } from '../../../../../../../core/startos/bindings/FullProgress' +import { ServerStatus } from '../../../../../../../core/startos/bindings/ServerStatus' const PROGRESS: FullProgress = { overall: { @@ -576,7 +574,7 @@ export class MockApiService extends ApiService { { op: PatchOp.REPLACE, path: appPath, - value: PackageMainStatus.BackingUp, + value: 'backingUp', }, ] this.mockRevision(appPatch) @@ -586,7 +584,7 @@ export class MockApiService extends ApiService { this.mockRevision([ { ...appPatch[0], - value: PackageMainStatus.Stopped, + value: 'stopped', }, ]) this.mockRevision([ @@ -692,7 +690,7 @@ export class MockApiService extends ApiService { // state: PackageState.Installing, // if updating - state: PackageState.Updating, + state: 'updating', manifest: mockPatchData.packageData[params.id].stateInfo.manifest!, // both @@ -757,7 +755,7 @@ export class MockApiService extends ApiService { value: { ...Mock.LocalPkgs[id], stateInfo: { - state: PackageState.Restoring, + state: 'restoring', installingInfo: { newManifest: Mock.LocalPkgs[id].stateInfo.manifest!, progress: PROGRESS, @@ -789,7 +787,7 @@ export class MockApiService extends ApiService { { op: PatchOp.REPLACE, path: path + '/status', - value: PackageMainStatus.Running, + value: 'running', }, { op: PatchOp.REPLACE, @@ -849,7 +847,7 @@ export class MockApiService extends ApiService { { op: PatchOp.REPLACE, path: path + '/status', - value: PackageMainStatus.Starting, + value: 'starting', }, ] @@ -870,7 +868,7 @@ export class MockApiService extends ApiService { { op: PatchOp.REPLACE, path: path + '/status', - value: PackageMainStatus.Starting, + value: 'starting', }, { op: PatchOp.ADD, @@ -886,7 +884,7 @@ export class MockApiService extends ApiService { { op: PatchOp.REPLACE, path: path + '/status', - value: PackageMainStatus.Running, + value: 'running', }, { op: PatchOp.REMOVE, @@ -923,7 +921,7 @@ export class MockApiService extends ApiService { { op: PatchOp.REPLACE, path: path + '/status', - value: PackageMainStatus.Restarting, + value: 'restarting', }, { op: PatchOp.REPLACE, @@ -947,7 +945,7 @@ export class MockApiService extends ApiService { op: PatchOp.REPLACE, path: path, value: { - status: PackageMainStatus.Stopped, + status: 'stopped', }, }, ] @@ -959,7 +957,7 @@ export class MockApiService extends ApiService { op: PatchOp.REPLACE, path: path, value: { - status: PackageMainStatus.Stopping, + status: 'stopping', timeout: '35s', }, }, @@ -989,7 +987,7 @@ export class MockApiService extends ApiService { { op: PatchOp.REPLACE, path: `/packageData/${params.id}/stateInfo/state`, - value: PackageState.Removing, + value: 'removing', }, ] @@ -1105,7 +1103,7 @@ export class MockApiService extends ApiService { op: PatchOp.REPLACE, path: `/packageData/${id}/stateInfo`, value: { - state: PackageState.Installed, + state: 'installed', manifest: Mock.LocalPkgs[id].stateInfo.manifest, }, }, @@ -1149,11 +1147,11 @@ export class MockApiService extends ApiService { this.mockRevision(patch2) setTimeout(async () => { - const patch3: Operation[] = [ + const patch3: Operation[] = [ { op: PatchOp.REPLACE, - path: '/serverInfo/status', - value: ServerStatus.Updated, + path: '/serverInfo/statusInfo/updated', + value: true, }, { op: PatchOp.REMOVE, @@ -1167,7 +1165,7 @@ export class MockApiService extends ApiService { { op: PatchOp.REPLACE, path: '/serverInfo/status', - value: ServerStatus.Running, + value: 'running', }, ] this.mockRevision(patch4) diff --git a/web/projects/ui/src/app/services/api/mock-patch.ts b/web/projects/ui/src/app/services/api/mock-patch.ts index 00b57d2cc..3a8365b67 100644 --- a/web/projects/ui/src/app/services/api/mock-patch.ts +++ b/web/projects/ui/src/app/services/api/mock-patch.ts @@ -1,9 +1,4 @@ -import { - DataModel, - HealthResult, - PackageMainStatus, - PackageState, -} from 'src/app/services/patch-db/data-model' +import { DataModel } from 'src/app/services/patch-db/data-model' import { Mock } from './api.fixures' import { BUILT_IN_WIDGETS } from '../../pages/widgets/built-in/widgets' @@ -39,6 +34,8 @@ export const mockPatchData: DataModel = { ackInstructions: {}, }, serverInfo: { + arch: 'x86_64', + onionAddress: 'myveryownspecialtoraddress', id: 'abcdefgh', version: '0.3.5.1', lastBackup: new Date(new Date().valueOf() - 604800001).toISOString(), @@ -47,11 +44,15 @@ export const mockPatchData: DataModel = { ipInfo: { eth0: { ipv4: '10.0.0.1', + ipv4Range: '10.0.0.1/24', ipv6: null, + ipv6Range: null, }, wlan0: { ipv4: '10.0.90.12', + ipv4Range: '10.0.90.12/24', ipv6: 'FE80:CD00:0000:0CDE:1257:0000:211E:729CD', + ipv6Range: 'FE80:CD00:0000:0CDE:1257:0000:211E:729CD/64', }, }, lastWifiRegion: null, @@ -72,11 +73,18 @@ export const mockPatchData: DataModel = { caFingerprint: 'SHA-256: 63 2B 11 99 44 40 17 DF 37 FC C3 DF 0F 3D 15', ntpSynced: false, platform: 'x86_64-nonfree', + zram: true, + governor: 'performance', + wifi: { + ssids: [], + selected: null, + connected: null, + }, }, packageData: { bitcoind: { stateInfo: { - state: PackageState.Installed, + state: 'installed', manifest: { ...Mock.MockManifestBitcoind, version: '0.20.0', @@ -87,31 +95,31 @@ export const mockPatchData: DataModel = { status: { configured: true, main: { - status: PackageMainStatus.Running, + status: 'running', started: '2021-06-14T20:49:17.774Z', health: { 'ephemeral-health-check': { name: 'Ephemeral Health Check', - result: HealthResult.Starting, + result: 'starting', }, 'chain-state': { name: 'Chain State', - result: HealthResult.Loading, + result: 'loading', message: 'Bitcoin is syncing from genesis', }, 'p2p-interface': { name: 'P2P', - result: HealthResult.Success, + result: 'success', message: 'Health check successful', }, 'rpc-interface': { name: 'RPC', - result: HealthResult.Failure, + result: 'failure', message: 'RPC interface unreachable.', }, 'unnecessary-health-check': { name: 'Unnecessary Health Check', - result: HealthResult.Disabled, + result: 'disabled', }, }, }, @@ -135,9 +143,10 @@ export const mockPatchData: DataModel = { scheme: 'http', preferredExternalPort: 80, addSsl: { - addXForwardedHeaders: false, + // addXForwardedHeaders: false, preferredExternalPort: 443, scheme: 'https', + alpn: { specified: ['http/1.1', 'h2'] }, }, secure: null, }, @@ -207,9 +216,10 @@ export const mockPatchData: DataModel = { scheme: 'http', preferredExternalPort: 80, addSsl: { - addXForwardedHeaders: false, + // addXForwardedHeaders: false, preferredExternalPort: 443, scheme: 'https', + alpn: { specified: ['http/1.1'] }, }, secure: null, }, @@ -335,12 +345,14 @@ export const mockPatchData: DataModel = { }, }, currentDependencies: {}, + hosts: {}, + storeExposedDependents: [], marketplaceUrl: 'https://registry.start9.com/', developerKey: 'developer-key', }, lnd: { stateInfo: { - state: PackageState.Installed, + state: 'installed', manifest: { ...Mock.MockManifestLnd, version: '0.11.0', @@ -351,7 +363,7 @@ export const mockPatchData: DataModel = { status: { configured: true, main: { - status: PackageMainStatus.Stopped, + status: 'stopped', }, dependencyConfigErrors: { 'btc-rpc-proxy': 'This is a config unsatisfied error', @@ -586,6 +598,8 @@ export const mockPatchData: DataModel = { healthChecks: [], }, }, + hosts: {}, + storeExposedDependents: [], marketplaceUrl: 'https://registry.start9.com/', developerKey: 'developer-key', }, diff --git a/web/projects/ui/src/app/services/config.service.ts b/web/projects/ui/src/app/services/config.service.ts index 2bae31e63..eb53dd385 100644 --- a/web/projects/ui/src/app/services/config.service.ts +++ b/web/projects/ui/src/app/services/config.service.ts @@ -2,14 +2,12 @@ import { DOCUMENT } from '@angular/common' import { Inject, Injectable } from '@angular/core' import { WorkspaceConfig } from '@start9labs/shared' import { types } from '@start9labs/start-sdk' -import { - PackageDataEntry, - PackageMainStatus, - PackageState, -} from 'src/app/services/patch-db/data-model' - -type HostnameInfoIp = types.HostnameInfoIp -type HostnameInfoOnion = types.HostnameInfoOnion +import { PackageDataEntry } from 'src/app/services/patch-db/data-model' +import { PackageState } from '../../../../../../core/startos/bindings/PackageState' +import { MainStatus } from '../../../../../../core/startos/bindings/MainStatus' +import { ExportedOnionHostname } from '../../../../../../core/startos/bindings/ExportedOnionHostname' +import { ExportedIpHostname } from '../../../../../../core/startos/bindings/ExportedIpHostname' +import { ExportedHostnameInfo } from '../../../../../../core/startos/bindings/ExportedHostnameInfo' const { gitHash, @@ -56,10 +54,11 @@ export class ConfigService { return window.isSecureContext || this.isTor() } - isLaunchable(state: PackageState, status: PackageMainStatus): boolean { - return ( - state === PackageState.Installed && status === PackageMainStatus.Running - ) + isLaunchable( + state: PackageState['state'], + status: MainStatus['status'], + ): boolean { + return state === 'installed' && status === 'running' } /** ${scheme}://${username}@${host}:${externalPort}${suffix} */ @@ -76,31 +75,28 @@ export class ConfigService { const url = new URL(`${scheme}://${username}placeholder${suffix}`) if (host.kind === 'multi') { - const onionHostname = host.hostnames.find( - (h: any) => h.kind === 'onion', - ) as HostnameInfoOnion + const onionHostname = host.hostnames.find(h => h.kind === 'onion') + ?.hostname as ExportedOnionHostname if (this.isTor() && onionHostname) { - url.hostname = onionHostname.hostname.value + url.hostname = onionHostname.value } else { - const ipHostname = host.hostnames.find( - (h: any) => h.kind === 'ip', - ) as HostnameInfoIp + const ipHostname = host.hostnames.find(h => h.kind === 'ip') + ?.hostname as ExportedIpHostname if (!ipHostname) return '' url.hostname = this.hostname - url.port = String( - ipHostname.hostname.sslPort || ipHostname.hostname.port, - ) + url.port = String(ipHostname.sslPort || ipHostname.port) } } else { - const hostname = host.hostname + throw new Error('unimplemented') + const hostname = {} as ExportedHostnameInfo // host.hostname if (!hostname) return '' if (this.isTor() && hostname.kind === 'onion') { - url.hostname = hostname.hostname.value + url.hostname = (hostname.hostname as ExportedOnionHostname).value } else { url.hostname = this.hostname url.port = String(hostname.hostname.sslPort || hostname.hostname.port) diff --git a/web/projects/ui/src/app/services/dep-error.service.ts b/web/projects/ui/src/app/services/dep-error.service.ts index 1991f7bec..fe145055b 100644 --- a/web/projects/ui/src/app/services/dep-error.service.ts +++ b/web/projects/ui/src/app/services/dep-error.service.ts @@ -4,11 +4,8 @@ import { distinctUntilChanged, map, shareReplay } from 'rxjs/operators' import { PatchDB } from 'patch-db-client' import { DataModel, - HealthResult, InstalledState, PackageDataEntry, - PackageMainStatus, - PackageState, } from './patch-db/data-model' import * as deepEqual from 'fast-deep-equal' import { isInstalled } from '../util/get-package-data' @@ -79,7 +76,7 @@ export class DepErrorService { const dep = pkgs[depId] // not installed - if (!dep || dep.stateInfo.state !== PackageState.Installed) { + if (!dep || dep.stateInfo.state !== 'installed') { return { type: DependencyErrorType.NotInstalled, } @@ -107,19 +104,18 @@ export class DepErrorService { const depStatus = dep.status.main.status // not running - if ( - depStatus !== PackageMainStatus.Running && - depStatus !== PackageMainStatus.Starting - ) { + if (depStatus !== 'running' && depStatus !== 'starting') { return { type: DependencyErrorType.NotRunning, } } + const currentDep = pkg.currentDependencies[depId] + // health check failure - if (depStatus === PackageMainStatus.Running) { - for (let id of pkg.currentDependencies[depId].healthChecks) { - if (dep.status.main.health[id]?.result !== HealthResult.Success) { + if (depStatus === 'running' && currentDep.kind === 'running') { + for (let id of currentDep.healthChecks) { + if (dep.status.main.health[id]?.result !== 'success') { return { type: DependencyErrorType.HealthChecksFailed, } diff --git a/web/projects/ui/src/app/services/marketplace.service.ts b/web/projects/ui/src/app/services/marketplace.service.ts index ac9d4a8f4..30055df56 100644 --- a/web/projects/ui/src/app/services/marketplace.service.ts +++ b/web/projects/ui/src/app/services/marketplace.service.ts @@ -19,7 +19,11 @@ import { } from 'rxjs' import { RR } from 'src/app/services/api/api.types' import { ApiService } from 'src/app/services/api/embassy-api.service' -import { DataModel, UIStore } from 'src/app/services/patch-db/data-model' +import { + DataModel, + UIMarketplaceData, + UIStore, +} from 'src/app/services/patch-db/data-model' import { PatchDB } from 'patch-db-client' import { catchError, @@ -41,7 +45,7 @@ export class MarketplaceService implements AbstractMarketplaceService { private readonly knownHosts$: Observable = this.patch .watch$('ui', 'marketplace', 'knownHosts') .pipe( - map(hosts => { + map((hosts: UIMarketplaceData['knownHosts']) => { const { start9, community } = this.config.marketplace let arr = [ toStoreIdentity(start9, hosts[start9]), diff --git a/web/projects/ui/src/app/services/patch-db/data-model.ts b/web/projects/ui/src/app/services/patch-db/data-model.ts index 29761e300..b2446892e 100644 --- a/web/projects/ui/src/app/services/patch-db/data-model.ts +++ b/web/projects/ui/src/app/services/patch-db/data-model.ts @@ -1,13 +1,15 @@ import { Url } from '@start9labs/shared' -import { Manifest } from '@start9labs/marketplace' import { types } from '@start9labs/start-sdk' import { ActionMetadata } from '@start9labs/start-sdk/cjs/sdk/lib/types' +import { Public } from '../../../../../../../core/startos/bindings/Public' +import { PackageDataEntry as PDE } from '../../../../../../../core/startos/bindings/PackageDataEntry' +import { FullProgress } from '../../../../../../../core/startos/bindings/FullProgress' +import { Manifest } from '../../../../../../../core/startos/bindings/Manifest' type ServiceInterfaceWithHostInfo = types.ServiceInterfaceWithHostInfo -export interface DataModel { - serverInfo: ServerInfo - packageData: { [id: string]: PackageDataEntry } +export type DataModel = Public & { ui: UIData + packageData: Record } export interface UIData { @@ -50,197 +52,31 @@ export interface UIStore { name?: string } -export interface ServerInfo { - id: string - version: string - lastBackup: string | null - lanAddress: Url - torAddress: Url - ipInfo: IpInfo - lastWifiRegion: string | null - unreadNotificationCount: number - statusInfo: ServerStatusInfo - eosVersionCompat: string - passwordHash: string - hostname: string - pubkey: string - caFingerprint: string - ntpSynced: boolean - platform: string -} - -export interface IpInfo { - [iface: string]: { - ipv4: string | null - ipv6: string | null - } -} - -export interface ServerStatusInfo { - backupProgress: null | { - [packageId: string]: { - complete: boolean - } - } - updated: boolean - updateProgress: { size: number | null; downloaded: number } | null - restarting: boolean - shuttingDown: boolean -} - -export enum ServerStatus { - Running = 'running', - Updated = 'updated', - BackingUp = 'backing-up', -} - -export type PackageDataEntry = { +export type PackageDataEntry = PDE & { stateInfo: T - icon: Url - status: Status - actions: Record - lastBackup: string | null - currentDependencies: Record - serviceInterfaces: Record - marketplaceUrl: string | null - developerKey: string } export type StateInfo = InstalledState | InstallingState | UpdatingState export type InstalledState = { - state: PackageState.Installed | PackageState.Removing + state: 'installed' | 'removing' manifest: Manifest installingInfo?: undefined } export type InstallingState = { - state: PackageState.Installing | PackageState.Restoring + state: 'installing' | 'restoring' installingInfo: InstallingInfo manifest?: undefined } export type UpdatingState = { - state: PackageState.Updating + state: 'updating' installingInfo: InstallingInfo manifest: Manifest } -export enum PackageState { - Installing = 'installing', - Installed = 'installed', - Updating = 'updating', - Removing = 'removing', - Restoring = 'restoring', -} - -export interface CurrentDependencyInfo { - title: string - icon: string - kind: 'exists' | 'running' - registryUrl: string - versionSpec: string - healthChecks: string[] // array of health check IDs -} - -export interface Status { - configured: boolean - main: MainStatus - dependencyConfigErrors: { [id: string]: string | null } -} - -export type MainStatus = - | MainStatusStopped - | MainStatusStopping - | MainStatusStarting - | MainStatusRunning - | MainStatusBackingUp - | MainStatusRestarting - -export interface MainStatusStopped { - status: PackageMainStatus.Stopped -} - -export interface MainStatusStopping { - status: PackageMainStatus.Stopping - timeout: string -} - -export interface MainStatusStarting { - status: PackageMainStatus.Starting - restarting: boolean -} - -export interface MainStatusRunning { - status: PackageMainStatus.Running - started: string // UTC date string - health: Record -} - -export interface MainStatusBackingUp { - status: PackageMainStatus.BackingUp - started: string | null // UTC date string -} - -export interface MainStatusRestarting { - status: PackageMainStatus.Restarting -} - -export enum PackageMainStatus { - Starting = 'starting', - Running = 'running', - Stopping = 'stopping', - Stopped = 'stopped', - BackingUp = 'backing-up', - Restarting = 'restarting', -} - -export type HealthCheckResult = { name: string } & ( - | HealthCheckResultStarting - | HealthCheckResultLoading - | HealthCheckResultDisabled - | HealthCheckResultSuccess - | HealthCheckResultFailure -) - -export enum HealthResult { - Starting = 'starting', - Loading = 'loading', - Disabled = 'disabled', - Success = 'success', - Failure = 'failure', -} - -export interface HealthCheckResultStarting { - result: HealthResult.Starting -} - -export interface HealthCheckResultDisabled { - result: HealthResult.Disabled -} - -export interface HealthCheckResultSuccess { - result: HealthResult.Success - message: string -} - -export interface HealthCheckResultLoading { - result: HealthResult.Loading - message: string -} - -export interface HealthCheckResultFailure { - result: HealthResult.Failure - message: string -} - export type InstallingInfo = { progress: FullProgress newManifest: Manifest } - -export type FullProgress = { - overall: Progress - phases: { name: string; progress: Progress }[] -} -export type Progress = boolean | { done: number; total: number | null } // false means indeterminate. true means complete diff --git a/web/projects/ui/src/app/services/pkg-status-rendering.service.ts b/web/projects/ui/src/app/services/pkg-status-rendering.service.ts index 7e1f52b49..d95a5ccdc 100644 --- a/web/projects/ui/src/app/services/pkg-status-rendering.service.ts +++ b/web/projects/ui/src/app/services/pkg-status-rendering.service.ts @@ -1,12 +1,7 @@ import { isEmptyObject } from '@start9labs/shared' -import { - MainStatusStarting, - PackageDataEntry, - PackageMainStatus, - PackageState, - Status, -} from 'src/app/services/patch-db/data-model' +import { PackageDataEntry } from 'src/app/services/patch-db/data-model' import { PkgDependencyErrors } from './dep-error.service' +import { Status } from '../../../../../../core/startos/bindings/Status' export interface PackageStatus { primary: PrimaryStatus @@ -22,7 +17,7 @@ export function renderPkgStatus( let dependency: DependencyStatus | null = null let health: HealthStatus | null = null - if (pkg.stateInfo.state === PackageState.Installed) { + if (pkg.stateInfo.state === 'installed') { primary = getPrimaryStatus(pkg.status) dependency = getDependencyStatus(depErrors) health = getHealthStatus(pkg.status) @@ -36,7 +31,7 @@ export function renderPkgStatus( function getPrimaryStatus(status: Status): PrimaryStatus { if (!status.configured) { return PrimaryStatus.NeedsConfig - } else if ((status.main as MainStatusStarting).restarting) { + } else if (status.main.status === 'restarting') { return PrimaryStatus.Restarting } else { return status.main.status as any as PrimaryStatus @@ -50,7 +45,7 @@ function getDependencyStatus(depErrors: PkgDependencyErrors): DependencyStatus { } function getHealthStatus(status: Status): HealthStatus | null { - if (status.main.status !== PackageMainStatus.Running || !status.main.health) { + if (status.main.status !== 'running' || !status.main.health) { return null } diff --git a/web/projects/ui/src/app/util/get-package-data.ts b/web/projects/ui/src/app/util/get-package-data.ts index 244324501..08fbdd2df 100644 --- a/web/projects/ui/src/app/util/get-package-data.ts +++ b/web/projects/ui/src/app/util/get-package-data.ts @@ -4,11 +4,10 @@ import { InstalledState, InstallingState, PackageDataEntry, - PackageState, UpdatingState, } from 'src/app/services/patch-db/data-model' import { firstValueFrom } from 'rxjs' -import { Manifest } from '@start9labs/marketplace' +import { Manifest } from '../../../../../../core/startos/bindings/Manifest' export async function getPackage( patch: PatchDB, @@ -32,29 +31,29 @@ export function getManifest(pkg: PackageDataEntry): Manifest { export function isInstalled( pkg: PackageDataEntry, ): pkg is PackageDataEntry { - return pkg.stateInfo.state === PackageState.Installed + return pkg.stateInfo.state === 'installed' } export function isRemoving( pkg: PackageDataEntry, ): pkg is PackageDataEntry { - return pkg.stateInfo.state === PackageState.Removing + return pkg.stateInfo.state === 'removing' } export function isInstalling( pkg: PackageDataEntry, ): pkg is PackageDataEntry { - return pkg.stateInfo.state === PackageState.Installing + return pkg.stateInfo.state === 'installing' } export function isRestoring( pkg: PackageDataEntry, ): pkg is PackageDataEntry { - return pkg.stateInfo.state === PackageState.Restoring + return pkg.stateInfo.state === 'restoring' } export function isUpdating( pkg: PackageDataEntry, ): pkg is PackageDataEntry { - return pkg.stateInfo.state === PackageState.Updating + return pkg.stateInfo.state === 'updating' } diff --git a/web/projects/ui/src/app/util/get-server-info.ts b/web/projects/ui/src/app/util/get-server-info.ts index 08eecd451..ba4bf0dbf 100644 --- a/web/projects/ui/src/app/util/get-server-info.ts +++ b/web/projects/ui/src/app/util/get-server-info.ts @@ -1,6 +1,7 @@ import { PatchDB } from 'patch-db-client' -import { DataModel, ServerInfo } from 'src/app/services/patch-db/data-model' +import { DataModel } from 'src/app/services/patch-db/data-model' import { firstValueFrom } from 'rxjs' +import { ServerInfo } from '../../../../../../core/startos/bindings/ServerInfo' export async function getServerInfo( patch: PatchDB, From 65ca038eee4b32600a4fc8f0b68ce6be6d1842b6 Mon Sep 17 00:00:00 2001 From: J H Date: Thu, 28 Mar 2024 10:40:47 -0600 Subject: [PATCH 06/25] chore: Update and fix the things --- sdk/lib/emverLite/mod.ts | 1 - sdk/lib/health/HealthCheck.ts | 12 +++++++----- sdk/lib/health/checkFns/checkPortListening.ts | 2 +- sdk/lib/health/checkFns/checkWebUrl.ts | 2 +- sdk/lib/health/checkFns/runHealthScript.ts | 2 +- sdk/lib/mainFn/Daemons.ts | 2 +- sdk/lib/trigger/changeOnFirstSuccess.ts | 2 +- sdk/lib/trigger/successFailure.ts | 4 ++-- sdk/lib/types.ts | 8 +------- 9 files changed, 15 insertions(+), 20 deletions(-) diff --git a/sdk/lib/emverLite/mod.ts b/sdk/lib/emverLite/mod.ts index dd68360ac..f69d4f35d 100644 --- a/sdk/lib/emverLite/mod.ts +++ b/sdk/lib/emverLite/mod.ts @@ -179,7 +179,6 @@ export class Checker { * @returns */ static parse(range: string | Checker): Checker { - console.log(`Parser (${range})`) if (range instanceof Checker) { return range } diff --git a/sdk/lib/health/HealthCheck.ts b/sdk/lib/health/HealthCheck.ts index 488ecdcf5..e1fbee97b 100644 --- a/sdk/lib/health/HealthCheck.ts +++ b/sdk/lib/health/HealthCheck.ts @@ -40,19 +40,21 @@ export function healthCheck(o: { const { status, message } = await o.fn(overlay) await o.effects.setHealth({ name: o.name, - status, - message, + id: o.name, + result: status, + message: message || "", }) currentValue.hadSuccess = true - currentValue.lastResult = "passing" + currentValue.lastResult = "success" await triggerFirstSuccess().catch((err) => { console.error(err) }) } catch (e) { await o.effects.setHealth({ name: o.name, - status: "failure", - message: asMessage(e), + id: o.name, + result: "failure", + message: asMessage(e) || "", }) currentValue.lastResult = "failure" } diff --git a/sdk/lib/health/checkFns/checkPortListening.ts b/sdk/lib/health/checkFns/checkPortListening.ts index 89dcf89b3..4cc0738da 100644 --- a/sdk/lib/health/checkFns/checkPortListening.ts +++ b/sdk/lib/health/checkFns/checkPortListening.ts @@ -45,7 +45,7 @@ export async function checkPortListening( port, ) if (hasAddress) { - return { status: "passing", message: options.successMessage } + return { status: "success", message: options.successMessage } } return { status: "failure", diff --git a/sdk/lib/health/checkFns/checkWebUrl.ts b/sdk/lib/health/checkFns/checkWebUrl.ts index d18509ee3..8f61ae2ef 100644 --- a/sdk/lib/health/checkFns/checkWebUrl.ts +++ b/sdk/lib/health/checkFns/checkWebUrl.ts @@ -22,7 +22,7 @@ export const checkWebUrl = async ( .then( (x) => ({ - status: "passing", + status: "success", message: successMessage, }) as const, ) diff --git a/sdk/lib/health/checkFns/runHealthScript.ts b/sdk/lib/health/checkFns/runHealthScript.ts index 5d69f5e17..f0f41ee91 100644 --- a/sdk/lib/health/checkFns/runHealthScript.ts +++ b/sdk/lib/health/checkFns/runHealthScript.ts @@ -32,7 +32,7 @@ export const runHealthScript = async ( throw { status: "failure", message: errorMessage } as CheckResult }) return { - status: "passing", + status: "success", message: message(res.stdout.toString()), } as CheckResult } diff --git a/sdk/lib/mainFn/Daemons.ts b/sdk/lib/mainFn/Daemons.ts index 540ca3d37..640ab8c4b 100644 --- a/sdk/lib/mainFn/Daemons.ts +++ b/sdk/lib/mainFn/Daemons.ts @@ -227,7 +227,7 @@ export class Daemons { }) as CheckResult, ) currentInput.lastResult = response.status || null - if (!currentInput.hadSuccess && response.status === "passing") { + if (!currentInput.hadSuccess && response.status === "success") { currentInput.hadSuccess = true resolve(child) } diff --git a/sdk/lib/trigger/changeOnFirstSuccess.ts b/sdk/lib/trigger/changeOnFirstSuccess.ts index 28129e3e5..4c45afe31 100644 --- a/sdk/lib/trigger/changeOnFirstSuccess.ts +++ b/sdk/lib/trigger/changeOnFirstSuccess.ts @@ -11,7 +11,7 @@ export function changeOnFirstSuccess(o: { beforeFirstSuccess.next() for ( let res = await beforeFirstSuccess.next(); - currentValue?.lastResult !== "passing" && !res.done; + currentValue?.lastResult !== "success" && !res.done; res = await beforeFirstSuccess.next() ) { yield diff --git a/sdk/lib/trigger/successFailure.ts b/sdk/lib/trigger/successFailure.ts index 1886402c4..1bab27289 100644 --- a/sdk/lib/trigger/successFailure.ts +++ b/sdk/lib/trigger/successFailure.ts @@ -12,7 +12,7 @@ export function successFailure(o: { beforeSuccess.next() for ( let res = await beforeSuccess.next(); - currentValue?.lastResult !== "passing" && !res.done; + currentValue?.lastResult !== "success" && !res.done; res = await beforeSuccess.next() ) { yield @@ -21,7 +21,7 @@ export function successFailure(o: { const duringError = o.duringError(getInput) for ( let res = await duringError.next(); - currentValue?.lastResult === "passing" && !res.done; + currentValue?.lastResult === "success" && !res.done; res = await duringError.next() ) { yield diff --git a/sdk/lib/types.ts b/sdk/lib/types.ts index daa7ffe43..3ddf79a36 100644 --- a/sdk/lib/types.ts +++ b/sdk/lib/types.ts @@ -143,13 +143,7 @@ export type Daemon = { [DaemonProof]: never } -export type HealthStatus = - | `passing` - | `disabled` - | `starting` - | `warning` - | `failure` - +export type HealthStatus = HealthCheckResult["result"] export type SmtpValue = { server: string port: number From 8ce6535a7e524d1b606536935afcc20295825b1f Mon Sep 17 00:00:00 2001 From: J H Date: Thu, 28 Mar 2024 10:51:51 -0600 Subject: [PATCH 07/25] chore: Update the types for container runtime --- .../Systems/SystemForEmbassy/MainLoop.ts | 49 +++++++++++-------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/container-runtime/src/Adapters/Systems/SystemForEmbassy/MainLoop.ts b/container-runtime/src/Adapters/Systems/SystemForEmbassy/MainLoop.ts index 69e3e6615..8e4b0e446 100644 --- a/container-runtime/src/Adapters/Systems/SystemForEmbassy/MainLoop.ts +++ b/container-runtime/src/Adapters/Systems/SystemForEmbassy/MainLoop.ts @@ -113,25 +113,24 @@ export class MainLoop { if (executed.exitCode === 59) { await effects.setHealth({ name: healthId, - status: "disabled", - message: - executed.stderr.toString() || executed.stdout.toString(), + id: healthId, + result: "disabled", }) return } if (executed.exitCode === 60) { await effects.setHealth({ name: healthId, - status: "starting", - message: - executed.stderr.toString() || executed.stdout.toString(), + id: healthId, + result: "starting", }) return } if (executed.exitCode === 61) { await effects.setHealth({ name: healthId, - status: "warning", + id: healthId, + result: "failure", message: executed.stderr.toString() || executed.stdout.toString(), }) @@ -142,14 +141,16 @@ export class MainLoop { if (!!errorMessage) { await effects.setHealth({ name: healthId, - status: "failure", - message: errorMessage, + id: healthId, + result: "failure", + message: errorMessage || "", }) return } await effects.setHealth({ name: healthId, - status: "passing", + id: healthId, + result: "success", message, }) return @@ -160,7 +161,8 @@ export class MainLoop { if (!method) { await effects.setHealth({ name: healthId, - status: "failure", + id: healthId, + result: "failure", message: `Expecting that thejs health check ${healthId} exists`, }) return @@ -173,16 +175,18 @@ export class MainLoop { if ("result" in result) { await effects.setHealth({ - message: null, + message: "", name: healthId, - status: "passing", + id: healthId, + result: "success", }) return } if ("error" in result) { await effects.setHealth({ name: healthId, - status: "failure", + id: healthId, + result: "failure", message: result.error, }) return @@ -190,7 +194,8 @@ export class MainLoop { if (!("error-code" in result)) { await effects.setHealth({ name: healthId, - status: "failure", + id: healthId, + result: "failure", message: `Unknown error type ${JSON.stringify(result)}`, }) return @@ -199,23 +204,24 @@ export class MainLoop { if (code === 59) { await effects.setHealth({ name: healthId, - status: "disabled", - message, + id: healthId, + result: "disabled", }) return } if (code === 60) { await effects.setHealth({ name: healthId, - status: "starting", - message, + id: healthId, + result: "starting", }) return } if (code === 61) { await effects.setHealth({ name: healthId, - status: "warning", + id: healthId, + result: "failure", message, }) return @@ -223,7 +229,8 @@ export class MainLoop { await effects.setHealth({ name: healthId, - status: "failure", + id: healthId, + result: "failure", message: `${result["error-code"][0]}: ${result["error-code"][1]}`, }) return From 86d61d698a46a3c6f8e52e632d31d463ebbfbe2c Mon Sep 17 00:00:00 2001 From: Aiden McClelland Date: Thu, 28 Mar 2024 11:20:20 -0600 Subject: [PATCH 08/25] update types and format bindings --- Makefile | 3 +- .../Systems/SystemForEmbassy/MainLoop.ts | 67 +++++++++++-------- core/startos/bindings/ActionId.ts | 2 +- core/startos/bindings/ActionMetadata.ts | 10 ++- core/startos/bindings/AddSslOptions.ts | 6 +- core/startos/bindings/AddressInfo.ts | 7 +- core/startos/bindings/Alerts.ts | 8 ++- core/startos/bindings/Algorithm.ts | 2 +- core/startos/bindings/AllPackageData.ts | 2 +- core/startos/bindings/AllowedStatuses.ts | 2 +- core/startos/bindings/AlpnInfo.ts | 2 +- core/startos/bindings/BackupProgress.ts | 2 +- core/startos/bindings/BindInfo.ts | 2 +- core/startos/bindings/BindOptions.ts | 7 +- core/startos/bindings/BindParams.ts | 10 ++- core/startos/bindings/Callback.ts | 2 +- core/startos/bindings/ChrootParams.ts | 9 ++- .../bindings/CreateOverlayedImageParams.ts | 2 +- core/startos/bindings/CurrentDependencies.ts | 2 +- .../startos/bindings/CurrentDependencyInfo.ts | 7 +- core/startos/bindings/DataUrl.ts | 2 +- core/startos/bindings/DepInfo.ts | 2 +- core/startos/bindings/Dependencies.ts | 2 +- .../bindings/DependencyConfigErrors.ts | 2 +- core/startos/bindings/DependencyKind.ts | 2 +- .../startos/bindings/DependencyRequirement.ts | 10 ++- core/startos/bindings/Description.ts | 2 +- .../bindings/DestroyOverlayedImageParams.ts | 2 +- core/startos/bindings/Duration.ts | 2 +- core/startos/bindings/ExecuteAction.ts | 6 +- core/startos/bindings/ExportActionParams.ts | 2 +- .../bindings/ExportServiceInterfaceParams.ts | 11 ++- core/startos/bindings/ExportedHostInfo.ts | 6 +- core/startos/bindings/ExportedHostnameInfo.ts | 9 ++- core/startos/bindings/ExportedIpHostname.ts | 17 ++++- .../startos/bindings/ExportedOnionHostname.ts | 6 +- .../bindings/ExposeForDependentsParams.ts | 2 +- core/startos/bindings/FullProgress.ts | 2 +- core/startos/bindings/GetHostInfoParams.ts | 7 +- .../startos/bindings/GetHostInfoParamsKind.ts | 2 +- core/startos/bindings/GetPrimaryUrlParams.ts | 6 +- .../bindings/GetServiceInterfaceParams.ts | 6 +- .../bindings/GetServicePortForwardParams.ts | 5 +- .../bindings/GetSslCertificateParams.ts | 6 +- core/startos/bindings/GetSslKeyParams.ts | 6 +- core/startos/bindings/GetStoreParams.ts | 2 +- core/startos/bindings/GetSystemSmtpParams.ts | 2 +- core/startos/bindings/Governor.ts | 2 +- core/startos/bindings/HardwareRequirements.ts | 6 +- core/startos/bindings/HealthCheckId.ts | 2 +- core/startos/bindings/HealthCheckResult.ts | 8 ++- core/startos/bindings/Host.ts | 7 +- core/startos/bindings/HostAddress.ts | 2 +- core/startos/bindings/HostId.ts | 2 +- core/startos/bindings/HostInfo.ts | 2 +- core/startos/bindings/HostKind.ts | 2 +- core/startos/bindings/ImageId.ts | 2 +- core/startos/bindings/InstalledState.ts | 2 +- core/startos/bindings/InstallingInfo.ts | 2 +- core/startos/bindings/InstallingState.ts | 2 +- core/startos/bindings/IpInfo.ts | 7 +- .../bindings/ListServiceInterfacesParams.ts | 5 +- core/startos/bindings/MainStatus.ts | 16 ++++- core/startos/bindings/Manifest.ts | 24 ++++++- core/startos/bindings/MaybeUtf8String.ts | 2 +- core/startos/bindings/MountParams.ts | 2 +- core/startos/bindings/MountTarget.ts | 7 +- core/startos/bindings/NamedProgress.ts | 2 +- core/startos/bindings/PackageDataEntry.ts | 16 ++++- core/startos/bindings/PackageId.ts | 2 +- core/startos/bindings/PackageState.ts | 7 +- core/startos/bindings/ParamsMaybePackageId.ts | 2 +- core/startos/bindings/ParamsPackageId.ts | 2 +- core/startos/bindings/Progress.ts | 2 +- core/startos/bindings/Public.ts | 6 +- core/startos/bindings/RemoveActionParams.ts | 2 +- core/startos/bindings/RemoveAddressParams.ts | 2 +- core/startos/bindings/ReverseProxyBind.ts | 6 +- .../bindings/ReverseProxyDestination.ts | 6 +- core/startos/bindings/ReverseProxyHttp.ts | 2 +- core/startos/bindings/ReverseProxyParams.ts | 6 +- core/startos/bindings/Security.ts | 2 +- core/startos/bindings/ServerInfo.ts | 38 ++++++++--- core/startos/bindings/ServerSpecs.ts | 2 +- core/startos/bindings/ServerStatus.ts | 8 ++- core/startos/bindings/ServiceInterface.ts | 11 ++- core/startos/bindings/ServiceInterfaceId.ts | 2 +- core/startos/bindings/ServiceInterfaceType.ts | 2 +- .../bindings/ServiceInterfaceWithHostInfo.ts | 12 +++- core/startos/bindings/SetConfigured.ts | 2 +- .../startos/bindings/SetDependenciesParams.ts | 4 +- core/startos/bindings/SetHealth.ts | 8 ++- core/startos/bindings/SetMainStatus.ts | 2 +- core/startos/bindings/SetStoreParams.ts | 2 +- core/startos/bindings/Status.ts | 6 +- core/startos/bindings/UpdateProgress.ts | 2 +- core/startos/bindings/UpdatingState.ts | 5 +- core/startos/bindings/VolumeId.ts | 2 +- core/startos/bindings/WifiInfo.ts | 6 +- core/startos/src/status/health_check.rs | 28 ++++++-- .../ui/src/app/services/api/mock-patch.ts | 2 + 101 files changed, 457 insertions(+), 139 deletions(-) diff --git a/Makefile b/Makefile index f19b40b47..9a6dee60f 100644 --- a/Makefile +++ b/Makefile @@ -176,11 +176,12 @@ container-runtime/node_modules: container-runtime/package.json container-runtime core/startos/bindings: $(shell git ls-files core) $(ENVIRONMENT_FILE) $(PLATFORM_FILE) rm -rf core/startos/bindings (cd core/ && cargo test) + npm --prefix sdk exec -- prettier -w ./core/startos/bindings/*.ts sdk/lib/test: $(shell git ls-files sdk) core/startos/bindings (cd sdk && make test) -sdk/dist: $(shell git ls-files sdk) +sdk/dist: $(shell git ls-files sdk) core/startos/bindings (cd sdk && make bundle) container-runtime/dist: container-runtime/node_modules $(shell git ls-files container-runtime/src) container-runtime/package.json container-runtime/tsconfig.json diff --git a/container-runtime/src/Adapters/Systems/SystemForEmbassy/MainLoop.ts b/container-runtime/src/Adapters/Systems/SystemForEmbassy/MainLoop.ts index 69e3e6615..17fd13468 100644 --- a/container-runtime/src/Adapters/Systems/SystemForEmbassy/MainLoop.ts +++ b/container-runtime/src/Adapters/Systems/SystemForEmbassy/MainLoop.ts @@ -112,8 +112,9 @@ export class MainLoop { ]) if (executed.exitCode === 59) { await effects.setHealth({ - name: healthId, - status: "disabled", + id: healthId, + name: value.name, + result: "disabled", message: executed.stderr.toString() || executed.stdout.toString(), }) @@ -121,8 +122,9 @@ export class MainLoop { } if (executed.exitCode === 60) { await effects.setHealth({ - name: healthId, - status: "starting", + id: healthId, + name: value.name, + result: "starting", message: executed.stderr.toString() || executed.stdout.toString(), }) @@ -130,8 +132,9 @@ export class MainLoop { } if (executed.exitCode === 61) { await effects.setHealth({ - name: healthId, - status: "warning", + id: healthId, + name: value.name, + result: "loading", message: executed.stderr.toString() || executed.stdout.toString(), }) @@ -141,15 +144,17 @@ export class MainLoop { const message = executed.stdout.toString() if (!!errorMessage) { await effects.setHealth({ - name: healthId, - status: "failure", + id: healthId, + name: value.name, + result: "failure", message: errorMessage, }) return } await effects.setHealth({ - name: healthId, - status: "passing", + id: healthId, + name: value.name, + result: "success", message, }) return @@ -159,9 +164,10 @@ export class MainLoop { const method = moduleCode.health?.[healthId] if (!method) { await effects.setHealth({ - name: healthId, - status: "failure", - message: `Expecting that thejs health check ${healthId} exists`, + id: healthId, + name: value.name, + result: "failure", + message: `Expecting that the js health check ${healthId} exists`, }) return } @@ -173,24 +179,27 @@ export class MainLoop { if ("result" in result) { await effects.setHealth({ + id: healthId, + name: value.name, + result: "success", message: null, - name: healthId, - status: "passing", }) return } if ("error" in result) { await effects.setHealth({ - name: healthId, - status: "failure", + id: healthId, + name: value.name, + result: "failure", message: result.error, }) return } if (!("error-code" in result)) { await effects.setHealth({ - name: healthId, - status: "failure", + id: healthId, + name: value.name, + result: "failure", message: `Unknown error type ${JSON.stringify(result)}`, }) return @@ -198,32 +207,36 @@ export class MainLoop { const [code, message] = result["error-code"] if (code === 59) { await effects.setHealth({ - name: healthId, - status: "disabled", + id: healthId, + name: value.name, + result: "disabled", message, }) return } if (code === 60) { await effects.setHealth({ - name: healthId, - status: "starting", + id: healthId, + name: value.name, + result: "starting", message, }) return } if (code === 61) { await effects.setHealth({ - name: healthId, - status: "warning", + id: healthId, + name: value.name, + result: "loading", message, }) return } await effects.setHealth({ - name: healthId, - status: "failure", + id: healthId, + name: value.name, + result: "failure", message: `${result["error-code"][0]}: ${result["error-code"][1]}`, }) return diff --git a/core/startos/bindings/ActionId.ts b/core/startos/bindings/ActionId.ts index 7c05d2b3c..9bb1f9990 100644 --- a/core/startos/bindings/ActionId.ts +++ b/core/startos/bindings/ActionId.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type ActionId = string; \ No newline at end of file +export type ActionId = string; diff --git a/core/startos/bindings/ActionMetadata.ts b/core/startos/bindings/ActionMetadata.ts index e787190c8..c9373a5b8 100644 --- a/core/startos/bindings/ActionMetadata.ts +++ b/core/startos/bindings/ActionMetadata.ts @@ -1,4 +1,12 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { AllowedStatuses } from "./AllowedStatuses"; -export type ActionMetadata = { name: string, description: string, warning: string | null, input: any, disabled: boolean, allowedStatuses: AllowedStatuses, group: string | null, }; \ No newline at end of file +export type ActionMetadata = { + name: string; + description: string; + warning: string | null; + input: any; + disabled: boolean; + allowedStatuses: AllowedStatuses; + group: string | null; +}; diff --git a/core/startos/bindings/AddSslOptions.ts b/core/startos/bindings/AddSslOptions.ts index fcf2d63d4..984a1a7c6 100644 --- a/core/startos/bindings/AddSslOptions.ts +++ b/core/startos/bindings/AddSslOptions.ts @@ -1,4 +1,8 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { AlpnInfo } from "./AlpnInfo"; -export type AddSslOptions = { scheme: string | null, preferredExternalPort: number, alpn: AlpnInfo, }; \ No newline at end of file +export type AddSslOptions = { + scheme: string | null; + preferredExternalPort: number; + alpn: AlpnInfo; +}; diff --git a/core/startos/bindings/AddressInfo.ts b/core/startos/bindings/AddressInfo.ts index 6bc42c0e9..1355f72a2 100644 --- a/core/startos/bindings/AddressInfo.ts +++ b/core/startos/bindings/AddressInfo.ts @@ -2,4 +2,9 @@ import type { BindOptions } from "./BindOptions"; import type { HostId } from "./HostId"; -export type AddressInfo = { username: string | null, hostId: HostId, bindOptions: BindOptions, suffix: string, }; \ No newline at end of file +export type AddressInfo = { + username: string | null; + hostId: HostId; + bindOptions: BindOptions; + suffix: string; +}; diff --git a/core/startos/bindings/Alerts.ts b/core/startos/bindings/Alerts.ts index 4956bfa95..c6a671e83 100644 --- a/core/startos/bindings/Alerts.ts +++ b/core/startos/bindings/Alerts.ts @@ -1,3 +1,9 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type Alerts = { install: string | null, uninstall: string | null, restore: string | null, start: string | null, stop: string | null, }; \ No newline at end of file +export type Alerts = { + install: string | null; + uninstall: string | null; + restore: string | null; + start: string | null; + stop: string | null; +}; diff --git a/core/startos/bindings/Algorithm.ts b/core/startos/bindings/Algorithm.ts index d12447f04..877325fdf 100644 --- a/core/startos/bindings/Algorithm.ts +++ b/core/startos/bindings/Algorithm.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type Algorithm = "ecdsa" | "ed25519"; \ No newline at end of file +export type Algorithm = "ecdsa" | "ed25519"; diff --git a/core/startos/bindings/AllPackageData.ts b/core/startos/bindings/AllPackageData.ts index 74827426a..c7698d10d 100644 --- a/core/startos/bindings/AllPackageData.ts +++ b/core/startos/bindings/AllPackageData.ts @@ -2,4 +2,4 @@ import type { PackageDataEntry } from "./PackageDataEntry"; import type { PackageId } from "./PackageId"; -export type AllPackageData = { [key: PackageId]: PackageDataEntry }; \ No newline at end of file +export type AllPackageData = { [key: PackageId]: PackageDataEntry }; diff --git a/core/startos/bindings/AllowedStatuses.ts b/core/startos/bindings/AllowedStatuses.ts index a5c7f5d2d..a04ee2bac 100644 --- a/core/startos/bindings/AllowedStatuses.ts +++ b/core/startos/bindings/AllowedStatuses.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type AllowedStatuses = "onlyRunning" | "onlyStopped" | "any"; \ No newline at end of file +export type AllowedStatuses = "onlyRunning" | "onlyStopped" | "any"; diff --git a/core/startos/bindings/AlpnInfo.ts b/core/startos/bindings/AlpnInfo.ts index 2a760d235..eac072fc0 100644 --- a/core/startos/bindings/AlpnInfo.ts +++ b/core/startos/bindings/AlpnInfo.ts @@ -1,4 +1,4 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { MaybeUtf8String } from "./MaybeUtf8String"; -export type AlpnInfo = "reflect" | { "specified": Array }; \ No newline at end of file +export type AlpnInfo = "reflect" | { specified: Array }; diff --git a/core/startos/bindings/BackupProgress.ts b/core/startos/bindings/BackupProgress.ts index 4a480dc93..42812a7b7 100644 --- a/core/startos/bindings/BackupProgress.ts +++ b/core/startos/bindings/BackupProgress.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type BackupProgress = { complete: boolean, }; \ No newline at end of file +export type BackupProgress = { complete: boolean }; diff --git a/core/startos/bindings/BindInfo.ts b/core/startos/bindings/BindInfo.ts index d42ed2d25..8bda6d37e 100644 --- a/core/startos/bindings/BindInfo.ts +++ b/core/startos/bindings/BindInfo.ts @@ -1,4 +1,4 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { BindOptions } from "./BindOptions"; -export type BindInfo = { options: BindOptions, assignedLanPort: number | null, }; \ No newline at end of file +export type BindInfo = { options: BindOptions; assignedLanPort: number | null }; diff --git a/core/startos/bindings/BindOptions.ts b/core/startos/bindings/BindOptions.ts index 9043c5f57..6b12139a7 100644 --- a/core/startos/bindings/BindOptions.ts +++ b/core/startos/bindings/BindOptions.ts @@ -2,4 +2,9 @@ import type { AddSslOptions } from "./AddSslOptions"; import type { Security } from "./Security"; -export type BindOptions = { scheme: string | null, preferredExternalPort: number, addSsl: AddSslOptions | null, secure: Security | null, }; \ No newline at end of file +export type BindOptions = { + scheme: string | null; + preferredExternalPort: number; + addSsl: AddSslOptions | null; + secure: Security | null; +}; diff --git a/core/startos/bindings/BindParams.ts b/core/startos/bindings/BindParams.ts index 07a8033bc..4aa78e522 100644 --- a/core/startos/bindings/BindParams.ts +++ b/core/startos/bindings/BindParams.ts @@ -4,4 +4,12 @@ import type { HostId } from "./HostId"; import type { HostKind } from "./HostKind"; import type { Security } from "./Security"; -export type BindParams = { kind: HostKind, id: HostId, internalPort: number, scheme: string | null, preferredExternalPort: number, addSsl: AddSslOptions | null, secure: Security | null, }; \ No newline at end of file +export type BindParams = { + kind: HostKind; + id: HostId; + internalPort: number; + scheme: string | null; + preferredExternalPort: number; + addSsl: AddSslOptions | null; + secure: Security | null; +}; diff --git a/core/startos/bindings/Callback.ts b/core/startos/bindings/Callback.ts index 9c4cacab0..e6c5b004f 100644 --- a/core/startos/bindings/Callback.ts +++ b/core/startos/bindings/Callback.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type Callback = () => void; \ No newline at end of file +export type Callback = () => void; diff --git a/core/startos/bindings/ChrootParams.ts b/core/startos/bindings/ChrootParams.ts index d8d1b1b46..9ee6e8959 100644 --- a/core/startos/bindings/ChrootParams.ts +++ b/core/startos/bindings/ChrootParams.ts @@ -1,3 +1,10 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type ChrootParams = { env: string | null, workdir: string | null, user: string | null, path: string, command: string, args: string[], }; \ No newline at end of file +export type ChrootParams = { + env: string | null; + workdir: string | null; + user: string | null; + path: string; + command: string; + args: string[]; +}; diff --git a/core/startos/bindings/CreateOverlayedImageParams.ts b/core/startos/bindings/CreateOverlayedImageParams.ts index 65e7487b6..d17f2e8c1 100644 --- a/core/startos/bindings/CreateOverlayedImageParams.ts +++ b/core/startos/bindings/CreateOverlayedImageParams.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type CreateOverlayedImageParams = { imageId: string, }; \ No newline at end of file +export type CreateOverlayedImageParams = { imageId: string }; diff --git a/core/startos/bindings/CurrentDependencies.ts b/core/startos/bindings/CurrentDependencies.ts index 55fb68501..75645e200 100644 --- a/core/startos/bindings/CurrentDependencies.ts +++ b/core/startos/bindings/CurrentDependencies.ts @@ -2,4 +2,4 @@ import type { CurrentDependencyInfo } from "./CurrentDependencyInfo"; import type { PackageId } from "./PackageId"; -export type CurrentDependencies = { [key: PackageId]: CurrentDependencyInfo }; \ No newline at end of file +export type CurrentDependencies = { [key: PackageId]: CurrentDependencyInfo }; diff --git a/core/startos/bindings/CurrentDependencyInfo.ts b/core/startos/bindings/CurrentDependencyInfo.ts index a253afa38..10112e312 100644 --- a/core/startos/bindings/CurrentDependencyInfo.ts +++ b/core/startos/bindings/CurrentDependencyInfo.ts @@ -1,4 +1,9 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { DataUrl } from "./DataUrl"; -export type CurrentDependencyInfo = { title: string, icon: DataUrl, registryUrl: string, versionSpec: string, } & ({ "kind": "exists" } | { "kind": "running", healthChecks: string[], }); \ No newline at end of file +export type CurrentDependencyInfo = { + title: string; + icon: DataUrl; + registryUrl: string; + versionSpec: string; +} & ({ kind: "exists" } | { kind: "running"; healthChecks: string[] }); diff --git a/core/startos/bindings/DataUrl.ts b/core/startos/bindings/DataUrl.ts index 835512711..65fa15059 100644 --- a/core/startos/bindings/DataUrl.ts +++ b/core/startos/bindings/DataUrl.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type DataUrl = string; \ No newline at end of file +export type DataUrl = string; diff --git a/core/startos/bindings/DepInfo.ts b/core/startos/bindings/DepInfo.ts index 8320d83eb..3c01e0939 100644 --- a/core/startos/bindings/DepInfo.ts +++ b/core/startos/bindings/DepInfo.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type DepInfo = { description: string | null, optional: boolean, }; \ No newline at end of file +export type DepInfo = { description: string | null; optional: boolean }; diff --git a/core/startos/bindings/Dependencies.ts b/core/startos/bindings/Dependencies.ts index a84adec24..974495b7b 100644 --- a/core/startos/bindings/Dependencies.ts +++ b/core/startos/bindings/Dependencies.ts @@ -2,4 +2,4 @@ import type { DepInfo } from "./DepInfo"; import type { PackageId } from "./PackageId"; -export type Dependencies = { [key: PackageId]: DepInfo }; \ No newline at end of file +export type Dependencies = { [key: PackageId]: DepInfo }; diff --git a/core/startos/bindings/DependencyConfigErrors.ts b/core/startos/bindings/DependencyConfigErrors.ts index 23281aa89..5f2246fa9 100644 --- a/core/startos/bindings/DependencyConfigErrors.ts +++ b/core/startos/bindings/DependencyConfigErrors.ts @@ -1,4 +1,4 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { PackageId } from "./PackageId"; -export type DependencyConfigErrors = { [key: PackageId]: string }; \ No newline at end of file +export type DependencyConfigErrors = { [key: PackageId]: string }; diff --git a/core/startos/bindings/DependencyKind.ts b/core/startos/bindings/DependencyKind.ts index 018562971..71fd49762 100644 --- a/core/startos/bindings/DependencyKind.ts +++ b/core/startos/bindings/DependencyKind.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type DependencyKind = "exists" | "running"; \ No newline at end of file +export type DependencyKind = "exists" | "running"; diff --git a/core/startos/bindings/DependencyRequirement.ts b/core/startos/bindings/DependencyRequirement.ts index 40b78b473..e6224ce48 100644 --- a/core/startos/bindings/DependencyRequirement.ts +++ b/core/startos/bindings/DependencyRequirement.ts @@ -1,3 +1,11 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type DependencyRequirement = { "kind": "running", id: string, healthChecks: string[], versionSpec: string, registryUrl: string, } | { "kind": "exists", id: string, versionSpec: string, registryUrl: string, }; \ No newline at end of file +export type DependencyRequirement = + | { + kind: "running"; + id: string; + healthChecks: string[]; + versionSpec: string; + registryUrl: string; + } + | { kind: "exists"; id: string; versionSpec: string; registryUrl: string }; diff --git a/core/startos/bindings/Description.ts b/core/startos/bindings/Description.ts index da4b0d1bf..918bd09c5 100644 --- a/core/startos/bindings/Description.ts +++ b/core/startos/bindings/Description.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type Description = { short: string, long: string, }; \ No newline at end of file +export type Description = { short: string; long: string }; diff --git a/core/startos/bindings/DestroyOverlayedImageParams.ts b/core/startos/bindings/DestroyOverlayedImageParams.ts index 34d4085a1..47671604a 100644 --- a/core/startos/bindings/DestroyOverlayedImageParams.ts +++ b/core/startos/bindings/DestroyOverlayedImageParams.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type DestroyOverlayedImageParams = { guid: string, }; \ No newline at end of file +export type DestroyOverlayedImageParams = { guid: string }; diff --git a/core/startos/bindings/Duration.ts b/core/startos/bindings/Duration.ts index ac44b7c87..889c729b8 100644 --- a/core/startos/bindings/Duration.ts +++ b/core/startos/bindings/Duration.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type Duration = string; \ No newline at end of file +export type Duration = string; diff --git a/core/startos/bindings/ExecuteAction.ts b/core/startos/bindings/ExecuteAction.ts index 52636bdbc..aaa340747 100644 --- a/core/startos/bindings/ExecuteAction.ts +++ b/core/startos/bindings/ExecuteAction.ts @@ -1,3 +1,7 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type ExecuteAction = { serviceId: string | null, actionId: string, input: any, }; \ No newline at end of file +export type ExecuteAction = { + serviceId: string | null; + actionId: string; + input: any; +}; diff --git a/core/startos/bindings/ExportActionParams.ts b/core/startos/bindings/ExportActionParams.ts index d19fc6905..4961c4a11 100644 --- a/core/startos/bindings/ExportActionParams.ts +++ b/core/startos/bindings/ExportActionParams.ts @@ -1,4 +1,4 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { ActionMetadata } from "./ActionMetadata"; -export type ExportActionParams = { id: string, metadata: ActionMetadata, }; \ No newline at end of file +export type ExportActionParams = { id: string; metadata: ActionMetadata }; diff --git a/core/startos/bindings/ExportServiceInterfaceParams.ts b/core/startos/bindings/ExportServiceInterfaceParams.ts index ad7885507..93deb0ce5 100644 --- a/core/startos/bindings/ExportServiceInterfaceParams.ts +++ b/core/startos/bindings/ExportServiceInterfaceParams.ts @@ -2,4 +2,13 @@ import type { AddressInfo } from "./AddressInfo"; import type { ServiceInterfaceType } from "./ServiceInterfaceType"; -export type ExportServiceInterfaceParams = { id: string, name: string, description: string, hasPrimary: boolean, disabled: boolean, masked: boolean, addressInfo: AddressInfo, type: ServiceInterfaceType, }; \ No newline at end of file +export type ExportServiceInterfaceParams = { + id: string; + name: string; + description: string; + hasPrimary: boolean; + disabled: boolean; + masked: boolean; + addressInfo: AddressInfo; + type: ServiceInterfaceType; +}; diff --git a/core/startos/bindings/ExportedHostInfo.ts b/core/startos/bindings/ExportedHostInfo.ts index c4d36bd61..d8339a074 100644 --- a/core/startos/bindings/ExportedHostInfo.ts +++ b/core/startos/bindings/ExportedHostInfo.ts @@ -3,4 +3,8 @@ import type { ExportedHostnameInfo } from "./ExportedHostnameInfo"; import type { HostId } from "./HostId"; import type { HostKind } from "./HostKind"; -export type ExportedHostInfo = { id: HostId, kind: HostKind, hostnames: Array, }; \ No newline at end of file +export type ExportedHostInfo = { + id: HostId; + kind: HostKind; + hostnames: Array; +}; diff --git a/core/startos/bindings/ExportedHostnameInfo.ts b/core/startos/bindings/ExportedHostnameInfo.ts index 086fd95b1..23cbdd487 100644 --- a/core/startos/bindings/ExportedHostnameInfo.ts +++ b/core/startos/bindings/ExportedHostnameInfo.ts @@ -2,4 +2,11 @@ import type { ExportedIpHostname } from "./ExportedIpHostname"; import type { ExportedOnionHostname } from "./ExportedOnionHostname"; -export type ExportedHostnameInfo = { "kind": "ip", networkInterfaceId: string, public: boolean, hostname: ExportedIpHostname, } | { "kind": "onion", hostname: ExportedOnionHostname, }; \ No newline at end of file +export type ExportedHostnameInfo = + | { + kind: "ip"; + networkInterfaceId: string; + public: boolean; + hostname: ExportedIpHostname; + } + | { kind: "onion"; hostname: ExportedOnionHostname }; diff --git a/core/startos/bindings/ExportedIpHostname.ts b/core/startos/bindings/ExportedIpHostname.ts index 7d012fecc..1e02ab2be 100644 --- a/core/startos/bindings/ExportedIpHostname.ts +++ b/core/startos/bindings/ExportedIpHostname.ts @@ -1,3 +1,18 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type ExportedIpHostname = { "kind": "ipv4", value: string, port: number | null, sslPort: number | null, } | { "kind": "ipv6", value: string, port: number | null, sslPort: number | null, } | { "kind": "local", value: string, port: number | null, sslPort: number | null, } | { "kind": "domain", domain: string, subdomain: string | null, port: number | null, sslPort: number | null, }; \ No newline at end of file +export type ExportedIpHostname = + | { kind: "ipv4"; value: string; port: number | null; sslPort: number | null } + | { kind: "ipv6"; value: string; port: number | null; sslPort: number | null } + | { + kind: "local"; + value: string; + port: number | null; + sslPort: number | null; + } + | { + kind: "domain"; + domain: string; + subdomain: string | null; + port: number | null; + sslPort: number | null; + }; diff --git a/core/startos/bindings/ExportedOnionHostname.ts b/core/startos/bindings/ExportedOnionHostname.ts index 82fee09e3..af072289f 100644 --- a/core/startos/bindings/ExportedOnionHostname.ts +++ b/core/startos/bindings/ExportedOnionHostname.ts @@ -1,3 +1,7 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type ExportedOnionHostname = { value: string, port: number | null, sslPort: number | null, }; \ No newline at end of file +export type ExportedOnionHostname = { + value: string; + port: number | null; + sslPort: number | null; +}; diff --git a/core/startos/bindings/ExposeForDependentsParams.ts b/core/startos/bindings/ExposeForDependentsParams.ts index 9626f4dcf..714771c1e 100644 --- a/core/startos/bindings/ExposeForDependentsParams.ts +++ b/core/startos/bindings/ExposeForDependentsParams.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type ExposeForDependentsParams = { paths: string[], }; \ No newline at end of file +export type ExposeForDependentsParams = { paths: string[] }; diff --git a/core/startos/bindings/FullProgress.ts b/core/startos/bindings/FullProgress.ts index 0c6a96832..56f6a1a15 100644 --- a/core/startos/bindings/FullProgress.ts +++ b/core/startos/bindings/FullProgress.ts @@ -2,4 +2,4 @@ import type { NamedProgress } from "./NamedProgress"; import type { Progress } from "./Progress"; -export type FullProgress = { overall: Progress, phases: Array, }; \ No newline at end of file +export type FullProgress = { overall: Progress; phases: Array }; diff --git a/core/startos/bindings/GetHostInfoParams.ts b/core/startos/bindings/GetHostInfoParams.ts index 69abeeb13..7c2b1b6b6 100644 --- a/core/startos/bindings/GetHostInfoParams.ts +++ b/core/startos/bindings/GetHostInfoParams.ts @@ -2,4 +2,9 @@ import type { Callback } from "./Callback"; import type { GetHostInfoParamsKind } from "./GetHostInfoParamsKind"; -export type GetHostInfoParams = { kind: GetHostInfoParamsKind | null, serviceInterfaceId: string, packageId: string | null, callback: Callback, }; \ No newline at end of file +export type GetHostInfoParams = { + kind: GetHostInfoParamsKind | null; + serviceInterfaceId: string; + packageId: string | null; + callback: Callback; +}; diff --git a/core/startos/bindings/GetHostInfoParamsKind.ts b/core/startos/bindings/GetHostInfoParamsKind.ts index 6d401f685..6353044ce 100644 --- a/core/startos/bindings/GetHostInfoParamsKind.ts +++ b/core/startos/bindings/GetHostInfoParamsKind.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type GetHostInfoParamsKind = "multi"; \ No newline at end of file +export type GetHostInfoParamsKind = "multi"; diff --git a/core/startos/bindings/GetPrimaryUrlParams.ts b/core/startos/bindings/GetPrimaryUrlParams.ts index 6296d4342..c5aaa0ebe 100644 --- a/core/startos/bindings/GetPrimaryUrlParams.ts +++ b/core/startos/bindings/GetPrimaryUrlParams.ts @@ -1,4 +1,8 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { Callback } from "./Callback"; -export type GetPrimaryUrlParams = { packageId: string | null, serviceInterfaceId: string, callback: Callback, }; \ No newline at end of file +export type GetPrimaryUrlParams = { + packageId: string | null; + serviceInterfaceId: string; + callback: Callback; +}; diff --git a/core/startos/bindings/GetServiceInterfaceParams.ts b/core/startos/bindings/GetServiceInterfaceParams.ts index 1eb2b6f28..03990c10b 100644 --- a/core/startos/bindings/GetServiceInterfaceParams.ts +++ b/core/startos/bindings/GetServiceInterfaceParams.ts @@ -1,4 +1,8 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { Callback } from "./Callback"; -export type GetServiceInterfaceParams = { packageId: string | null, serviceInterfaceId: string, callback: Callback, }; \ No newline at end of file +export type GetServiceInterfaceParams = { + packageId: string | null; + serviceInterfaceId: string; + callback: Callback; +}; diff --git a/core/startos/bindings/GetServicePortForwardParams.ts b/core/startos/bindings/GetServicePortForwardParams.ts index dd4eaf211..3de7e0219 100644 --- a/core/startos/bindings/GetServicePortForwardParams.ts +++ b/core/startos/bindings/GetServicePortForwardParams.ts @@ -1,3 +1,6 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type GetServicePortForwardParams = { packageId: string | null, internalPort: number, }; \ No newline at end of file +export type GetServicePortForwardParams = { + packageId: string | null; + internalPort: number; +}; diff --git a/core/startos/bindings/GetSslCertificateParams.ts b/core/startos/bindings/GetSslCertificateParams.ts index a4a2447cd..a1fd17bdd 100644 --- a/core/startos/bindings/GetSslCertificateParams.ts +++ b/core/startos/bindings/GetSslCertificateParams.ts @@ -1,4 +1,8 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { Algorithm } from "./Algorithm"; -export type GetSslCertificateParams = { packageId: string | null, hostId: string, algorithm: Algorithm | null, }; \ No newline at end of file +export type GetSslCertificateParams = { + packageId: string | null; + hostId: string; + algorithm: Algorithm | null; +}; diff --git a/core/startos/bindings/GetSslKeyParams.ts b/core/startos/bindings/GetSslKeyParams.ts index eb36cd2f5..8c5170c9c 100644 --- a/core/startos/bindings/GetSslKeyParams.ts +++ b/core/startos/bindings/GetSslKeyParams.ts @@ -1,4 +1,8 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { Algorithm } from "./Algorithm"; -export type GetSslKeyParams = { packageId: string | null, hostId: string, algorithm: Algorithm | null, }; \ No newline at end of file +export type GetSslKeyParams = { + packageId: string | null; + hostId: string; + algorithm: Algorithm | null; +}; diff --git a/core/startos/bindings/GetStoreParams.ts b/core/startos/bindings/GetStoreParams.ts index 6b965e75f..bfd97377b 100644 --- a/core/startos/bindings/GetStoreParams.ts +++ b/core/startos/bindings/GetStoreParams.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type GetStoreParams = { packageId: string | null, path: string, }; \ No newline at end of file +export type GetStoreParams = { packageId: string | null; path: string }; diff --git a/core/startos/bindings/GetSystemSmtpParams.ts b/core/startos/bindings/GetSystemSmtpParams.ts index 25d30529f..b96b9f595 100644 --- a/core/startos/bindings/GetSystemSmtpParams.ts +++ b/core/startos/bindings/GetSystemSmtpParams.ts @@ -1,4 +1,4 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { Callback } from "./Callback"; -export type GetSystemSmtpParams = { callback: Callback, }; \ No newline at end of file +export type GetSystemSmtpParams = { callback: Callback }; diff --git a/core/startos/bindings/Governor.ts b/core/startos/bindings/Governor.ts index 9e0bb14e2..82c9e39f1 100644 --- a/core/startos/bindings/Governor.ts +++ b/core/startos/bindings/Governor.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type Governor = string; \ No newline at end of file +export type Governor = string; diff --git a/core/startos/bindings/HardwareRequirements.ts b/core/startos/bindings/HardwareRequirements.ts index 5a28d0cbc..079483289 100644 --- a/core/startos/bindings/HardwareRequirements.ts +++ b/core/startos/bindings/HardwareRequirements.ts @@ -1,3 +1,7 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type HardwareRequirements = { device: { [key: string]: string }, ram: bigint | null, arch: Array | null, }; \ No newline at end of file +export type HardwareRequirements = { + device: { [key: string]: string }; + ram: bigint | null; + arch: Array | null; +}; diff --git a/core/startos/bindings/HealthCheckId.ts b/core/startos/bindings/HealthCheckId.ts index d9b6b7ca8..eeefafbb1 100644 --- a/core/startos/bindings/HealthCheckId.ts +++ b/core/startos/bindings/HealthCheckId.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type HealthCheckId = string; \ No newline at end of file +export type HealthCheckId = string; diff --git a/core/startos/bindings/HealthCheckResult.ts b/core/startos/bindings/HealthCheckResult.ts index a539fc805..ae4d3c3c2 100644 --- a/core/startos/bindings/HealthCheckResult.ts +++ b/core/startos/bindings/HealthCheckResult.ts @@ -1,3 +1,9 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type HealthCheckResult = { name: string, } & ({ "result": "success", message: string, } | { "result": "disabled" } | { "result": "starting" } | { "result": "loading", message: string, } | { "result": "failure", message: string, }); \ No newline at end of file +export type HealthCheckResult = { name: string } & ( + | { result: "success"; message: string | null } + | { result: "disabled"; message: string | null } + | { result: "starting"; message: string | null } + | { result: "loading"; message: string } + | { result: "failure"; message: string } +); diff --git a/core/startos/bindings/Host.ts b/core/startos/bindings/Host.ts index a08704ad2..4188cb404 100644 --- a/core/startos/bindings/Host.ts +++ b/core/startos/bindings/Host.ts @@ -3,4 +3,9 @@ import type { BindInfo } from "./BindInfo"; import type { HostAddress } from "./HostAddress"; import type { HostKind } from "./HostKind"; -export type Host = { kind: HostKind, bindings: { [key: number]: BindInfo }, addresses: Array, primary: HostAddress | null, }; \ No newline at end of file +export type Host = { + kind: HostKind; + bindings: { [key: number]: BindInfo }; + addresses: Array; + primary: HostAddress | null; +}; diff --git a/core/startos/bindings/HostAddress.ts b/core/startos/bindings/HostAddress.ts index f013cb540..9cddf778b 100644 --- a/core/startos/bindings/HostAddress.ts +++ b/core/startos/bindings/HostAddress.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type HostAddress = { "kind": "onion", address: string, }; \ No newline at end of file +export type HostAddress = { kind: "onion"; address: string }; diff --git a/core/startos/bindings/HostId.ts b/core/startos/bindings/HostId.ts index 1aef70f2a..23049a51d 100644 --- a/core/startos/bindings/HostId.ts +++ b/core/startos/bindings/HostId.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type HostId = string; \ No newline at end of file +export type HostId = string; diff --git a/core/startos/bindings/HostInfo.ts b/core/startos/bindings/HostInfo.ts index 3d2a34f14..b69dbf6b4 100644 --- a/core/startos/bindings/HostInfo.ts +++ b/core/startos/bindings/HostInfo.ts @@ -2,4 +2,4 @@ import type { Host } from "./Host"; import type { HostId } from "./HostId"; -export type HostInfo = { [key: HostId]: Host }; \ No newline at end of file +export type HostInfo = { [key: HostId]: Host }; diff --git a/core/startos/bindings/HostKind.ts b/core/startos/bindings/HostKind.ts index 1ad1bd95e..09e61b91b 100644 --- a/core/startos/bindings/HostKind.ts +++ b/core/startos/bindings/HostKind.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type HostKind = "multi"; \ No newline at end of file +export type HostKind = "multi"; diff --git a/core/startos/bindings/ImageId.ts b/core/startos/bindings/ImageId.ts index 9adb82d7a..408331f72 100644 --- a/core/startos/bindings/ImageId.ts +++ b/core/startos/bindings/ImageId.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type ImageId = string; \ No newline at end of file +export type ImageId = string; diff --git a/core/startos/bindings/InstalledState.ts b/core/startos/bindings/InstalledState.ts index 3608a5ba0..053c3ae66 100644 --- a/core/startos/bindings/InstalledState.ts +++ b/core/startos/bindings/InstalledState.ts @@ -1,4 +1,4 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { Manifest } from "./Manifest"; -export type InstalledState = { manifest: Manifest, }; \ No newline at end of file +export type InstalledState = { manifest: Manifest }; diff --git a/core/startos/bindings/InstallingInfo.ts b/core/startos/bindings/InstallingInfo.ts index c3d13c984..7627f4502 100644 --- a/core/startos/bindings/InstallingInfo.ts +++ b/core/startos/bindings/InstallingInfo.ts @@ -2,4 +2,4 @@ import type { FullProgress } from "./FullProgress"; import type { Manifest } from "./Manifest"; -export type InstallingInfo = { newManifest: Manifest, progress: FullProgress, }; \ No newline at end of file +export type InstallingInfo = { newManifest: Manifest; progress: FullProgress }; diff --git a/core/startos/bindings/InstallingState.ts b/core/startos/bindings/InstallingState.ts index b7cfea14c..3203cfd6b 100644 --- a/core/startos/bindings/InstallingState.ts +++ b/core/startos/bindings/InstallingState.ts @@ -1,4 +1,4 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { InstallingInfo } from "./InstallingInfo"; -export type InstallingState = { installingInfo: InstallingInfo, }; \ No newline at end of file +export type InstallingState = { installingInfo: InstallingInfo }; diff --git a/core/startos/bindings/IpInfo.ts b/core/startos/bindings/IpInfo.ts index 756d87219..1208fafb9 100644 --- a/core/startos/bindings/IpInfo.ts +++ b/core/startos/bindings/IpInfo.ts @@ -1,3 +1,8 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type IpInfo = { ipv4Range: string | null, ipv4: string | null, ipv6Range: string | null, ipv6: string | null, }; \ No newline at end of file +export type IpInfo = { + ipv4Range: string | null; + ipv4: string | null; + ipv6Range: string | null; + ipv6: string | null; +}; diff --git a/core/startos/bindings/ListServiceInterfacesParams.ts b/core/startos/bindings/ListServiceInterfacesParams.ts index cd889b149..03d1cdfc8 100644 --- a/core/startos/bindings/ListServiceInterfacesParams.ts +++ b/core/startos/bindings/ListServiceInterfacesParams.ts @@ -1,4 +1,7 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { Callback } from "./Callback"; -export type ListServiceInterfacesParams = { packageId: string | null, callback: Callback, }; \ No newline at end of file +export type ListServiceInterfacesParams = { + packageId: string | null; + callback: Callback; +}; diff --git a/core/startos/bindings/MainStatus.ts b/core/startos/bindings/MainStatus.ts index 25482e113..878213087 100644 --- a/core/startos/bindings/MainStatus.ts +++ b/core/startos/bindings/MainStatus.ts @@ -3,4 +3,18 @@ import type { Duration } from "./Duration"; import type { HealthCheckId } from "./HealthCheckId"; import type { HealthCheckResult } from "./HealthCheckResult"; -export type MainStatus = { "status": "stopped" } | { "status": "restarting" } | { "status": "stopping", timeout: Duration, } | { "status": "starting" } | { "status": "running", started: string, health: { [key: HealthCheckId]: HealthCheckResult }, } | { "status": "backingUp", started: string | null, health: { [key: HealthCheckId]: HealthCheckResult }, }; \ No newline at end of file +export type MainStatus = + | { status: "stopped" } + | { status: "restarting" } + | { status: "stopping"; timeout: Duration } + | { status: "starting" } + | { + status: "running"; + started: string; + health: { [key: HealthCheckId]: HealthCheckResult }; + } + | { + status: "backingUp"; + started: string | null; + health: { [key: HealthCheckId]: HealthCheckResult }; + }; diff --git a/core/startos/bindings/Manifest.ts b/core/startos/bindings/Manifest.ts index 0eb91251b..688486a7d 100644 --- a/core/startos/bindings/Manifest.ts +++ b/core/startos/bindings/Manifest.ts @@ -7,4 +7,26 @@ import type { ImageId } from "./ImageId"; import type { PackageId } from "./PackageId"; import type { VolumeId } from "./VolumeId"; -export type Manifest = { id: PackageId, title: string, version: string, releaseNotes: string, license: string, replaces: Array, wrapperRepo: string, upstreamRepo: string, supportSite: string, marketingSite: string, donationUrl: string | null, description: Description, images: Array, assets: Array, volumes: Array, alerts: Alerts, dependencies: Dependencies, hardwareRequirements: HardwareRequirements, gitHash: string | null, osVersion: string, hasConfig: boolean, }; \ No newline at end of file +export type Manifest = { + id: PackageId; + title: string; + version: string; + releaseNotes: string; + license: string; + replaces: Array; + wrapperRepo: string; + upstreamRepo: string; + supportSite: string; + marketingSite: string; + donationUrl: string | null; + description: Description; + images: Array; + assets: Array; + volumes: Array; + alerts: Alerts; + dependencies: Dependencies; + hardwareRequirements: HardwareRequirements; + gitHash: string | null; + osVersion: string; + hasConfig: boolean; +}; diff --git a/core/startos/bindings/MaybeUtf8String.ts b/core/startos/bindings/MaybeUtf8String.ts index 6674a135b..a77f8ce4e 100644 --- a/core/startos/bindings/MaybeUtf8String.ts +++ b/core/startos/bindings/MaybeUtf8String.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type MaybeUtf8String = string | number[]; \ No newline at end of file +export type MaybeUtf8String = string | number[]; diff --git a/core/startos/bindings/MountParams.ts b/core/startos/bindings/MountParams.ts index 4f8615a25..daa4ddf32 100644 --- a/core/startos/bindings/MountParams.ts +++ b/core/startos/bindings/MountParams.ts @@ -1,4 +1,4 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { MountTarget } from "./MountTarget"; -export type MountParams = { location: string, target: MountTarget, }; \ No newline at end of file +export type MountParams = { location: string; target: MountTarget }; diff --git a/core/startos/bindings/MountTarget.ts b/core/startos/bindings/MountTarget.ts index 6a28ec3ac..3009861fb 100644 --- a/core/startos/bindings/MountTarget.ts +++ b/core/startos/bindings/MountTarget.ts @@ -1,3 +1,8 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type MountTarget = { packageId: string, volumeId: string, subpath: string | null, readonly: boolean, }; \ No newline at end of file +export type MountTarget = { + packageId: string; + volumeId: string; + subpath: string | null; + readonly: boolean; +}; diff --git a/core/startos/bindings/NamedProgress.ts b/core/startos/bindings/NamedProgress.ts index 1e4c45093..42104c48b 100644 --- a/core/startos/bindings/NamedProgress.ts +++ b/core/startos/bindings/NamedProgress.ts @@ -1,4 +1,4 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { Progress } from "./Progress"; -export type NamedProgress = { name: string, progress: Progress, }; \ No newline at end of file +export type NamedProgress = { name: string; progress: Progress }; diff --git a/core/startos/bindings/PackageDataEntry.ts b/core/startos/bindings/PackageDataEntry.ts index 7abb7503a..8b906bb90 100644 --- a/core/startos/bindings/PackageDataEntry.ts +++ b/core/startos/bindings/PackageDataEntry.ts @@ -9,4 +9,18 @@ import type { ServiceInterfaceId } from "./ServiceInterfaceId"; import type { ServiceInterfaceWithHostInfo } from "./ServiceInterfaceWithHostInfo"; import type { Status } from "./Status"; -export type PackageDataEntry = { stateInfo: PackageState, status: Status, marketplaceUrl: string | null, developerKey: string, icon: DataUrl, lastBackup: string | null, currentDependencies: CurrentDependencies, actions: { [key: ActionId]: ActionMetadata }, serviceInterfaces: { [key: ServiceInterfaceId]: ServiceInterfaceWithHostInfo }, hosts: HostInfo, storeExposedDependents: string[], }; \ No newline at end of file +export type PackageDataEntry = { + stateInfo: PackageState; + status: Status; + marketplaceUrl: string | null; + developerKey: string; + icon: DataUrl; + lastBackup: string | null; + currentDependencies: CurrentDependencies; + actions: { [key: ActionId]: ActionMetadata }; + serviceInterfaces: { + [key: ServiceInterfaceId]: ServiceInterfaceWithHostInfo; + }; + hosts: HostInfo; + storeExposedDependents: string[]; +}; diff --git a/core/startos/bindings/PackageId.ts b/core/startos/bindings/PackageId.ts index fcf62f5e2..349bf44d7 100644 --- a/core/startos/bindings/PackageId.ts +++ b/core/startos/bindings/PackageId.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type PackageId = string; \ No newline at end of file +export type PackageId = string; diff --git a/core/startos/bindings/PackageState.ts b/core/startos/bindings/PackageState.ts index 4aa0c1d97..6c90bff09 100644 --- a/core/startos/bindings/PackageState.ts +++ b/core/startos/bindings/PackageState.ts @@ -3,4 +3,9 @@ import type { InstalledState } from "./InstalledState"; import type { InstallingState } from "./InstallingState"; import type { UpdatingState } from "./UpdatingState"; -export type PackageState = { "state": "installing" } & InstallingState | { "state": "restoring" } & InstallingState | { "state": "updating" } & UpdatingState | { "state": "installed" } & InstalledState | { "state": "removing" } & InstalledState; \ No newline at end of file +export type PackageState = + | ({ state: "installing" } & InstallingState) + | ({ state: "restoring" } & InstallingState) + | ({ state: "updating" } & UpdatingState) + | ({ state: "installed" } & InstalledState) + | ({ state: "removing" } & InstalledState); diff --git a/core/startos/bindings/ParamsMaybePackageId.ts b/core/startos/bindings/ParamsMaybePackageId.ts index 867eb2a51..e9f0f170c 100644 --- a/core/startos/bindings/ParamsMaybePackageId.ts +++ b/core/startos/bindings/ParamsMaybePackageId.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type ParamsMaybePackageId = { packageId: string | null, }; \ No newline at end of file +export type ParamsMaybePackageId = { packageId: string | null }; diff --git a/core/startos/bindings/ParamsPackageId.ts b/core/startos/bindings/ParamsPackageId.ts index aa3caec92..7bc919843 100644 --- a/core/startos/bindings/ParamsPackageId.ts +++ b/core/startos/bindings/ParamsPackageId.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type ParamsPackageId = { packageId: string, }; \ No newline at end of file +export type ParamsPackageId = { packageId: string }; diff --git a/core/startos/bindings/Progress.ts b/core/startos/bindings/Progress.ts index acddd8582..c8e5e4431 100644 --- a/core/startos/bindings/Progress.ts +++ b/core/startos/bindings/Progress.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type Progress = boolean | { done: number, total: number | null, }; \ No newline at end of file +export type Progress = boolean | { done: number; total: number | null }; diff --git a/core/startos/bindings/Public.ts b/core/startos/bindings/Public.ts index c913d8493..442176303 100644 --- a/core/startos/bindings/Public.ts +++ b/core/startos/bindings/Public.ts @@ -2,4 +2,8 @@ import type { AllPackageData } from "./AllPackageData"; import type { ServerInfo } from "./ServerInfo"; -export type Public = { serverInfo: ServerInfo, packageData: AllPackageData, ui: any, }; \ No newline at end of file +export type Public = { + serverInfo: ServerInfo; + packageData: AllPackageData; + ui: any; +}; diff --git a/core/startos/bindings/RemoveActionParams.ts b/core/startos/bindings/RemoveActionParams.ts index ae2faccbe..fcd567c3f 100644 --- a/core/startos/bindings/RemoveActionParams.ts +++ b/core/startos/bindings/RemoveActionParams.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type RemoveActionParams = { id: string, }; \ No newline at end of file +export type RemoveActionParams = { id: string }; diff --git a/core/startos/bindings/RemoveAddressParams.ts b/core/startos/bindings/RemoveAddressParams.ts index 2b9881ce1..578631d39 100644 --- a/core/startos/bindings/RemoveAddressParams.ts +++ b/core/startos/bindings/RemoveAddressParams.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type RemoveAddressParams = { id: string, }; \ No newline at end of file +export type RemoveAddressParams = { id: string }; diff --git a/core/startos/bindings/ReverseProxyBind.ts b/core/startos/bindings/ReverseProxyBind.ts index 6c2d5a586..c9d67b127 100644 --- a/core/startos/bindings/ReverseProxyBind.ts +++ b/core/startos/bindings/ReverseProxyBind.ts @@ -1,3 +1,7 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type ReverseProxyBind = { ip: string | null, port: number, ssl: boolean, }; \ No newline at end of file +export type ReverseProxyBind = { + ip: string | null; + port: number; + ssl: boolean; +}; diff --git a/core/startos/bindings/ReverseProxyDestination.ts b/core/startos/bindings/ReverseProxyDestination.ts index 8786f1008..216d1310f 100644 --- a/core/startos/bindings/ReverseProxyDestination.ts +++ b/core/startos/bindings/ReverseProxyDestination.ts @@ -1,3 +1,7 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type ReverseProxyDestination = { ip: string | null, port: number, ssl: boolean, }; \ No newline at end of file +export type ReverseProxyDestination = { + ip: string | null; + port: number; + ssl: boolean; +}; diff --git a/core/startos/bindings/ReverseProxyHttp.ts b/core/startos/bindings/ReverseProxyHttp.ts index f7b652e6a..07cf41862 100644 --- a/core/startos/bindings/ReverseProxyHttp.ts +++ b/core/startos/bindings/ReverseProxyHttp.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type ReverseProxyHttp = { headers: null | {[key: string]: string}, }; \ No newline at end of file +export type ReverseProxyHttp = { headers: null | { [key: string]: string } }; diff --git a/core/startos/bindings/ReverseProxyParams.ts b/core/startos/bindings/ReverseProxyParams.ts index bc6d3016c..6f684b780 100644 --- a/core/startos/bindings/ReverseProxyParams.ts +++ b/core/startos/bindings/ReverseProxyParams.ts @@ -3,4 +3,8 @@ import type { ReverseProxyBind } from "./ReverseProxyBind"; import type { ReverseProxyDestination } from "./ReverseProxyDestination"; import type { ReverseProxyHttp } from "./ReverseProxyHttp"; -export type ReverseProxyParams = { bind: ReverseProxyBind, dst: ReverseProxyDestination, http: ReverseProxyHttp, }; \ No newline at end of file +export type ReverseProxyParams = { + bind: ReverseProxyBind; + dst: ReverseProxyDestination; + http: ReverseProxyHttp; +}; diff --git a/core/startos/bindings/Security.ts b/core/startos/bindings/Security.ts index 390b6a91f..e722707df 100644 --- a/core/startos/bindings/Security.ts +++ b/core/startos/bindings/Security.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type Security = { ssl: boolean, }; \ No newline at end of file +export type Security = { ssl: boolean }; diff --git a/core/startos/bindings/ServerInfo.ts b/core/startos/bindings/ServerInfo.ts index 97cd77888..e505c84e7 100644 --- a/core/startos/bindings/ServerInfo.ts +++ b/core/startos/bindings/ServerInfo.ts @@ -4,12 +4,32 @@ import type { IpInfo } from "./IpInfo"; import type { ServerStatus } from "./ServerStatus"; import type { WifiInfo } from "./WifiInfo"; -export type ServerInfo = { arch: string, platform: string, id: string, hostname: string, version: string, lastBackup: string | null, -/** - * Used in the wifi to determine the region to set the system to - */ -lastWifiRegion: string | null, eosVersionCompat: string, lanAddress: string, onionAddress: string, -/** - * for backwards compatibility - */ -torAddress: string, ipInfo: { [key: string]: IpInfo }, statusInfo: ServerStatus, wifi: WifiInfo, unreadNotificationCount: number, passwordHash: string, pubkey: string, caFingerprint: string, ntpSynced: boolean, zram: boolean, governor: Governor | null, }; \ No newline at end of file +export type ServerInfo = { + arch: string; + platform: string; + id: string; + hostname: string; + version: string; + lastBackup: string | null; + /** + * Used in the wifi to determine the region to set the system to + */ + lastWifiRegion: string | null; + eosVersionCompat: string; + lanAddress: string; + onionAddress: string; + /** + * for backwards compatibility + */ + torAddress: string; + ipInfo: { [key: string]: IpInfo }; + statusInfo: ServerStatus; + wifi: WifiInfo; + unreadNotificationCount: number; + passwordHash: string; + pubkey: string; + caFingerprint: string; + ntpSynced: boolean; + zram: boolean; + governor: Governor | null; +}; diff --git a/core/startos/bindings/ServerSpecs.ts b/core/startos/bindings/ServerSpecs.ts index ec464c8df..b2278873c 100644 --- a/core/startos/bindings/ServerSpecs.ts +++ b/core/startos/bindings/ServerSpecs.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type ServerSpecs = { cpu: string, disk: string, memory: string, }; \ No newline at end of file +export type ServerSpecs = { cpu: string; disk: string; memory: string }; diff --git a/core/startos/bindings/ServerStatus.ts b/core/startos/bindings/ServerStatus.ts index 0d31f74ea..e72d5d6de 100644 --- a/core/startos/bindings/ServerStatus.ts +++ b/core/startos/bindings/ServerStatus.ts @@ -3,4 +3,10 @@ import type { BackupProgress } from "./BackupProgress"; import type { PackageId } from "./PackageId"; import type { UpdateProgress } from "./UpdateProgress"; -export type ServerStatus = { backupProgress: { [key: PackageId]: BackupProgress } | null, updated: boolean, updateProgress: UpdateProgress | null, shuttingDown: boolean, restarting: boolean, }; \ No newline at end of file +export type ServerStatus = { + backupProgress: { [key: PackageId]: BackupProgress } | null; + updated: boolean; + updateProgress: UpdateProgress | null; + shuttingDown: boolean; + restarting: boolean; +}; diff --git a/core/startos/bindings/ServiceInterface.ts b/core/startos/bindings/ServiceInterface.ts index 2d484d749..4167257bb 100644 --- a/core/startos/bindings/ServiceInterface.ts +++ b/core/startos/bindings/ServiceInterface.ts @@ -3,4 +3,13 @@ import type { AddressInfo } from "./AddressInfo"; import type { ServiceInterfaceId } from "./ServiceInterfaceId"; import type { ServiceInterfaceType } from "./ServiceInterfaceType"; -export type ServiceInterface = { id: ServiceInterfaceId, name: string, description: string, hasPrimary: boolean, disabled: boolean, masked: boolean, addressInfo: AddressInfo, type: ServiceInterfaceType, }; \ No newline at end of file +export type ServiceInterface = { + id: ServiceInterfaceId; + name: string; + description: string; + hasPrimary: boolean; + disabled: boolean; + masked: boolean; + addressInfo: AddressInfo; + type: ServiceInterfaceType; +}; diff --git a/core/startos/bindings/ServiceInterfaceId.ts b/core/startos/bindings/ServiceInterfaceId.ts index 87edd8694..55315ab60 100644 --- a/core/startos/bindings/ServiceInterfaceId.ts +++ b/core/startos/bindings/ServiceInterfaceId.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type ServiceInterfaceId = string; \ No newline at end of file +export type ServiceInterfaceId = string; diff --git a/core/startos/bindings/ServiceInterfaceType.ts b/core/startos/bindings/ServiceInterfaceType.ts index 74372d4ad..fadd11f9d 100644 --- a/core/startos/bindings/ServiceInterfaceType.ts +++ b/core/startos/bindings/ServiceInterfaceType.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type ServiceInterfaceType = "ui" | "p2p" | "api"; \ No newline at end of file +export type ServiceInterfaceType = "ui" | "p2p" | "api"; diff --git a/core/startos/bindings/ServiceInterfaceWithHostInfo.ts b/core/startos/bindings/ServiceInterfaceWithHostInfo.ts index 449c5b29d..bef83abe2 100644 --- a/core/startos/bindings/ServiceInterfaceWithHostInfo.ts +++ b/core/startos/bindings/ServiceInterfaceWithHostInfo.ts @@ -4,4 +4,14 @@ import type { ExportedHostInfo } from "./ExportedHostInfo"; import type { ServiceInterfaceId } from "./ServiceInterfaceId"; import type { ServiceInterfaceType } from "./ServiceInterfaceType"; -export type ServiceInterfaceWithHostInfo = { hostInfo: ExportedHostInfo, id: ServiceInterfaceId, name: string, description: string, hasPrimary: boolean, disabled: boolean, masked: boolean, addressInfo: AddressInfo, type: ServiceInterfaceType, }; \ No newline at end of file +export type ServiceInterfaceWithHostInfo = { + hostInfo: ExportedHostInfo; + id: ServiceInterfaceId; + name: string; + description: string; + hasPrimary: boolean; + disabled: boolean; + masked: boolean; + addressInfo: AddressInfo; + type: ServiceInterfaceType; +}; diff --git a/core/startos/bindings/SetConfigured.ts b/core/startos/bindings/SetConfigured.ts index 8f191b562..ff9eaf11d 100644 --- a/core/startos/bindings/SetConfigured.ts +++ b/core/startos/bindings/SetConfigured.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type SetConfigured = { configured: boolean, }; \ No newline at end of file +export type SetConfigured = { configured: boolean }; diff --git a/core/startos/bindings/SetDependenciesParams.ts b/core/startos/bindings/SetDependenciesParams.ts index b313b0718..d4d2d45cb 100644 --- a/core/startos/bindings/SetDependenciesParams.ts +++ b/core/startos/bindings/SetDependenciesParams.ts @@ -1,4 +1,6 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { DependencyRequirement } from "./DependencyRequirement"; -export type SetDependenciesParams = { dependencies: Array, }; \ No newline at end of file +export type SetDependenciesParams = { + dependencies: Array; +}; diff --git a/core/startos/bindings/SetHealth.ts b/core/startos/bindings/SetHealth.ts index cc8193863..8a4a1bcff 100644 --- a/core/startos/bindings/SetHealth.ts +++ b/core/startos/bindings/SetHealth.ts @@ -1,4 +1,10 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { HealthCheckId } from "./HealthCheckId"; -export type SetHealth = { id: HealthCheckId, name: string, } & ({ "result": "success", message: string, } | { "result": "disabled" } | { "result": "starting" } | { "result": "loading", message: string, } | { "result": "failure", message: string, }); \ No newline at end of file +export type SetHealth = { id: HealthCheckId; name: string } & ( + | { result: "success"; message: string | null } + | { result: "disabled"; message: string | null } + | { result: "starting"; message: string | null } + | { result: "loading"; message: string } + | { result: "failure"; message: string } +); diff --git a/core/startos/bindings/SetMainStatus.ts b/core/startos/bindings/SetMainStatus.ts index 0476ff4ce..653342e5f 100644 --- a/core/startos/bindings/SetMainStatus.ts +++ b/core/startos/bindings/SetMainStatus.ts @@ -1,4 +1,4 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { Status } from "./Status"; -export type SetMainStatus = { status: Status, }; \ No newline at end of file +export type SetMainStatus = { status: Status }; diff --git a/core/startos/bindings/SetStoreParams.ts b/core/startos/bindings/SetStoreParams.ts index e3496a171..8737295bd 100644 --- a/core/startos/bindings/SetStoreParams.ts +++ b/core/startos/bindings/SetStoreParams.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type SetStoreParams = { value: any, path: string, }; \ No newline at end of file +export type SetStoreParams = { value: any; path: string }; diff --git a/core/startos/bindings/Status.ts b/core/startos/bindings/Status.ts index 73894287a..e23c5b4be 100644 --- a/core/startos/bindings/Status.ts +++ b/core/startos/bindings/Status.ts @@ -2,4 +2,8 @@ import type { DependencyConfigErrors } from "./DependencyConfigErrors"; import type { MainStatus } from "./MainStatus"; -export type Status = { configured: boolean, main: MainStatus, dependencyConfigErrors: DependencyConfigErrors, }; \ No newline at end of file +export type Status = { + configured: boolean; + main: MainStatus; + dependencyConfigErrors: DependencyConfigErrors; +}; diff --git a/core/startos/bindings/UpdateProgress.ts b/core/startos/bindings/UpdateProgress.ts index ef6473f37..3d07c56b4 100644 --- a/core/startos/bindings/UpdateProgress.ts +++ b/core/startos/bindings/UpdateProgress.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type UpdateProgress = { size: number | null, downloaded: number, }; \ No newline at end of file +export type UpdateProgress = { size: number | null; downloaded: number }; diff --git a/core/startos/bindings/UpdatingState.ts b/core/startos/bindings/UpdatingState.ts index ce994ce33..37a83f0df 100644 --- a/core/startos/bindings/UpdatingState.ts +++ b/core/startos/bindings/UpdatingState.ts @@ -2,4 +2,7 @@ import type { InstallingInfo } from "./InstallingInfo"; import type { Manifest } from "./Manifest"; -export type UpdatingState = { manifest: Manifest, installingInfo: InstallingInfo, }; \ No newline at end of file +export type UpdatingState = { + manifest: Manifest; + installingInfo: InstallingInfo; +}; diff --git a/core/startos/bindings/VolumeId.ts b/core/startos/bindings/VolumeId.ts index b5e798c8b..e5c63994e 100644 --- a/core/startos/bindings/VolumeId.ts +++ b/core/startos/bindings/VolumeId.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type VolumeId = string; \ No newline at end of file +export type VolumeId = string; diff --git a/core/startos/bindings/WifiInfo.ts b/core/startos/bindings/WifiInfo.ts index e1debf26b..c949b1e76 100644 --- a/core/startos/bindings/WifiInfo.ts +++ b/core/startos/bindings/WifiInfo.ts @@ -1,3 +1,7 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type WifiInfo = { ssids: Array, selected: string | null, connected: string | null, }; \ No newline at end of file +export type WifiInfo = { + ssids: Array; + selected: string | null; + connected: string | null; +}; diff --git a/core/startos/src/status/health_check.rs b/core/startos/src/status/health_check.rs index 8629976a0..cd5616527 100644 --- a/core/startos/src/status/health_check.rs +++ b/core/startos/src/status/health_check.rs @@ -14,9 +14,9 @@ pub struct HealthCheckResult { #[serde(rename_all = "camelCase")] #[serde(tag = "result")] pub enum HealthCheckResultKind { - Success { message: String }, - Disabled, - Starting, + Success { message: Option }, + Disabled { message: Option }, + Starting { message: Option }, Loading { message: String }, Failure { message: String }, } @@ -25,10 +25,26 @@ impl std::fmt::Display for HealthCheckResult { let name = &self.name; match &self.kind { HealthCheckResultKind::Success { message } => { - write!(f, "{name}: Succeeded ({message})") + if let Some(message) = message { + write!(f, "{name}: Succeeded ({message})") + } else { + write!(f, "{name}: Succeeded") + } + } + HealthCheckResultKind::Disabled { message } => { + if let Some(message) = message { + write!(f, "{name}: Disabled ({message})") + } else { + write!(f, "{name}: Disabled") + } + } + HealthCheckResultKind::Starting { message } => { + if let Some(message) = message { + write!(f, "{name}: Starting ({message})") + } else { + write!(f, "{name}: Starting") + } } - HealthCheckResultKind::Disabled => write!(f, "{name}: Disabled"), - HealthCheckResultKind::Starting => write!(f, "{name}: Starting"), HealthCheckResultKind::Loading { message } => write!(f, "{name}: Loading ({message})"), HealthCheckResultKind::Failure { message } => write!(f, "{name}: Failed ({message})"), } diff --git a/web/projects/ui/src/app/services/api/mock-patch.ts b/web/projects/ui/src/app/services/api/mock-patch.ts index 3a8365b67..5d876cf30 100644 --- a/web/projects/ui/src/app/services/api/mock-patch.ts +++ b/web/projects/ui/src/app/services/api/mock-patch.ts @@ -101,6 +101,7 @@ export const mockPatchData: DataModel = { 'ephemeral-health-check': { name: 'Ephemeral Health Check', result: 'starting', + message: null, }, 'chain-state': { name: 'Chain State', @@ -120,6 +121,7 @@ export const mockPatchData: DataModel = { 'unnecessary-health-check': { name: 'Unnecessary Health Check', result: 'disabled', + message: null, }, }, }, From 6e76bcb77e8921e193db2be46a7d18f2900dec42 Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Thu, 28 Mar 2024 11:59:42 -0600 Subject: [PATCH 09/25] fix updates rendering bug --- web/projects/ui/src/app/pages/updates/updates.page.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/projects/ui/src/app/pages/updates/updates.page.html b/web/projects/ui/src/app/pages/updates/updates.page.html index ca71bb6b3..2bb3860c6 100644 --- a/web/projects/ui/src/app/pages/updates/updates.page.html +++ b/web/projects/ui/src/app/pages/updates/updates.page.html @@ -60,7 +60,7 @@ > Date: Thu, 28 Mar 2024 13:37:15 -0600 Subject: [PATCH 10/25] chore: Fix the last of the actions --- container-runtime/src/Models/JsonPath.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/container-runtime/src/Models/JsonPath.ts b/container-runtime/src/Models/JsonPath.ts index 773331b19..314019154 100644 --- a/container-runtime/src/Models/JsonPath.ts +++ b/container-runtime/src/Models/JsonPath.ts @@ -15,10 +15,10 @@ export function unNestPath(a: A): UnNestPaths { function isNestedPath(path: string): path is NestedPaths { const paths = path.split("/") if (paths.length !== 4) return false - if (paths[1] === "action" && (paths[3] === "run" || paths[3] === "get")) + if (paths[1] === "actions" && (paths[3] === "run" || paths[3] === "get")) return true if ( - paths[1] === "dependencyConfig" && + paths[1] === "dependencies" && (paths[3] === "query" || paths[3] === "update") ) return true From 92be4e774e861e7c6a82e93b448d7ac5c0c4e7fe Mon Sep 17 00:00:00 2001 From: Aiden McClelland Date: Thu, 28 Mar 2024 14:48:45 -0600 Subject: [PATCH 11/25] build fixes --- Makefile | 4 +++- core/startos/src/net/static_server.rs | 12 ++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 9a6dee60f..85bc2e7bd 100644 --- a/Makefile +++ b/Makefile @@ -89,6 +89,8 @@ format: test: $(CORE_SRC) $(ENVIRONMENT_FILE) cd core && cargo build && cargo test + npm --prefix sdk exec -- prettier -w ./core/startos/bindings/*.ts + (cd sdk && make test) cli: cd core && ./install-cli.sh @@ -173,7 +175,7 @@ container-runtime/node_modules: container-runtime/package.json container-runtime npm --prefix container-runtime ci touch container-runtime/node_modules -core/startos/bindings: $(shell git ls-files core) $(ENVIRONMENT_FILE) $(PLATFORM_FILE) +core/startos/bindings: $(shell git ls-files -- core ':!:core/startos/bindings/*') $(ENVIRONMENT_FILE) rm -rf core/startos/bindings (cd core/ && cargo test) npm --prefix sdk exec -- prettier -w ./core/startos/bindings/*.ts diff --git a/core/startos/src/net/static_server.rs b/core/startos/src/net/static_server.rs index e8207e3bf..f7fc2969f 100644 --- a/core/startos/src/net/static_server.rs +++ b/core/startos/src/net/static_server.rs @@ -33,11 +33,15 @@ use crate::middleware::db::SyncDb; use crate::middleware::diagnostic::DiagnosticMode; use crate::{diagnostic_api, install_api, main_api, setup_api, Error, ErrorKind, ResultExt}; -static NOT_FOUND: &[u8] = b"Not Found"; -static METHOD_NOT_ALLOWED: &[u8] = b"Method Not Allowed"; -static NOT_AUTHORIZED: &[u8] = b"Not Authorized"; +const NOT_FOUND: &[u8] = b"Not Found"; +const METHOD_NOT_ALLOWED: &[u8] = b"Method Not Allowed"; +const NOT_AUTHORIZED: &[u8] = b"Not Authorized"; -static EMBEDDED_UIS: Dir<'_> = include_dir!("$CARGO_MANIFEST_DIR/../../web/dist/static"); +#[cfg(all(feature = "daemon", not(test)))] +const EMBEDDED_UIS: Dir<'_> = + include_dir::include_dir!("$CARGO_MANIFEST_DIR/../../web/dist/static"); +#[cfg(not(all(feature = "daemon", not(test))))] +const EMBEDDED_UIS: Dir<'_> = Dir::new("", &[]); const PROXY_STRIP_HEADERS: &[&str] = &["cookie", "host", "origin", "referer", "user-agent"]; From 7c63d4012f415e96702de35010fbd22aefbe5595 Mon Sep 17 00:00:00 2001 From: Aiden McClelland Date: Thu, 28 Mar 2024 15:31:54 -0600 Subject: [PATCH 12/25] fix build --- Makefile | 6 +++--- core/startos/Cargo.toml | 3 ++- core/startos/src/net/static_server.rs | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 85bc2e7bd..83c1f31b8 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ STARTD_SRC := core/startos/startd.service $(BUILD_SRC) COMPAT_SRC := $(shell git ls-files system-images/compat/) UTILS_SRC := $(shell git ls-files system-images/utils/) BINFMT_SRC := $(shell git ls-files system-images/binfmt/) -CORE_SRC := $(shell git ls-files core) $(shell git ls-files --recurse-submodules patch-db) web/dist/static web/patchdb-ui-seed.json $(GIT_HASH_FILE) +CORE_SRC := $(shell git ls-files -- core ':!:core/startos/bindings/*) $(shell git ls-files --recurse-submodules patch-db) web/dist/static web/patchdb-ui-seed.json $(GIT_HASH_FILE) WEB_SHARED_SRC := $(shell git ls-files web/projects/shared) $(shell ls -p web/ | grep -v / | sed 's/^/web\//g') web/node_modules web/config.json patch-db/client/dist web/patchdb-ui-seed.json WEB_UI_SRC := $(shell git ls-files web/projects/ui) WEB_SETUP_WIZARD_SRC := $(shell git ls-files web/projects/setup-wizard) @@ -88,7 +88,7 @@ format: cd core && cargo +nightly fmt test: $(CORE_SRC) $(ENVIRONMENT_FILE) - cd core && cargo build && cargo test + (cd core && cargo build && cargo test) npm --prefix sdk exec -- prettier -w ./core/startos/bindings/*.ts (cd sdk && make test) @@ -177,7 +177,7 @@ container-runtime/node_modules: container-runtime/package.json container-runtime core/startos/bindings: $(shell git ls-files -- core ':!:core/startos/bindings/*') $(ENVIRONMENT_FILE) rm -rf core/startos/bindings - (cd core/ && cargo test) + (cd core/ && cargo test --features=test) npm --prefix sdk exec -- prettier -w ./core/startos/bindings/*.ts sdk/lib/test: $(shell git ls-files sdk) core/startos/bindings diff --git a/core/startos/Cargo.toml b/core/startos/Cargo.toml index ec4e978bf..d1a333447 100644 --- a/core/startos/Cargo.toml +++ b/core/startos/Cargo.toml @@ -41,6 +41,7 @@ default = ["cli", "daemon"] dev = [] unstable = ["console-subscriber", "tokio/tracing"] docker = [] +test = [] [dependencies] aes = { version = "0.7.5", features = ["ctr"] } @@ -75,7 +76,7 @@ ed25519-dalek = { version = "2.1.1", features = [ "zeroize", "rand_core", "digest", - "pkcs8" + "pkcs8", ] } ed25519-dalek-v1 = { package = "ed25519-dalek", version = "1" } emver = { version = "0.1.7", git = "https://github.com/Start9Labs/emver-rs.git", features = [ diff --git a/core/startos/src/net/static_server.rs b/core/startos/src/net/static_server.rs index f7fc2969f..fa71672b3 100644 --- a/core/startos/src/net/static_server.rs +++ b/core/startos/src/net/static_server.rs @@ -14,7 +14,7 @@ use futures::future::ready; use http::header::ACCEPT_ENCODING; use http::request::Parts as RequestParts; use http::{HeaderMap, Method, StatusCode}; -use include_dir::{include_dir, Dir}; +use include_dir::Dir; use new_mime_guess::MimeGuess; use openssl::hash::MessageDigest; use openssl::x509::X509; @@ -37,10 +37,10 @@ const NOT_FOUND: &[u8] = b"Not Found"; const METHOD_NOT_ALLOWED: &[u8] = b"Method Not Allowed"; const NOT_AUTHORIZED: &[u8] = b"Not Authorized"; -#[cfg(all(feature = "daemon", not(test)))] +#[cfg(all(feature = "daemon", not(feature = "test")))] const EMBEDDED_UIS: Dir<'_> = include_dir::include_dir!("$CARGO_MANIFEST_DIR/../../web/dist/static"); -#[cfg(not(all(feature = "daemon", not(test))))] +#[cfg(not(all(feature = "daemon", not(feature = "test"))))] const EMBEDDED_UIS: Dir<'_> = Dir::new("", &[]); const PROXY_STRIP_HEADERS: &[&str] = &["cookie", "host", "origin", "referer", "user-agent"]; From 665eef68b97f1984381137897464377f357f4353 Mon Sep 17 00:00:00 2001 From: Aiden McClelland Date: Thu, 28 Mar 2024 16:36:58 -0600 Subject: [PATCH 13/25] fix unterminated quote --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 83c1f31b8..413aa186e 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ STARTD_SRC := core/startos/startd.service $(BUILD_SRC) COMPAT_SRC := $(shell git ls-files system-images/compat/) UTILS_SRC := $(shell git ls-files system-images/utils/) BINFMT_SRC := $(shell git ls-files system-images/binfmt/) -CORE_SRC := $(shell git ls-files -- core ':!:core/startos/bindings/*) $(shell git ls-files --recurse-submodules patch-db) web/dist/static web/patchdb-ui-seed.json $(GIT_HASH_FILE) +CORE_SRC := $(shell git ls-files -- core ':!:core/startos/bindings/*') $(shell git ls-files --recurse-submodules patch-db) web/dist/static web/patchdb-ui-seed.json $(GIT_HASH_FILE) WEB_SHARED_SRC := $(shell git ls-files web/projects/shared) $(shell ls -p web/ | grep -v / | sed 's/^/web\//g') web/node_modules web/config.json patch-db/client/dist web/patchdb-ui-seed.json WEB_UI_SRC := $(shell git ls-files web/projects/ui) WEB_SETUP_WIZARD_SRC := $(shell git ls-files web/projects/setup-wizard) From e7426ea365a610301fb967f0645aa400b5ec379a Mon Sep 17 00:00:00 2001 From: Aiden McClelland Date: Thu, 28 Mar 2024 17:11:43 -0600 Subject: [PATCH 14/25] touch bindings before make touch --- .github/workflows/startos-iso.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/startos-iso.yaml b/.github/workflows/startos-iso.yaml index 47e0266cd..e7ce54427 100644 --- a/.github/workflows/startos-iso.yaml +++ b/.github/workflows/startos-iso.yaml @@ -169,6 +169,7 @@ jobs: - name: Prevent rebuild of compiled artifacts run: | mkdir -p web/dist/raw + touch core/startos/bindings PLATFORM=${{ matrix.platform }} make -t compiled-${{ env.ARCH }}.tar - name: Run iso build From 46412acd13df3d5f76a92023cd8b31af8e9be9d3 Mon Sep 17 00:00:00 2001 From: Aiden McClelland Date: Thu, 28 Mar 2024 23:31:27 -0600 Subject: [PATCH 15/25] add container runtime to compiled tar --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 413aa186e..f6cc6b21b 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ WEB_INSTALL_WIZARD_SRC := $(shell git ls-files web/projects/install-wizard) PATCH_DB_CLIENT_SRC := $(shell git ls-files --recurse-submodules patch-db/client) GZIP_BIN := $(shell which pigz || which gzip) TAR_BIN := $(shell which gtar || which tar) -COMPILED_TARGETS := $(BINS) system-images/compat/docker-images/$(ARCH).tar system-images/utils/docker-images/$(ARCH).tar system-images/binfmt/docker-images/$(ARCH).tar +COMPILED_TARGETS := $(BINS) system-images/compat/docker-images/$(ARCH).tar system-images/utils/docker-images/$(ARCH).tar system-images/binfmt/docker-images/$(ARCH).tar build/lib/container-runtime/rootfs.squashfs ALL_TARGETS := $(STARTD_SRC) $(ENVIRONMENT_FILE) $(GIT_HASH_FILE) $(VERSION_FILE) $(COMPILED_TARGETS) $(shell if [ "$(PLATFORM)" = "raspberrypi" ]; then echo cargo-deps/aarch64-unknown-linux-musl/release/pi-beep; fi) $(shell /bin/bash -c 'if [[ "${ENVIRONMENT}" =~ (^|-)unstable($$|-) ]]; then echo cargo-deps/$(ARCH)-unknown-linux-musl/release/tokio-console; fi') $(PLATFORM_FILE) sdk/lib/test ifeq ($(REMOTE),) From 94f1562ec5788e1b7193e19cbe4bb5dd3b233a65 Mon Sep 17 00:00:00 2001 From: Aiden McClelland Date: Fri, 29 Mar 2024 09:16:15 -0600 Subject: [PATCH 16/25] choose base image by arch instead of platform --- Makefile | 12 +++++++----- build/.gitignore | 3 +-- container-runtime/.gitignore | 2 +- container-runtime/download-base-image.sh | 11 ++++++----- container-runtime/update-image.sh | 6 +++--- 5 files changed, 18 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index f6cc6b21b..9c6f89003 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ IMAGE_TYPE=$(shell if [ "$(PLATFORM)" = raspberrypi ]; then echo img; else echo BINS := core/target/$(ARCH)-unknown-linux-musl/release/startbox core/target/$(ARCH)-unknown-linux-musl/release/containerbox WEB_UIS := web/dist/raw/ui web/dist/raw/setup-wizard web/dist/raw/diagnostic-ui web/dist/raw/install-wizard FIRMWARE_ROMS := ./firmware/$(PLATFORM) $(shell jq --raw-output '.[] | select(.platform[] | contains("$(PLATFORM)")) | "./firmware/$(PLATFORM)/" + .id + ".rom.gz"' build/lib/firmware.json) -BUILD_SRC := $(shell git ls-files build) build/lib/depends build/lib/conflicts build/lib/container-runtime/rootfs.squashfs $(FIRMWARE_ROMS) +BUILD_SRC := $(shell git ls-files build) build/lib/depends build/lib/conflicts container-runtime/rootfs.$(ARCH).squashfs $(FIRMWARE_ROMS) DEBIAN_SRC := $(shell git ls-files debian/) IMAGE_RECIPE_SRC := $(shell git ls-files image-recipe/) STARTD_SRC := core/startos/startd.service $(BUILD_SRC) @@ -25,7 +25,7 @@ WEB_INSTALL_WIZARD_SRC := $(shell git ls-files web/projects/install-wizard) PATCH_DB_CLIENT_SRC := $(shell git ls-files --recurse-submodules patch-db/client) GZIP_BIN := $(shell which pigz || which gzip) TAR_BIN := $(shell which gtar || which tar) -COMPILED_TARGETS := $(BINS) system-images/compat/docker-images/$(ARCH).tar system-images/utils/docker-images/$(ARCH).tar system-images/binfmt/docker-images/$(ARCH).tar build/lib/container-runtime/rootfs.squashfs +COMPILED_TARGETS := $(BINS) system-images/compat/docker-images/$(ARCH).tar system-images/utils/docker-images/$(ARCH).tar system-images/binfmt/docker-images/$(ARCH).tar container-runtime/rootfs.$(ARCH).squashfs ALL_TARGETS := $(STARTD_SRC) $(ENVIRONMENT_FILE) $(GIT_HASH_FILE) $(VERSION_FILE) $(COMPILED_TARGETS) $(shell if [ "$(PLATFORM)" = "raspberrypi" ]; then echo cargo-deps/aarch64-unknown-linux-musl/release/pi-beep; fi) $(shell /bin/bash -c 'if [[ "${ENVIRONMENT}" =~ (^|-)unstable($$|-) ]]; then echo cargo-deps/$(ARCH)-unknown-linux-musl/release/tokio-console; fi') $(PLATFORM_FILE) sdk/lib/test ifeq ($(REMOTE),) @@ -76,7 +76,7 @@ clean: rm -rf build/lib/firmware rm -rf container-runtime/dist rm -rf container-runtime/node_modules - rm -f build/lib/container-runtime/rootfs.squashfs + rm -f container-runtime/*.squashfs rm -rf sdk/dist rm -rf sdk/node_modules rm -f ENVIRONMENT.txt @@ -127,6 +127,8 @@ install: $(ALL_TARGETS) $(call mkdir,$(DESTDIR)/usr/lib) $(call rm,$(DESTDIR)/usr/lib/startos) $(call cp,build/lib,$(DESTDIR)/usr/lib/startos) + $(call mkdir,$(DESTDIR)/usr/lib/startos/container-runtime) + $(call cp,container-runtime/rootfs.$(ARCH).squashfs,$(DESTDIR)/usr/lib/startos/container-runtime/rootfs.squashfs) $(call cp,PLATFORM.txt,$(DESTDIR)/usr/lib/startos/PLATFORM.txt) $(call cp,ENVIRONMENT.txt,$(DESTDIR)/usr/lib/startos/ENVIRONMENT.txt) @@ -168,7 +170,7 @@ emulate-reflash: $(ALL_TARGETS) upload-ota: results/$(BASENAME).squashfs TARGET=$(TARGET) KEY=$(KEY) ./upload-ota.sh -container-runtime/alpine.squashfs: $(PLATFORM_FILE) +container-runtime/alpine.$(ARCH).squashfs: ARCH=$(ARCH) ./container-runtime/download-base-image.sh container-runtime/node_modules: container-runtime/package.json container-runtime/package-lock.json sdk/dist @@ -193,7 +195,7 @@ container-runtime/dist/node_modules container-runtime/dist/package.json containe ./container-runtime/install-dist-deps.sh touch container-runtime/dist/node_modules -build/lib/container-runtime/rootfs.squashfs: container-runtime/alpine.squashfs container-runtime/containerRuntime.rc container-runtime/update-image.sh container-runtime/dist container-runtime/dist/node_modules core/target/$(ARCH)-unknown-linux-musl/release/containerbox $(PLATFORM_FILE) | sudo +container-runtime/rootfs.$(ARCH).squashfs: container-runtime/alpine.$(ARCH).squashfs container-runtime/containerRuntime.rc container-runtime/update-image.sh container-runtime/dist container-runtime/dist/node_modules core/target/$(ARCH)-unknown-linux-musl/release/containerbox | sudo ARCH=$(ARCH) ./container-runtime/update-image.sh build/lib/depends build/lib/conflicts: build/dpkg-deps/* diff --git a/build/.gitignore b/build/.gitignore index f24aa0255..497f4b913 100644 --- a/build/.gitignore +++ b/build/.gitignore @@ -1,3 +1,2 @@ /lib/depends -/lib/conflicts -/lib/container-runtime/rootfs.squashfs \ No newline at end of file +/lib/conflicts \ No newline at end of file diff --git a/container-runtime/.gitignore b/container-runtime/.gitignore index 1764c1d17..8aa4208b7 100644 --- a/container-runtime/.gitignore +++ b/container-runtime/.gitignore @@ -4,5 +4,5 @@ bundle.js startInit.js service/ service.js -alpine.squashfs +*.squashfs /tmp \ No newline at end of file diff --git a/container-runtime/download-base-image.sh b/container-runtime/download-base-image.sh index e708478e1..23a140ea5 100755 --- a/container-runtime/download-base-image.sh +++ b/container-runtime/download-base-image.sh @@ -9,10 +9,11 @@ VERSION=3.19 ARCH=${ARCH:-$(uname -m)} FLAVOR=default -if [ "$ARCH" = "x86_64" ]; then - ARCH=amd64 -elif [ "$ARCH" = "aarch64" ]; then - ARCH=arm64 +_ARCH=$ARCH +if [ "$_ARCH" = "x86_64" ]; then + _ARCH=amd64 +elif [ "$_ARCH" = "aarch64" ]; then + _ARCH=arm64 fi -curl https://images.linuxcontainers.org/$(curl --silent https://images.linuxcontainers.org/meta/1.0/index-system | grep "^$DISTRO;$VERSION;$ARCH;$FLAVOR;" | head -n1 | sed 's/^.*;//g')/rootfs.squashfs --output alpine.squashfs \ No newline at end of file +curl https://images.linuxcontainers.org/$(curl --silent https://images.linuxcontainers.org/meta/1.0/index-system | grep "^$DISTRO;$VERSION;$_ARCH;$FLAVOR;" | head -n1 | sed 's/^.*;//g')/rootfs.squashfs --output alpine.${ARCH}.squashfs \ No newline at end of file diff --git a/container-runtime/update-image.sh b/container-runtime/update-image.sh index 64ca503cf..e0d5dc0c3 100755 --- a/container-runtime/update-image.sh +++ b/container-runtime/update-image.sh @@ -9,7 +9,7 @@ set -e if mountpoint tmp/combined; then sudo umount tmp/combined; fi if mountpoint tmp/lower; then sudo umount tmp/lower; fi mkdir -p tmp/lower tmp/upper tmp/work tmp/combined -sudo mount alpine.squashfs tmp/lower +sudo mount alpine.${ARCH}.squashfs tmp/lower sudo mount -t overlay -olowerdir=tmp/lower,upperdir=tmp/upper,workdir=tmp/work overlay tmp/combined QEMU= @@ -33,9 +33,9 @@ fi sudo truncate -s 0 tmp/combined/etc/resolv.conf sudo chown -R 0:0 tmp/combined -rm -f ../build/lib/container-runtime/rootfs.squashfs +rm -f rootfs.${ARCH}.squashfs mkdir -p ../build/lib/container-runtime -sudo mksquashfs tmp/combined ../build/lib/container-runtime/rootfs.squashfs +sudo mksquashfs tmp/combined rootfs.${ARCH}.squashfs sudo umount tmp/combined sudo umount tmp/lower sudo rm -rf tmp \ No newline at end of file From 61f68d9e1b76d80ef11e45f706b70a737cee4377 Mon Sep 17 00:00:00 2001 From: Aiden McClelland Date: Fri, 29 Mar 2024 09:49:05 -0600 Subject: [PATCH 17/25] install qemu --- .github/workflows/startos-iso.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/startos-iso.yaml b/.github/workflows/startos-iso.yaml index e7ce54427..1df490155 100644 --- a/.github/workflows/startos-iso.yaml +++ b/.github/workflows/startos-iso.yaml @@ -79,9 +79,12 @@ jobs: with: node-version: ${{ env.NODEJS_VERSION }} - - name: Set up QEMU + - name: Set up docker QEMU uses: docker/setup-qemu-action@v2 + - name: Set up system QEMU + run: apt-get update && apt-get install -y qemu-user-static + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 From 3bab7678b7b56e75a775e54e7445b28ab76a9858 Mon Sep 17 00:00:00 2001 From: Aiden McClelland Date: Fri, 29 Mar 2024 10:05:24 -0600 Subject: [PATCH 18/25] install qemu as root --- .github/workflows/startos-iso.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/startos-iso.yaml b/.github/workflows/startos-iso.yaml index 1df490155..75aa42578 100644 --- a/.github/workflows/startos-iso.yaml +++ b/.github/workflows/startos-iso.yaml @@ -83,7 +83,7 @@ jobs: uses: docker/setup-qemu-action@v2 - name: Set up system QEMU - run: apt-get update && apt-get install -y qemu-user-static + run: sudo apt-get update && sudo apt-get install -y qemu-user-static - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 From 44e856e8dc13231ae91a16ae81ff5cf79cdbd5bc Mon Sep 17 00:00:00 2001 From: Aiden McClelland Date: Fri, 29 Mar 2024 12:18:40 -0600 Subject: [PATCH 19/25] fix make -t --- .github/workflows/startos-iso.yaml | 1 + Makefile | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/startos-iso.yaml b/.github/workflows/startos-iso.yaml index 75aa42578..184c2b0c7 100644 --- a/.github/workflows/startos-iso.yaml +++ b/.github/workflows/startos-iso.yaml @@ -173,6 +173,7 @@ jobs: run: | mkdir -p web/dist/raw touch core/startos/bindings + mkdir -p container-runtime/dist PLATFORM=${{ matrix.platform }} make -t compiled-${{ env.ARCH }}.tar - name: Run iso build diff --git a/Makefile b/Makefile index 9c6f89003..11428a7ce 100644 --- a/Makefile +++ b/Makefile @@ -53,6 +53,9 @@ endif all: $(ALL_TARGETS) +touch: + touch $(ALL_TARGETS) + metadata: $(VERSION_FILE) $(PLATFORM_FILE) $(ENVIRONMENT_FILE) $(GIT_HASH_FILE) sudo: @@ -188,14 +191,15 @@ sdk/lib/test: $(shell git ls-files sdk) core/startos/bindings sdk/dist: $(shell git ls-files sdk) core/startos/bindings (cd sdk && make bundle) -container-runtime/dist: container-runtime/node_modules $(shell git ls-files container-runtime/src) container-runtime/package.json container-runtime/tsconfig.json +# TODO: make container-runtime its own makefile? +container-runtime/dist/index.js: container-runtime/node_modules $(shell git ls-files container-runtime/src) container-runtime/package.json container-runtime/tsconfig.json npm --prefix container-runtime run build container-runtime/dist/node_modules container-runtime/dist/package.json container-runtime/dist/package-lock.json: container-runtime/package.json container-runtime/package-lock.json sdk/dist container-runtime/install-dist-deps.sh ./container-runtime/install-dist-deps.sh touch container-runtime/dist/node_modules -container-runtime/rootfs.$(ARCH).squashfs: container-runtime/alpine.$(ARCH).squashfs container-runtime/containerRuntime.rc container-runtime/update-image.sh container-runtime/dist container-runtime/dist/node_modules core/target/$(ARCH)-unknown-linux-musl/release/containerbox | sudo +container-runtime/rootfs.$(ARCH).squashfs: container-runtime/alpine.$(ARCH).squashfs container-runtime/containerRuntime.rc container-runtime/update-image.sh container-runtime/dist/index.js container-runtime/dist/node_modules core/target/$(ARCH)-unknown-linux-musl/release/containerbox | sudo ARCH=$(ARCH) ./container-runtime/update-image.sh build/lib/depends build/lib/conflicts: build/dpkg-deps/* From bec63a94718aded542d054bab577d0137b5e5497 Mon Sep 17 00:00:00 2001 From: Aiden McClelland Date: Fri, 29 Mar 2024 13:06:51 -0600 Subject: [PATCH 20/25] remove extra sdk test line --- Makefile | 3 --- 1 file changed, 3 deletions(-) diff --git a/Makefile b/Makefile index 11428a7ce..b0dcf5830 100644 --- a/Makefile +++ b/Makefile @@ -185,9 +185,6 @@ core/startos/bindings: $(shell git ls-files -- core ':!:core/startos/bindings/*' (cd core/ && cargo test --features=test) npm --prefix sdk exec -- prettier -w ./core/startos/bindings/*.ts -sdk/lib/test: $(shell git ls-files sdk) core/startos/bindings - (cd sdk && make test) - sdk/dist: $(shell git ls-files sdk) core/startos/bindings (cd sdk && make bundle) From 1acdd67fd996751b6699b1809f3064f6eff9646a Mon Sep 17 00:00:00 2001 From: Aiden McClelland Date: Fri, 29 Mar 2024 13:41:41 -0600 Subject: [PATCH 21/25] chown volume mountpoints --- .../src/service/persistent_container.rs | 30 ++++++++++++++----- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/core/startos/src/service/persistent_container.rs b/core/startos/src/service/persistent_container.rs index a3756b37a..038661ace 100644 --- a/core/startos/src/service/persistent_container.rs +++ b/core/startos/src/service/persistent_container.rs @@ -116,6 +116,16 @@ impl PersistentContainer { .await?; let mut volumes = BTreeMap::new(); for volume in &s9pk.as_manifest().volumes { + let mountpoint = lxc_container + .rootfs_dir() + .join("media/startos/volumes") + .join(volume); + tokio::fs::create_dir_all(&mountpoint).await?; + Command::new("chown") + .arg("100000:100000") + .arg(&mountpoint) + .invoke(crate::ErrorKind::Filesystem) + .await?; let mount = MountGuard::mount( &IdMapped::new( Bind::new(data_dir(&ctx.datadir, &s9pk.as_manifest().id, volume)), @@ -123,10 +133,7 @@ impl PersistentContainer { 100000, 65536, ), - lxc_container - .rootfs_dir() - .join("media/startos/volumes") - .join(volume), + mountpoint, MountType::ReadWrite, ) .await?; @@ -134,6 +141,16 @@ impl PersistentContainer { } let mut assets = BTreeMap::new(); for asset in &s9pk.as_manifest().assets { + let mountpoint = lxc_container + .rootfs_dir() + .join("media/startos/assets") + .join(asset); + tokio::fs::create_dir_all(&mountpoint).await?; + Command::new("chown") + .arg("100000:100000") + .arg(&mountpoint) + .invoke(crate::ErrorKind::Filesystem) + .await?; assets.insert( asset.clone(), MountGuard::mount( @@ -145,10 +162,7 @@ impl PersistentContainer { ) .join(asset), ), - lxc_container - .rootfs_dir() - .join("media/startos/assets") - .join(asset), + mountpoint, MountType::ReadWrite, ) .await?, From 231859303df81500a70ef0d572a16ab52de362d8 Mon Sep 17 00:00:00 2001 From: Aiden McClelland Date: Fri, 29 Mar 2024 13:49:05 -0600 Subject: [PATCH 22/25] fix cargo dep --- build-cargo-dep.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-cargo-dep.sh b/build-cargo-dep.sh index 5c8f9ceed..9e20f0caf 100755 --- a/build-cargo-dep.sh +++ b/build-cargo-dep.sh @@ -18,7 +18,7 @@ if [ -z "$ARCH" ]; then fi mkdir -p cargo-deps -alias 'rust-musl-builder'='docker run $USE_TTY --rm -e "RUSTFLAGS=$RUSTFLAGS" -v "$HOME/.cargo/registry":/root/.cargo/registry -v "$(pwd)":/home/rust/src -w /home/rust/src -P messense/rust-musl-cross:$ARCH-musl' +alias 'rust-musl-builder'='docker run $USE_TTY --rm -e "RUSTFLAGS=$RUSTFLAGS" -v "$HOME/.cargo/registry":/root/.cargo/registry -v "$(pwd)"/cargo-deps:/home/rust/src -w /home/rust/src -P messense/rust-musl-cross:$ARCH-musl' rust-musl-builder cargo install "$1" --target-dir /home/rust/src --target=$ARCH-unknown-linux-musl sudo chown -R $USER cargo-deps From b6992e32a54513433c87d142c2485dfceb58bb97 Mon Sep 17 00:00:00 2001 From: Aiden McClelland Date: Fri, 29 Mar 2024 14:42:33 -0600 Subject: [PATCH 23/25] yes --- image-recipe/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/image-recipe/build.sh b/image-recipe/build.sh index 28aa574ae..7a8ac4c13 100755 --- a/image-recipe/build.sh +++ b/image-recipe/build.sh @@ -217,7 +217,7 @@ if [ "${IB_TARGET_PLATFORM}" = "raspberrypi" ]; then ln -sf /usr/bin/pi-beep /usr/local/bin/beep wget https://archive.raspberrypi.org/debian/pool/main/w/wireless-regdb/wireless-regdb_2018.05.09-0~rpt1_all.deb echo 1b7b1076257726609535b71d146a5721622d19a0843061ee7568188e836dd10f wireless-regdb_2018.05.09-0~rpt1_all.deb | sha256sum -c - apt-get install ./wireless-regdb_2018.05.09-0~rpt1_all.deb + apt-get install -y ./wireless-regdb_2018.05.09-0~rpt1_all.deb rm wireless-regdb_2018.05.09-0~rpt1_all.deb fi From 4d6dd44e107664e38034d99f0052b6f9ab9cd71f Mon Sep 17 00:00:00 2001 From: Aiden McClelland Date: Fri, 29 Mar 2024 15:35:33 -0600 Subject: [PATCH 24/25] allow downgrades --- image-recipe/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/image-recipe/build.sh b/image-recipe/build.sh index 7a8ac4c13..7aae39c7f 100755 --- a/image-recipe/build.sh +++ b/image-recipe/build.sh @@ -217,7 +217,7 @@ if [ "${IB_TARGET_PLATFORM}" = "raspberrypi" ]; then ln -sf /usr/bin/pi-beep /usr/local/bin/beep wget https://archive.raspberrypi.org/debian/pool/main/w/wireless-regdb/wireless-regdb_2018.05.09-0~rpt1_all.deb echo 1b7b1076257726609535b71d146a5721622d19a0843061ee7568188e836dd10f wireless-regdb_2018.05.09-0~rpt1_all.deb | sha256sum -c - apt-get install -y ./wireless-regdb_2018.05.09-0~rpt1_all.deb + apt-get install -y --allow-downgrades ./wireless-regdb_2018.05.09-0~rpt1_all.deb rm wireless-regdb_2018.05.09-0~rpt1_all.deb fi From 8dfc5052e9bea9303261631295c9400f0a2d9235 Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Sat, 30 Mar 2024 10:37:31 -0600 Subject: [PATCH 25/25] ditch more FE enums for clarity and cleanliness --- .../app/components/status/status.component.ts | 2 - .../apps-routes/app-show/app-show.page.html | 4 +- .../apps-routes/app-show/app-show.page.ts | 13 +- .../app-show-status.component.ts | 11 +- .../built-in/health/health.component.ts | 8 +- .../ui/src/app/services/api/api.types.ts | 23 +--- .../ui/src/app/services/dep-error.service.ts | 60 ++------- .../services/pkg-status-rendering.service.ts | 116 +++++++----------- .../ui/src/app/util/get-package-info.ts | 13 +- 9 files changed, 80 insertions(+), 170 deletions(-) diff --git a/web/projects/ui/src/app/components/status/status.component.ts b/web/projects/ui/src/app/components/status/status.component.ts index 03894406e..c9fec4968 100644 --- a/web/projects/ui/src/app/components/status/status.component.ts +++ b/web/projects/ui/src/app/components/status/status.component.ts @@ -3,7 +3,6 @@ import { ConnectionService } from 'src/app/services/connection.service' import { InstallingInfo } from 'src/app/services/patch-db/data-model' import { PrimaryRendering, - PrimaryStatus, StatusRendering, } from 'src/app/services/pkg-status-rendering.service' @@ -13,7 +12,6 @@ import { styleUrls: ['./status.component.scss'], }) export class StatusComponent { - PS = PrimaryStatus PR = PrimaryRendering @Input() rendering!: StatusRendering diff --git a/web/projects/ui/src/app/pages/apps-routes/app-show/app-show.page.html b/web/projects/ui/src/app/pages/apps-routes/app-show/app-show.page.html index 238d1d208..5b3123131 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-show/app-show.page.html +++ b/web/projects/ui/src/app/pages/apps-routes/app-show/app-show.page.html @@ -17,9 +17,9 @@ - + any) | null = null if (depError) { - if (depError.type === DependencyErrorType.NotInstalled) { + if (depError.type === 'notInstalled') { errorText = 'Not installed' fixText = 'Install' fixAction = () => this.fixDep(pkg, manifest, 'install', depId) - } else if (depError.type === DependencyErrorType.IncorrectVersion) { + } else if (depError.type === 'incorrectVersion') { errorText = 'Incorrect version' fixText = 'Update' fixAction = () => this.fixDep(pkg, manifest, 'update', depId) - } else if (depError.type === DependencyErrorType.ConfigUnsatisfied) { + } else if (depError.type === 'configUnsatisfied') { errorText = 'Config not satisfied' fixText = 'Auto config' fixAction = () => this.fixDep(pkg, manifest, 'configure', depId) - } else if (depError.type === DependencyErrorType.NotRunning) { + } else if (depError.type === 'notRunning') { errorText = 'Not running' fixText = 'Start' - } else if (depError.type === DependencyErrorType.HealthChecksFailed) { + } else if (depError.type === 'healthChecksFailed') { errorText = 'Required health check not passing' - } else if (depError.type === DependencyErrorType.Transitive) { + } else if (depError.type === 'transitive') { errorText = 'Dependency has a dependency issue' } } diff --git a/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-status/app-show-status.component.ts b/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-status/app-show-status.component.ts index d67ce2941..23d9affd4 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-status/app-show-status.component.ts +++ b/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-status/app-show-status.component.ts @@ -3,7 +3,6 @@ import { UiLauncherService } from 'src/app/services/ui-launcher.service' import { PackageStatus, PrimaryRendering, - PrimaryStatus, } from 'src/app/services/pkg-status-rendering.service' import { DataModel, @@ -67,19 +66,15 @@ export class AppShowStatusComponent { } get isRunning(): boolean { - return this.status.primary === PrimaryStatus.Running + return this.status.primary === 'running' } get canStop(): boolean { - return [ - PrimaryStatus.Running, - PrimaryStatus.Starting, - PrimaryStatus.Restarting, - ].includes(this.status.primary) + return ['running', 'starting', 'restarting'].includes(this.status.primary) } get isStopped(): boolean { - return this.status.primary === PrimaryStatus.Stopped + return this.status.primary === 'stopped' } get sigtermTimeout(): string | null { diff --git a/web/projects/ui/src/app/pages/widgets/built-in/health/health.component.ts b/web/projects/ui/src/app/pages/widgets/built-in/health/health.component.ts index bc496b219..8586c3b35 100644 --- a/web/projects/ui/src/app/pages/widgets/built-in/health/health.component.ts +++ b/web/projects/ui/src/app/pages/widgets/built-in/health/health.component.ts @@ -5,7 +5,6 @@ import { DataModel, PackageDataEntry, } from 'src/app/services/patch-db/data-model' -import { PrimaryStatus } from 'src/app/services/pkg-status-rendering.service' import { getPackageInfo, PkgInfo } from '../../../../util/get-package-info' import { combineLatest } from 'rxjs' import { DepErrorService } from 'src/app/services/dep-error.service' @@ -56,14 +55,11 @@ export class HealthComponent { private getCount(label: string, pkgs: PkgInfo[]): number { switch (label) { case 'Error': - return pkgs.filter( - a => a.primaryStatus !== PrimaryStatus.Stopped && a.error, - ).length + return pkgs.filter(a => a.primaryStatus !== 'stopped' && a.error).length case 'Needs Attention': return pkgs.filter(a => a.warning).length case 'Stopped': - return pkgs.filter(a => a.primaryStatus === PrimaryStatus.Stopped) - .length + return pkgs.filter(a => a.primaryStatus === 'stopped').length case 'Transitioning': return pkgs.filter(a => a.transitioning).length default: diff --git a/web/projects/ui/src/app/services/api/api.types.ts b/web/projects/ui/src/app/services/api/api.types.ts index 43edea08e..38c80187d 100644 --- a/web/projects/ui/src/app/services/api/api.types.ts +++ b/web/projects/ui/src/app/services/api/api.types.ts @@ -495,40 +495,29 @@ export type DependencyError = | DependencyErrorHealthChecksFailed | DependencyErrorTransitive -export enum DependencyErrorType { - NotInstalled = 'not-installed', - NotRunning = 'not-running', - IncorrectVersion = 'incorrect-version', - ConfigUnsatisfied = 'config-unsatisfied', - HealthChecksFailed = 'health-checks-failed', - InterfaceHealthChecksFailed = 'interface-health-checks-failed', - Transitive = 'transitive', -} - export interface DependencyErrorNotInstalled { - type: DependencyErrorType.NotInstalled + type: 'notInstalled' } export interface DependencyErrorNotRunning { - type: DependencyErrorType.NotRunning + type: 'notRunning' } export interface DependencyErrorIncorrectVersion { - type: DependencyErrorType.IncorrectVersion + type: 'incorrectVersion' expected: string // version range received: string // version } export interface DependencyErrorConfigUnsatisfied { - type: DependencyErrorType.ConfigUnsatisfied - error: string + type: 'configUnsatisfied' } export interface DependencyErrorHealthChecksFailed { - type: DependencyErrorType.HealthChecksFailed + type: 'healthChecksFailed' check: HealthCheckResult } export interface DependencyErrorTransitive { - type: DependencyErrorType.Transitive + type: 'transitive' } diff --git a/web/projects/ui/src/app/services/dep-error.service.ts b/web/projects/ui/src/app/services/dep-error.service.ts index fe145055b..987499a5d 100644 --- a/web/projects/ui/src/app/services/dep-error.service.ts +++ b/web/projects/ui/src/app/services/dep-error.service.ts @@ -9,6 +9,7 @@ import { } from './patch-db/data-model' import * as deepEqual from 'fast-deep-equal' import { isInstalled } from '../util/get-package-data' +import { DependencyError } from './api/api.types' export type AllDependencyErrors = Record export type PkgDependencyErrors = Record @@ -78,7 +79,7 @@ export class DepErrorService { // not installed if (!dep || dep.stateInfo.state !== 'installed') { return { - type: DependencyErrorType.NotInstalled, + type: 'notInstalled', } } @@ -88,7 +89,7 @@ export class DepErrorService { // incorrect version if (!this.emver.satisfies(depManifest.version, versionSpec)) { return { - type: DependencyErrorType.IncorrectVersion, + type: 'incorrectVersion', expected: versionSpec, received: depManifest.version, } @@ -97,7 +98,7 @@ export class DepErrorService { // invalid config if (Object.values(pkg.status.dependencyConfigErrors).some(err => !!err)) { return { - type: DependencyErrorType.ConfigUnsatisfied, + type: 'configUnsatisfied', } } @@ -106,7 +107,7 @@ export class DepErrorService { // not running if (depStatus !== 'running' && depStatus !== 'starting') { return { - type: DependencyErrorType.NotRunning, + type: 'notRunning', } } @@ -115,9 +116,11 @@ export class DepErrorService { // health check failure if (depStatus === 'running' && currentDep.kind === 'running') { for (let id of currentDep.healthChecks) { - if (dep.status.main.health[id]?.result !== 'success') { + const check = dep.status.main.health[id] + if (check?.result !== 'success') { return { - type: DependencyErrorType.HealthChecksFailed, + type: 'healthChecksFailed', + check, } } } @@ -130,7 +133,7 @@ export class DepErrorService { if (transitiveError) { return { - type: DependencyErrorType.Transitive, + type: 'transitive', } } @@ -154,46 +157,3 @@ function dependencyDepth( depth, ) } - -export type DependencyError = - | DependencyErrorNotInstalled - | DependencyErrorNotRunning - | DependencyErrorIncorrectVersion - | DependencyErrorConfigUnsatisfied - | DependencyErrorHealthChecksFailed - | DependencyErrorTransitive - -export enum DependencyErrorType { - NotInstalled = 'notInstalled', - NotRunning = 'notRunning', - IncorrectVersion = 'incorrectVersion', - ConfigUnsatisfied = 'configUnsatisfied', - HealthChecksFailed = 'healthChecksFailed', - Transitive = 'transitive', -} - -export interface DependencyErrorNotInstalled { - type: DependencyErrorType.NotInstalled -} - -export interface DependencyErrorNotRunning { - type: DependencyErrorType.NotRunning -} - -export interface DependencyErrorIncorrectVersion { - type: DependencyErrorType.IncorrectVersion - expected: string // version range - received: string // version -} - -export interface DependencyErrorConfigUnsatisfied { - type: DependencyErrorType.ConfigUnsatisfied -} - -export interface DependencyErrorHealthChecksFailed { - type: DependencyErrorType.HealthChecksFailed -} - -export interface DependencyErrorTransitive { - type: DependencyErrorType.Transitive -} diff --git a/web/projects/ui/src/app/services/pkg-status-rendering.service.ts b/web/projects/ui/src/app/services/pkg-status-rendering.service.ts index d95a5ccdc..a3f19b18f 100644 --- a/web/projects/ui/src/app/services/pkg-status-rendering.service.ts +++ b/web/projects/ui/src/app/services/pkg-status-rendering.service.ts @@ -1,12 +1,12 @@ -import { isEmptyObject } from '@start9labs/shared' import { PackageDataEntry } from 'src/app/services/patch-db/data-model' import { PkgDependencyErrors } from './dep-error.service' import { Status } from '../../../../../../core/startos/bindings/Status' +import { T } from '@start9labs/start-sdk' export interface PackageStatus { primary: PrimaryStatus dependency: DependencyStatus | null - health: HealthStatus | null + health: T.HealthStatus | null } export function renderPkgStatus( @@ -15,59 +15,51 @@ export function renderPkgStatus( ): PackageStatus { let primary: PrimaryStatus let dependency: DependencyStatus | null = null - let health: HealthStatus | null = null + let health: T.HealthStatus | null = null if (pkg.stateInfo.state === 'installed') { - primary = getPrimaryStatus(pkg.status) + primary = getInstalledPrimaryStatus(pkg.status) dependency = getDependencyStatus(depErrors) health = getHealthStatus(pkg.status) } else { - primary = pkg.stateInfo.state as string as PrimaryStatus + primary = pkg.stateInfo.state } return { primary, dependency, health } } -function getPrimaryStatus(status: Status): PrimaryStatus { +function getInstalledPrimaryStatus(status: Status): PrimaryStatus { if (!status.configured) { - return PrimaryStatus.NeedsConfig - } else if (status.main.status === 'restarting') { - return PrimaryStatus.Restarting + return 'needsConfig' } else { return status.main.status as any as PrimaryStatus } } function getDependencyStatus(depErrors: PkgDependencyErrors): DependencyStatus { - return Object.values(depErrors).some(err => !!err) - ? DependencyStatus.Warning - : DependencyStatus.Satisfied + return Object.values(depErrors).some(err => !!err) ? 'warning' : 'satisfied' } -function getHealthStatus(status: Status): HealthStatus | null { +function getHealthStatus(status: Status): T.HealthStatus | null { if (status.main.status !== 'running' || !status.main.health) { return null } const values = Object.values(status.main.health) - if (values.some(h => !h.result)) { - return HealthStatus.Waiting - } - if (values.some(h => h.result === 'failure')) { - return HealthStatus.Failure + return 'failure' } if (values.some(h => h.result === 'loading')) { - return HealthStatus.Loading + return 'loading' } if (values.some(h => h.result === 'starting')) { - return HealthStatus.Starting + return 'starting' } - return HealthStatus.Healthy + return 'success' } export interface StatusRendering { @@ -76,102 +68,88 @@ export interface StatusRendering { showDots?: boolean } -export enum PrimaryStatus { - // state - Installing = 'installing', - Updating = 'updating', - Removing = 'removing', - Restoring = 'restoring', - // status - Starting = 'starting', - Running = 'running', - Stopping = 'stopping', - Restarting = 'restarting', - Stopped = 'stopped', - BackingUp = 'backing-up', - // config - NeedsConfig = 'needs-config', -} +export type PrimaryStatus = + | 'installing' + | 'updating' + | 'removing' + | 'restoring' + | 'starting' + | 'running' + | 'stopping' + | 'restarting' + | 'stopped' + | 'backingUp' + | 'needsConfig' -export enum DependencyStatus { - Warning = 'warning', - Satisfied = 'satisfied', -} +export type DependencyStatus = 'warning' | 'satisfied' -export enum HealthStatus { - Failure = 'failure', - Waiting = 'waiting', - Starting = 'starting', - Loading = 'loading', - Healthy = 'healthy', -} - -export const PrimaryRendering: Record = { - [PrimaryStatus.Installing]: { +export const PrimaryRendering: Record = { + installing: { display: 'Installing', color: 'primary', showDots: true, }, - [PrimaryStatus.Updating]: { + updating: { display: 'Updating', color: 'primary', showDots: true, }, - [PrimaryStatus.Removing]: { + removing: { display: 'Removing', color: 'danger', showDots: true, }, - [PrimaryStatus.Restoring]: { + restoring: { display: 'Restoring', color: 'primary', showDots: true, }, - [PrimaryStatus.Stopping]: { + stopping: { display: 'Stopping', color: 'dark-shade', showDots: true, }, - [PrimaryStatus.Restarting]: { + restarting: { display: 'Restarting', color: 'tertiary', showDots: true, }, - [PrimaryStatus.Stopped]: { + stopped: { display: 'Stopped', color: 'dark-shade', showDots: false, }, - [PrimaryStatus.BackingUp]: { + backingUp: { display: 'Backing Up', color: 'primary', showDots: true, }, - [PrimaryStatus.Starting]: { + starting: { display: 'Starting', color: 'primary', showDots: true, }, - [PrimaryStatus.Running]: { + running: { display: 'Running', color: 'success', showDots: false, }, - [PrimaryStatus.NeedsConfig]: { + needsConfig: { display: 'Needs Config', color: 'warning', showDots: false, }, } -export const DependencyRendering: Record = { - [DependencyStatus.Warning]: { display: 'Issue', color: 'warning' }, - [DependencyStatus.Satisfied]: { display: 'Satisfied', color: 'success' }, +export const DependencyRendering: Record = { + warning: { display: 'Issue', color: 'warning' }, + satisfied: { display: 'Satisfied', color: 'success' }, } -export const HealthRendering: Record = { - [HealthStatus.Failure]: { display: 'Failure', color: 'danger' }, - [HealthStatus.Starting]: { display: 'Starting', color: 'primary' }, - [HealthStatus.Loading]: { display: 'Loading', color: 'primary' }, - [HealthStatus.Healthy]: { display: 'Healthy', color: 'success' }, +export const HealthRendering: Record = { + failure: { display: 'Failure', color: 'danger' }, + starting: { display: 'Starting', color: 'primary' }, + loading: { display: 'Loading', color: 'primary' }, + success: { display: 'Healthy', color: 'success' }, + disabled: { display: 'Disabled', color: 'dark' }, } diff --git a/web/projects/ui/src/app/util/get-package-info.ts b/web/projects/ui/src/app/util/get-package-info.ts index 936ed9954..3e506ea61 100644 --- a/web/projects/ui/src/app/util/get-package-info.ts +++ b/web/projects/ui/src/app/util/get-package-info.ts @@ -1,7 +1,5 @@ import { PackageDataEntry } from '../services/patch-db/data-model' import { - DependencyStatus, - HealthStatus, PrimaryRendering, PrimaryStatus, renderPkgStatus, @@ -21,15 +19,12 @@ export function getPackageInfo( entry, primaryRendering, primaryStatus: statuses.primary, - error: - statuses.health === HealthStatus.Failure || - statuses.dependency === DependencyStatus.Warning, - warning: statuses.primary === PrimaryStatus.NeedsConfig, + error: statuses.health === 'failure' || statuses.dependency === 'warning', + warning: statuses.primary === 'needsConfig', transitioning: primaryRendering.showDots || - statuses.health === HealthStatus.Waiting || - statuses.health === HealthStatus.Loading || - statuses.health === HealthStatus.Starting, + statuses.health === 'loading' || + statuses.health === 'starting', } }