reconcile types

This commit is contained in:
Aiden McClelland
2021-08-05 11:23:20 -06:00
committed by Aiden McClelland
parent a272d5d698
commit a1f1dc2ce7
11 changed files with 449 additions and 193 deletions

35
appmgr/Cargo.lock generated
View File

@@ -153,7 +153,7 @@ dependencies = [
"cfg-if 0.1.10", "cfg-if 0.1.10",
"clang-sys", "clang-sys",
"clap", "clap",
"env_logger", "env_logger 0.7.1",
"lazy_static", "lazy_static",
"lazycell", "lazycell",
"log", "log",
@@ -875,7 +875,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36"
dependencies = [ dependencies = [
"atty", "atty",
"humantime", "humantime 1.3.0",
"log",
"regex",
"termcolor",
]
[[package]]
name = "env_logger"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3"
dependencies = [
"atty",
"humantime 2.1.0",
"log", "log",
"regex", "regex",
"termcolor", "termcolor",
@@ -1243,6 +1256,12 @@ dependencies = [
"quick-error", "quick-error",
] ]
[[package]]
name = "humantime"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
[[package]] [[package]]
name = "hyper" name = "hyper"
version = "0.14.11" version = "0.14.11"
@@ -1287,12 +1306,12 @@ source = "git+https://github.com/Start9Labs/hyper-ws-listener.git?branch=main#d5
dependencies = [ dependencies = [
"anyhow", "anyhow",
"base64 0.13.0", "base64 0.13.0",
"env_logger", "env_logger 0.9.0",
"futures", "futures",
"hyper", "hyper",
"log", "log",
"sha-1", "sha-1",
"tokio 1.8.1", "tokio 1.9.0",
"tokio-tungstenite", "tokio-tungstenite",
] ]
@@ -2530,9 +2549,9 @@ dependencies = [
[[package]] [[package]]
name = "sha-1" name = "sha-1"
version = "0.9.6" version = "0.9.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c4cfa741c5832d0ef7fab46cabed29c2aae926db0b11bb2069edd8db5e64e16" checksum = "1a0c8611594e2ab4ebbf06ec7cbbf0a99450b8570e96cbf5188b5d5f6ef18d81"
dependencies = [ dependencies = [
"block-buffer 0.9.0", "block-buffer 0.9.0",
"cfg-if 1.0.0", "cfg-if 1.0.0",
@@ -3186,7 +3205,7 @@ dependencies = [
"futures-util", "futures-util",
"log", "log",
"pin-project", "pin-project",
"tokio 1.8.1", "tokio 1.9.0",
"tungstenite", "tungstenite",
] ]
@@ -3289,7 +3308,7 @@ dependencies = [
"httparse", "httparse",
"input_buffer", "input_buffer",
"log", "log",
"rand 0.8.3", "rand 0.8.4",
"sha-1", "sha-1",
"thiserror", "thiserror",
"url", "url",

View File

@@ -99,12 +99,24 @@ impl RpcContext {
Ok(Self(seed)) Ok(Self(seed))
} }
pub async fn package_registry_url(&self) -> Result<Url, Error> { pub async fn package_registry_url(&self) -> Result<Url, Error> {
Ok(crate::db::DatabaseModel::new() Ok(
.server_info() if let Some(market) = crate::db::DatabaseModel::new()
.registry() .server_info()
.get(&mut self.db.handle(), false) .package_marketplace()
.await? .get(&mut self.db.handle(), false)
.to_owned()) .await?
.to_owned()
{
market
} else {
crate::db::DatabaseModel::new()
.server_info()
.eos_marketplace()
.get(&mut self.db.handle(), false)
.await?
.to_owned()
},
)
} }
} }
impl Context for RpcContext { impl Context for RpcContext {

View File

@@ -39,9 +39,33 @@ impl Database {
"http://privacy34kn4ez3y3nijweec6w4g54i3g54sdv7r5mr6soma3w4begyd.onion" "http://privacy34kn4ez3y3nijweec6w4g54i3g54sdv7r5mr6soma3w4begyd.onion"
.parse() .parse()
.unwrap(), .unwrap(),
updating: false, status: ServerStatus::Running,
registry: "https://beta-registry-0-3.start9labs.com".parse().unwrap(), eos_marketplace: "https://beta-registry-0-3.start9labs.com".parse().unwrap(),
package_marketplace: None,
wifi: WifiInfo {
ssids: Vec::new(),
connected: None,
selected: None,
},
unread_notification_count: 0, unread_notification_count: 0,
specs: ServerSpecs {
cpu: Usage {
used: 0_f64,
total: 1_f64,
},
disk: Usage {
used: 0_f64,
total: 1_f64,
},
memory: Usage {
used: 0_f64,
total: 1_f64,
},
},
connection_addresses: ConnectionAddresses {
tor: Vec::new(),
clearnet: Vec::new(),
},
}, },
package_data: AllPackageData::default(), package_data: AllPackageData::default(),
broken_packages: Vec::new(), broken_packages: Vec::new(),
@@ -62,9 +86,51 @@ pub struct ServerInfo {
version: Version, version: Version,
lan_address: Url, lan_address: Url,
tor_address: Url, tor_address: Url,
updating: bool, status: ServerStatus,
registry: Url, eos_marketplace: Url,
package_marketplace: Option<Url>,
wifi: WifiInfo,
unread_notification_count: u64, unread_notification_count: u64,
specs: ServerSpecs,
connection_addresses: ConnectionAddresses,
}
#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "kebab-case")]
pub enum ServerStatus {
Running,
Updating,
BackingUp,
}
#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "kebab-case")]
pub struct WifiInfo {
pub ssids: Vec<String>,
pub selected: Option<String>,
pub connected: Option<String>,
}
#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "kebab-case")]
pub struct ServerSpecs {
pub cpu: Usage,
pub disk: Usage,
pub memory: Usage,
}
#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "kebab-case")]
pub struct Usage {
pub used: f64,
pub total: f64,
}
#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "kebab-case")]
pub struct ConnectionAddresses {
pub tor: Vec<String>,
pub clearnet: Vec<String>,
} }
#[derive(Debug, Default, Deserialize, Serialize)] #[derive(Debug, Default, Deserialize, Serialize)]
@@ -150,6 +216,8 @@ impl PackageDataEntryModel {
pub struct InstalledPackageDataEntry { pub struct InstalledPackageDataEntry {
#[model] #[model]
pub status: Status, pub status: Status,
#[model]
pub manifest: Manifest,
pub system_pointers: Vec<SystemPointerSpec>, pub system_pointers: Vec<SystemPointerSpec>,
#[model] #[model]
pub current_dependents: IndexMap<PackageId, CurrentDependencyInfo>, pub current_dependents: IndexMap<PackageId, CurrentDependencyInfo>,
@@ -158,13 +226,6 @@ pub struct InstalledPackageDataEntry {
#[model] #[model]
pub interface_addresses: InterfaceAddressMap, pub interface_addresses: InterfaceAddressMap,
} }
impl InstalledPackageDataEntryModel {
pub fn manifest(self) -> ManifestModel {
let mut ptr = JsonPointer::from(self);
ptr.pop_end();
PackageDataEntryModel::from(ptr).manifest()
}
}
#[derive(Clone, Debug, Default, Deserialize, Serialize, HasModel)] #[derive(Clone, Debug, Default, Deserialize, Serialize, HasModel)]
#[serde(rename_all = "kebab-case")] #[serde(rename_all = "kebab-case")]

View File

@@ -121,6 +121,7 @@ impl HasModel for Dependencies {
pub struct DepInfo { pub struct DepInfo {
pub version: VersionRange, pub version: VersionRange,
pub optional: Option<String>, pub optional: Option<String>,
pub recommended: bool,
pub description: Option<String>, pub description: Option<String>,
pub critical: bool, pub critical: bool,
#[serde(default)] #[serde(default)]

View File

@@ -406,6 +406,7 @@ pub async fn install_s9pk<R: AsyncRead + AsyncSeek + Unpin>(
dependency_errors: DependencyErrors::init(&mut tx, &manifest, &current_dependencies) dependency_errors: DependencyErrors::init(&mut tx, &manifest, &current_dependencies)
.await?, .await?,
}, },
manifest: manifest.clone(),
system_pointers: Vec::new(), system_pointers: Vec::new(),
current_dependents: { current_dependents: {
// search required dependencies // search required dependencies

View File

@@ -135,6 +135,8 @@ impl<S: AsRef<str>> AsRef<Path> for InterfaceId<S> {
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "kebab-case")] #[serde(rename_all = "kebab-case")]
pub struct Interface { pub struct Interface {
pub name: String,
pub description: String,
pub tor_config: Option<TorConfig>, pub tor_config: Option<TorConfig>,
pub lan_config: Option<IndexMap<Port, LanPortConfig>>, pub lan_config: Option<IndexMap<Port, LanPortConfig>>,
pub ui: bool, pub ui: bool,

View File

@@ -113,6 +113,7 @@ pub struct Manifest {
pub upstream_repo: Url, pub upstream_repo: Url,
pub support_site: Option<Url>, pub support_site: Option<Url>,
pub marketing_site: Option<Url>, pub marketing_site: Option<Url>,
pub donation_url: Option<Url>,
#[serde(default)] #[serde(default)]
pub alerts: Alerts, pub alerts: Alerts,
#[model] #[model]

View File

@@ -95,7 +95,8 @@ impl HealthCheck {
result: match res { result: match res {
Ok(()) => HealthCheckResultVariant::Success, Ok(()) => HealthCheckResultVariant::Success,
Err((59, _)) => HealthCheckResultVariant::Disabled, Err((59, _)) => HealthCheckResultVariant::Disabled,
Err((60, _)) => HealthCheckResultVariant::WarmingUp, Err((60, _)) => HealthCheckResultVariant::Starting,
Err((61, message)) => HealthCheckResultVariant::Loading { message },
Err((_, error)) => HealthCheckResultVariant::Failure { error }, Err((_, error)) => HealthCheckResultVariant::Failure { error },
}, },
}) })
@@ -123,17 +124,19 @@ impl HealthCheckResult {
#[serde(rename_all = "kebab-case")] #[serde(rename_all = "kebab-case")]
#[serde(tag = "result")] #[serde(tag = "result")]
pub enum HealthCheckResultVariant { pub enum HealthCheckResultVariant {
WarmingUp,
Disabled,
Success, Success,
Disabled,
Starting,
Loading { message: String },
Failure { error: String }, Failure { error: String },
} }
impl std::fmt::Display for HealthCheckResultVariant { impl std::fmt::Display for HealthCheckResultVariant {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self { match self {
HealthCheckResultVariant::WarmingUp => write!(f, "Warming Up"),
HealthCheckResultVariant::Disabled => write!(f, "Disabled"),
HealthCheckResultVariant::Success => write!(f, "Succeeded"), HealthCheckResultVariant::Success => write!(f, "Succeeded"),
HealthCheckResultVariant::Disabled => write!(f, "Disabled"),
HealthCheckResultVariant::Starting => write!(f, "Starting"),
HealthCheckResultVariant::Loading { message } => write!(f, "Loading ({})", message),
HealthCheckResultVariant::Failure { error } => write!(f, "Failed ({})", error), HealthCheckResultVariant::Failure { error } => write!(f, "Failed ({})", error),
} }
} }

116
compat/Cargo.lock generated
View File

@@ -739,6 +739,7 @@ dependencies = [
"futures", "futures",
"git-version", "git-version",
"http", "http",
"hyper-ws-listener",
"indexmap", "indexmap",
"itertools 0.10.1", "itertools 0.10.1",
"jsonpath_lib", "jsonpath_lib",
@@ -771,6 +772,7 @@ dependencies = [
"tokio-compat-02", "tokio-compat-02",
"tokio-stream", "tokio-stream",
"tokio-tar", "tokio-tar",
"tokio-tungstenite",
"tokio-util", "tokio-util",
"toml", "toml",
"torut", "torut",
@@ -814,6 +816,19 @@ dependencies = [
"cfg-if", "cfg-if",
] ]
[[package]]
name = "env_logger"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3"
dependencies = [
"atty",
"humantime",
"log",
"regex",
"termcolor",
]
[[package]] [[package]]
name = "fake-simd" name = "fake-simd"
version = "0.1.2" version = "0.1.2"
@@ -1161,6 +1176,12 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6456b8a6c8f33fee7d958fcd1b60d55b11940a79e63ae87013e6d22e26034440" checksum = "6456b8a6c8f33fee7d958fcd1b60d55b11940a79e63ae87013e6d22e26034440"
[[package]]
name = "humantime"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
[[package]] [[package]]
name = "hyper" name = "hyper"
version = "0.14.11" version = "0.14.11"
@@ -1198,6 +1219,22 @@ dependencies = [
"tokio-native-tls", "tokio-native-tls",
] ]
[[package]]
name = "hyper-ws-listener"
version = "0.1.0"
source = "git+https://github.com/Start9Labs/hyper-ws-listener.git?branch=main#d5db3698d61293375384a5d8aa980c834d45028a"
dependencies = [
"anyhow",
"base64 0.13.0",
"env_logger",
"futures",
"hyper",
"log",
"sha-1",
"tokio 1.9.0",
"tokio-tungstenite",
]
[[package]] [[package]]
name = "hyperlocal" name = "hyperlocal"
version = "0.8.0" version = "0.8.0"
@@ -1239,6 +1276,15 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "input_buffer"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f97967975f448f1a7ddb12b0bc41069d09ed6a1c161a92687e057325db35d413"
dependencies = [
"bytes 1.0.1",
]
[[package]] [[package]]
name = "instant" name = "instant"
version = "0.1.10" version = "0.1.10"
@@ -2377,6 +2423,19 @@ dependencies = [
"yaml-rust", "yaml-rust",
] ]
[[package]]
name = "sha-1"
version = "0.9.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a0c8611594e2ab4ebbf06ec7cbbf0a99450b8570e96cbf5188b5d5f6ef18d81"
dependencies = [
"block-buffer 0.9.0",
"cfg-if",
"cpufeatures",
"digest 0.9.0",
"opaque-debug 0.3.0",
]
[[package]] [[package]]
name = "sha1" name = "sha1"
version = "0.6.0" version = "0.6.0"
@@ -2780,6 +2839,15 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "termcolor"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4"
dependencies = [
"winapi-util",
]
[[package]] [[package]]
name = "textwrap" name = "textwrap"
version = "0.11.0" version = "0.11.0"
@@ -2998,6 +3066,19 @@ dependencies = [
"xattr", "xattr",
] ]
[[package]]
name = "tokio-tungstenite"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e96bb520beab540ab664bd5a9cfeaa1fcd846fa68c830b42e2c8963071251d2"
dependencies = [
"futures-util",
"log",
"pin-project",
"tokio 1.9.0",
"tungstenite",
]
[[package]] [[package]]
name = "tokio-util" name = "tokio-util"
version = "0.6.7" version = "0.6.7"
@@ -3084,6 +3165,26 @@ version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642"
[[package]]
name = "tungstenite"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5fe8dada8c1a3aeca77d6b51a4f1314e0f4b8e438b7b1b71e3ddaca8080e4093"
dependencies = [
"base64 0.13.0",
"byteorder",
"bytes 1.0.1",
"http",
"httparse",
"input_buffer",
"log",
"rand 0.8.4",
"sha-1",
"thiserror",
"url",
"utf-8",
]
[[package]] [[package]]
name = "typed-builder" name = "typed-builder"
version = "0.9.0" version = "0.9.0"
@@ -3168,6 +3269,12 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "utf-8"
version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
[[package]] [[package]]
name = "vcpkg" name = "vcpkg"
version = "0.2.15" version = "0.2.15"
@@ -3331,6 +3438,15 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
dependencies = [
"winapi",
]
[[package]] [[package]]
name = "winapi-x86_64-pc-windows-gnu" name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0" version = "0.4.0"

View File

@@ -46,14 +46,14 @@ export module Mock {
system: true, system: true,
entrypoint: '', entrypoint: '',
args: [''], args: [''],
mounts: { }, mounts: {},
'io-format': DockerIoFormat.Yaml, 'io-format': DockerIoFormat.Yaml,
inject: false, inject: false,
'shm-size': '', 'shm-size': '',
}, },
'health-checks': { }, 'health-checks': {},
config: null, config: null,
volumes: { }, volumes: {},
'min-os-version': '0.2.12', 'min-os-version': '0.2.12',
interfaces: { interfaces: {
ui: { ui: {
@@ -61,10 +61,9 @@ export module Mock {
description: 'Web application for viewing information about your node and the Bitcoin network.', description: 'Web application for viewing information about your node and the Bitcoin network.',
ui: true, ui: true,
'tor-config': { 'tor-config': {
'hidden-service-version': 'v3', 'port-mapping': {},
'port-mapping': { },
}, },
'lan-config': { }, 'lan-config': {},
protocols: [], protocols: [],
}, },
rpc: { rpc: {
@@ -72,10 +71,9 @@ export module Mock {
description: 'Used by wallets to interact with your Bitcoin Core node.', description: 'Used by wallets to interact with your Bitcoin Core node.',
ui: false, ui: false,
'tor-config': { 'tor-config': {
'hidden-service-version': 'v3', 'port-mapping': {},
'port-mapping': { },
}, },
'lan-config': { }, 'lan-config': {},
protocols: [], protocols: [],
}, },
p2p: { p2p: {
@@ -83,10 +81,9 @@ export module Mock {
description: 'Used by other Bitcoin nodes to communicate and interact with your node.', description: 'Used by other Bitcoin nodes to communicate and interact with your node.',
ui: false, ui: false,
'tor-config': { 'tor-config': {
'hidden-service-version': 'v3', 'port-mapping': {},
'port-mapping': { },
}, },
'lan-config': { }, 'lan-config': {},
protocols: [], protocols: [],
}, },
}, },
@@ -97,7 +94,7 @@ export module Mock {
system: true, system: true,
entrypoint: '', entrypoint: '',
args: [''], args: [''],
mounts: { }, mounts: {},
'io-format': DockerIoFormat.Yaml, 'io-format': DockerIoFormat.Yaml,
inject: false, inject: false,
'shm-size': '', 'shm-size': '',
@@ -108,7 +105,7 @@ export module Mock {
system: true, system: true,
entrypoint: '', entrypoint: '',
args: [''], args: [''],
mounts: { }, mounts: {},
'io-format': DockerIoFormat.Yaml, 'io-format': DockerIoFormat.Yaml,
inject: false, inject: false,
'shm-size': '', 'shm-size': '',
@@ -127,7 +124,7 @@ export module Mock {
system: true, system: true,
entrypoint: '', entrypoint: '',
args: [''], args: [''],
mounts: { }, mounts: {},
'io-format': DockerIoFormat.Yaml, 'io-format': DockerIoFormat.Yaml,
inject: false, inject: false,
'shm-size': '', 'shm-size': '',
@@ -135,8 +132,8 @@ export module Mock {
'input-spec': null, 'input-spec': null,
}, },
}, },
permissions: { }, permissions: {},
dependencies: { }, dependencies: {},
} }
export const MockManifestLnd: Manifest = { export const MockManifestLnd: Manifest = {
@@ -167,14 +164,14 @@ export module Mock {
system: true, system: true,
entrypoint: '', entrypoint: '',
args: [''], args: [''],
mounts: { }, mounts: {},
'io-format': DockerIoFormat.Yaml, 'io-format': DockerIoFormat.Yaml,
inject: false, inject: false,
'shm-size': '', 'shm-size': '',
}, },
'health-checks': { }, 'health-checks': {},
config: null, config: null,
volumes: { }, volumes: {},
'min-os-version': '0.2.12', 'min-os-version': '0.2.12',
interfaces: { interfaces: {
rpc: { rpc: {
@@ -182,8 +179,7 @@ export module Mock {
description: 'Good for connecting to your node at a distance.', description: 'Good for connecting to your node at a distance.',
ui: true, ui: true,
'tor-config': { 'tor-config': {
'hidden-service-version': 'v3', 'port-mapping': {},
'port-mapping': { },
}, },
'lan-config': { 'lan-config': {
44: { 44: {
@@ -198,8 +194,7 @@ export module Mock {
description: 'Certain wallet use grpc.', description: 'Certain wallet use grpc.',
ui: false, ui: false,
'tor-config': { 'tor-config': {
'hidden-service-version': 'v3', 'port-mapping': {},
'port-mapping': { },
}, },
'lan-config': { 'lan-config': {
66: { 66: {
@@ -217,7 +212,7 @@ export module Mock {
system: true, system: true,
entrypoint: '', entrypoint: '',
args: [''], args: [''],
mounts: { }, mounts: {},
'io-format': DockerIoFormat.Yaml, 'io-format': DockerIoFormat.Yaml,
inject: false, inject: false,
'shm-size': '', 'shm-size': '',
@@ -228,7 +223,7 @@ export module Mock {
system: true, system: true,
entrypoint: '', entrypoint: '',
args: [''], args: [''],
mounts: { }, mounts: {},
'io-format': DockerIoFormat.Yaml, 'io-format': DockerIoFormat.Yaml,
inject: false, inject: false,
'shm-size': '', 'shm-size': '',
@@ -247,7 +242,7 @@ export module Mock {
system: true, system: true,
entrypoint: '', entrypoint: '',
args: [''], args: [''],
mounts: { }, mounts: {},
'io-format': DockerIoFormat.Yaml, 'io-format': DockerIoFormat.Yaml,
inject: false, inject: false,
'shm-size': '', 'shm-size': '',
@@ -263,23 +258,69 @@ export module Mock {
}, },
}, },
}, },
permissions: { }, permissions: {},
dependencies: { dependencies: {
'bitcoind': { 'bitcoind': {
version: '=0.21.0', version: '=0.21.0',
description: 'LND needs bitcoin to live.', description: 'LND needs bitcoin to live.',
optional: null, optional: null,
recommended: true, recommended: true,
config: [], critical: true,
interfaces: [], config: {
check: {
type: 'docker',
image: 'alpine',
system: true,
entrypoint: 'true',
args: [],
mounts: {},
'io-format': DockerIoFormat.Cbor,
inject: false,
"shm-size": '10m'
},
"auto-configure": {
type: 'docker',
image: 'alpine',
system: true,
entrypoint: 'cat',
args: [],
mounts: {},
'io-format': DockerIoFormat.Cbor,
inject: false,
"shm-size": '10m'
}
},
}, },
'bitcoin-proxy': { 'bitcoin-proxy': {
version: '>=0.2.2', version: '>=0.2.2',
description: 'As long as Bitcoin is pruned, LND needs Bitcoin Proxy to fetch block over the P2P network.', description: 'As long as Bitcoin is pruned, LND needs Bitcoin Proxy to fetch block over the P2P network.',
optional: null, optional: null,
recommended: true, recommended: true,
config: [], critical: true,
interfaces: [], config: {
check: {
type: 'docker',
image: 'alpine',
system: true,
entrypoint: 'true',
args: [],
mounts: {},
'io-format': DockerIoFormat.Cbor,
inject: false,
"shm-size": '10m'
},
"auto-configure": {
type: 'docker',
image: 'alpine',
system: true,
entrypoint: 'cat',
args: [],
mounts: {},
'io-format': DockerIoFormat.Cbor,
inject: false,
"shm-size": '10m'
}
},
}, },
}, },
} }
@@ -312,14 +353,14 @@ export module Mock {
system: true, system: true,
entrypoint: '', entrypoint: '',
args: [''], args: [''],
mounts: { }, mounts: {},
'io-format': DockerIoFormat.Yaml, 'io-format': DockerIoFormat.Yaml,
inject: false, inject: false,
'shm-size': '', 'shm-size': '',
}, },
'health-checks': { }, 'health-checks': {},
config: null, config: null,
volumes: { }, volumes: {},
'min-os-version': '0.2.12', 'min-os-version': '0.2.12',
interfaces: { interfaces: {
rpc: { rpc: {
@@ -327,8 +368,7 @@ export module Mock {
description: 'Good for connecting to your node at a distance.', description: 'Good for connecting to your node at a distance.',
ui: true, ui: true,
'tor-config': { 'tor-config': {
'hidden-service-version': 'v3', 'port-mapping': {},
'port-mapping': { },
}, },
'lan-config': { 'lan-config': {
44: { 44: {
@@ -346,7 +386,7 @@ export module Mock {
system: true, system: true,
entrypoint: '', entrypoint: '',
args: [''], args: [''],
mounts: { }, mounts: {},
'io-format': DockerIoFormat.Yaml, 'io-format': DockerIoFormat.Yaml,
inject: false, inject: false,
'shm-size': '', 'shm-size': '',
@@ -357,23 +397,46 @@ export module Mock {
system: true, system: true,
entrypoint: '', entrypoint: '',
args: [''], args: [''],
mounts: { }, mounts: {},
'io-format': DockerIoFormat.Yaml, 'io-format': DockerIoFormat.Yaml,
inject: false, inject: false,
'shm-size': '', 'shm-size': '',
}, },
}, },
migrations: null, migrations: null,
actions: { }, actions: {},
permissions: { }, permissions: {},
dependencies: { dependencies: {
'bitcoind': { 'bitcoind': {
version: '>=0.20.0', version: '>=0.20.0',
description: 'Bitcoin Proxy requires a Bitcoin node.', description: 'Bitcoin Proxy requires a Bitcoin node.',
optional: null, optional: null,
recommended: true, recommended: true,
config: [], critical: false,
interfaces: [], config: {
check: {
type: 'docker',
image: 'alpine',
system: true,
entrypoint: 'true',
args: [],
mounts: {},
'io-format': DockerIoFormat.Cbor,
inject: false,
"shm-size": '10m'
},
"auto-configure": {
type: 'docker',
image: 'alpine',
system: true,
entrypoint: 'cat',
args: [],
mounts: {},
'io-format': DockerIoFormat.Cbor,
inject: false,
"shm-size": '10m'
}
},
}, },
}, },
} }
@@ -394,7 +457,7 @@ export module Mock {
}, },
categories: ['bitcoin', 'cryptocurrency'], categories: ['bitcoin', 'cryptocurrency'],
versions: ['0.19.0', '0.20.0', '0.21.0'], versions: ['0.19.0', '0.20.0', '0.21.0'],
'dependency-metadata': { }, 'dependency-metadata': {},
}, },
'0.20.0': { '0.20.0': {
icon: 'assets/img/service-icons/bitcoind.png', icon: 'assets/img/service-icons/bitcoind.png',
@@ -406,7 +469,7 @@ export module Mock {
}, },
categories: ['bitcoin', 'cryptocurrency'], categories: ['bitcoin', 'cryptocurrency'],
versions: ['0.19.0', '0.20.0', '0.21.0'], versions: ['0.19.0', '0.20.0', '0.21.0'],
'dependency-metadata': { }, 'dependency-metadata': {},
}, },
'0.21.0': { '0.21.0': {
icon: 'assets/img/service-icons/bitcoind.png', icon: 'assets/img/service-icons/bitcoind.png',
@@ -419,7 +482,7 @@ export module Mock {
}, },
categories: ['bitcoin', 'cryptocurrency'], categories: ['bitcoin', 'cryptocurrency'],
versions: ['0.19.0', '0.20.0', '0.21.0'], versions: ['0.19.0', '0.20.0', '0.21.0'],
'dependency-metadata': { }, 'dependency-metadata': {},
}, },
'latest': { 'latest': {
icon: 'assets/img/service-icons/bitcoind.png', icon: 'assets/img/service-icons/bitcoind.png',
@@ -431,7 +494,7 @@ export module Mock {
}, },
categories: ['bitcoin', 'cryptocurrency'], categories: ['bitcoin', 'cryptocurrency'],
versions: ['0.19.0', '0.20.0', '0.21.0'], versions: ['0.19.0', '0.20.0', '0.21.0'],
'dependency-metadata': { }, 'dependency-metadata': {},
}, },
}, },
'lnd': { 'lnd': {
@@ -532,17 +595,15 @@ export module Mock {
main: { main: {
status: PackageMainStatus.Running, status: PackageMainStatus.Running,
started: new Date().toISOString(), started: new Date().toISOString(),
health: { }, health: {},
}, },
'dependency-errors': { }, 'dependency-errors': {},
}, },
'interface-info': { manifest: MockManifestBitcoinProxy,
ip: '10.0.0.1', 'interface-addresses': {
addresses: { rpc: {
rpc: { 'tor-address': 'bitcoinproxy-rpc-address.onion',
'tor-address': 'bitcoinproxy-rpc-address.onion', 'lan-address': 'bitcoinproxy-rpc-address.local',
'lan-address': 'bitcoinproxy-rpc-address.local',
},
}, },
}, },
'system-pointers': [], 'system-pointers': [],
@@ -956,55 +1017,55 @@ export module Mock {
], ],
'range': '[0, 2]', 'range': '[0, 2]',
'spec': { 'spec': {
'tag': { 'tag': {
'id': 'preference', 'id': 'preference',
'name': 'Preferences', 'name': 'Preferences',
'variant-names': { 'variant-names': {
'summer': 'Summer', 'summer': 'Summer',
'winter': 'Winter', 'winter': 'Winter',
'other': 'Other', 'other': 'Other',
},
},
// this default is used to make a union selection when a new list element is first created
'default': 'summer',
'variants': {
'summer': {
'favorite-tree': {
'name': 'Favorite Tree',
'type': 'string',
'nullable': false,
'description': 'What is your favorite tree?',
'default': 'Maple',
'masked': false,
'copyable': false,
},
'favorite-flower': {
'name': 'Favorite Flower',
'type': 'enum',
'description': 'Select your favorite flower',
'value-names': {
'none': 'Hate Flowers',
'red': 'Red',
'blue': 'Blue',
'purple': 'Purple',
},
'values': [
'none',
'red',
'blue',
'purple',
],
'default': 'none',
},
},
'winter': {
'like-snow': {
'name': 'Like Snow?',
'type': 'boolean',
'description': 'Do you like snow or not?',
'default': true,
}, },
}, },
// this default is used to make a union selection when a new list element is first created
'default': 'summer',
'variants': {
'summer': {
'favorite-tree': {
'name': 'Favorite Tree',
'type': 'string',
'nullable': false,
'description': 'What is your favorite tree?',
'default': 'Maple',
'masked': false,
'copyable': false,
},
'favorite-flower': {
'name': 'Favorite Flower',
'type': 'enum',
'description': 'Select your favorite flower',
'value-names': {
'none': 'Hate Flowers',
'red': 'Red',
'blue': 'Blue',
'purple': 'Purple',
},
'values': [
'none',
'red',
'blue',
'purple',
],
'default': 'none',
},
},
'winter': {
'like-snow': {
'name': 'Like Snow?',
'type': 'boolean',
'description': 'Do you like snow or not?',
'default': true,
},
},
}, },
'unique-by': 'preference', 'unique-by': 'preference',
}, },
@@ -1188,12 +1249,12 @@ export module Mock {
'default': 'internal', 'default': 'internal',
'change-warning': 'Careful changing this', 'change-warning': 'Careful changing this',
'tag': { 'tag': {
'id': 'type', 'id': 'type',
'name': 'Type', 'name': 'Type',
'variant-names': { 'variant-names': {
'internal': 'Internal', 'internal': 'Internal',
'external': 'External', 'external': 'External',
}, },
}, },
'variants': { 'variants': {
'internal': { 'internal': {
@@ -1260,7 +1321,7 @@ export module Mock {
'description': 'api keys that are authorized to access your Bitcoin node.', 'description': 'api keys that are authorized to access your Bitcoin node.',
'range': '[0,*)', 'range': '[0,*)',
'default': [], 'default': [],
'spec': { }, 'spec': {},
}, },
}, },
// actual config // actual config
@@ -1395,21 +1456,19 @@ export module Mock {
}, },
}, },
}, },
'interface-info': { manifest: MockManifestLnd,
ip: '10.0.0.1', 'interface-addresses': {
addresses: { rpc: {
rpc: { 'tor-address': 'lnd-rpc-address.onion',
'tor-address': 'lnd-rpc-address.onion', 'lan-address': 'lnd-rpc-address.local',
'lan-address': 'lnd-rpc-address.local', },
}, grpc: {
grpc: { 'tor-address': 'lnd-grpc-address.onion',
'tor-address': 'lnd-grpc-address.onion', 'lan-address': 'lnd-grpc-address.local',
'lan-address': 'lnd-grpc-address.local',
},
}, },
}, },
'system-pointers': [], 'system-pointers': [],
'current-dependents': { }, 'current-dependents': {},
'current-dependencies': { 'current-dependencies': {
'bitcoind': { 'bitcoind': {
pointers: [], pointers: [],

View File

@@ -22,9 +22,9 @@ export interface ServerInfo {
wifi: WiFiInfo wifi: WiFiInfo
'unread-notification-count': number 'unread-notification-count': number
specs: { specs: {
CPU: string cpu: Usage
Disk: string disk: Usage
Memory: string memory: Usage
} }
'connection-addresses': { 'connection-addresses': {
tor: string[] tor: string[]
@@ -44,6 +44,11 @@ export interface WiFiInfo {
connected: string | null connected: string | null
} }
export interface Usage {
used: number
total: number
}
export interface PackageDataEntry { export interface PackageDataEntry {
state: PackageState state: PackageState
'static-files': { 'static-files': {
@@ -68,10 +73,13 @@ export interface InstallProgress {
export interface InstalledPackageDataEntry { export interface InstalledPackageDataEntry {
status: Status status: Status
'interface-info': InterfaceInfo manifest: Manifest,
'system-pointers': any[] 'system-pointers': any[]
'current-dependents': { [id: string]: CurrentDependencyInfo } 'current-dependents': { [id: string]: CurrentDependencyInfo }
'current-dependencies': { [id: string]: CurrentDependencyInfo } 'current-dependencies': { [id: string]: CurrentDependencyInfo }
'interface-addresses': {
[id: string]: { 'tor-address': string, 'lan-address': string }
}
} }
export interface CurrentDependencyInfo { export interface CurrentDependencyInfo {
@@ -152,6 +160,10 @@ export interface VolumeData {
readonly: boolean readonly: boolean
} }
export interface VolumeAssets {
type: VolumeType.Assets
}
export interface VolumePointer { export interface VolumePointer {
type: VolumeType.Pointer type: VolumeType.Pointer
'package-id': string 'package-id': string
@@ -165,11 +177,6 @@ export interface VolumeCertificate {
'interface-id': string 'interface-id': string
} }
export interface VolumeHiddenService {
type: VolumeType.HiddenService
'interface-id': string
}
export interface VolumeBackup { export interface VolumeBackup {
type: VolumeType.Backup type: VolumeType.Backup
readonly: boolean readonly: boolean
@@ -177,23 +184,22 @@ export interface VolumeBackup {
export enum VolumeType { export enum VolumeType {
Data = 'data', Data = 'data',
Assets = 'assets',
Pointer = 'pointer', Pointer = 'pointer',
Certificate = 'certificate', Certificate = 'certificate',
HiddenService = 'hidden-service',
Backup = 'backup', Backup = 'backup',
} }
export interface InterfaceDef { export interface InterfaceDef {
name: string name: string
description: string description: string
ui: boolean
'tor-config': TorConfig | null 'tor-config': TorConfig | null
'lan-config': LanConfig | null 'lan-config': LanConfig | null
ui: boolean
protocols: string[] protocols: string[]
} }
export interface TorConfig { export interface TorConfig {
'hidden-service-version': string
'port-mapping': { [port: number]: number } 'port-mapping': { [port: number]: number }
} }
@@ -348,35 +354,10 @@ export interface DependencyEntry {
optional: string | null optional: string | null
recommended: boolean recommended: boolean
description: string | null description: string | null
config: ConfigRuleEntryWithSuggestions[] // @TODO when do we use this? critical: boolean,
interfaces: any[] // @TODO placeholder config: {
} check: ActionImpl,
'auto-configure': ActionImpl
export interface ConfigRuleEntryWithSuggestions {
rule: string
description: string
suggestions: Suggestion[]
}
export interface Suggestion {
condition: string | null
set?: {
var: string
to?: string
'to-value'?: any
'to-entropy'?: { charset: string, len: number }
}
delete?: string
push?: {
to: string
value: any
}
}
export interface InterfaceInfo {
ip: string
addresses: {
[id: string]: { 'tor-address': string, 'lan-address': string }
} }
} }