mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-04 14:29:45 +00:00
Merge branch 'integration/new-container-runtime' of github.com:Start9Labs/start-os into rebase/feat/domains
This commit is contained in:
@@ -26,7 +26,7 @@ pub struct ActionResultV0 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, Deserialize, Serialize)]
|
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub enum DockerStatus {
|
pub enum DockerStatus {
|
||||||
Running,
|
Running,
|
||||||
Stopped,
|
Stopped,
|
||||||
@@ -48,7 +48,7 @@ pub fn display_action_result(params: WithIoFormat<ActionParams>, result: ActionR
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct ActionParams {
|
pub struct ActionParams {
|
||||||
#[arg(id = "id")]
|
#[arg(id = "id")]
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ fn gen_pwd() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct CliLoginParams {
|
pub struct CliLoginParams {
|
||||||
password: Option<PasswordType>,
|
password: Option<PasswordType>,
|
||||||
@@ -179,7 +179,7 @@ pub fn check_password_against_db(db: &DatabaseModel, password: &str) -> Result<(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct LoginParams {
|
pub struct LoginParams {
|
||||||
password: Option<PasswordType>,
|
password: Option<PasswordType>,
|
||||||
@@ -220,7 +220,7 @@ pub async fn login_impl(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct LogoutParams {
|
pub struct LogoutParams {
|
||||||
session: InternedString,
|
session: InternedString,
|
||||||
@@ -236,7 +236,7 @@ pub async fn logout(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct Session {
|
pub struct Session {
|
||||||
pub logged_in: DateTime<Utc>,
|
pub logged_in: DateTime<Utc>,
|
||||||
pub last_active: DateTime<Utc>,
|
pub last_active: DateTime<Utc>,
|
||||||
@@ -245,7 +245,7 @@ pub struct Session {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct SessionList {
|
pub struct SessionList {
|
||||||
current: InternedString,
|
current: InternedString,
|
||||||
sessions: Sessions,
|
sessions: Sessions,
|
||||||
@@ -305,7 +305,7 @@ fn display_sessions(params: WithIoFormat<ListParams>, arg: SessionList) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct ListParams {
|
pub struct ListParams {
|
||||||
#[arg(skip)]
|
#[arg(skip)]
|
||||||
@@ -340,7 +340,7 @@ impl AsLogoutSessionId for KillSessionId {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct KillParams {
|
pub struct KillParams {
|
||||||
ids: Vec<String>,
|
ids: Vec<String>,
|
||||||
@@ -353,12 +353,10 @@ pub async fn kill(ctx: RpcContext, KillParams { ids }: KillParams) -> Result<(),
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct ResetPasswordParams {
|
pub struct ResetPasswordParams {
|
||||||
#[arg(name = "old-password")]
|
|
||||||
old_password: Option<PasswordType>,
|
old_password: Option<PasswordType>,
|
||||||
#[arg(name = "new-password")]
|
|
||||||
new_password: Option<PasswordType>,
|
new_password: Option<PasswordType>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ use crate::util::serde::IoFormat;
|
|||||||
use crate::version::VersionT;
|
use crate::version::VersionT;
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct BackupParams {
|
pub struct BackupParams {
|
||||||
target_id: BackupTargetId,
|
target_id: BackupTargetId,
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ use crate::service::service_map::DownloadInstallFuture;
|
|||||||
use crate::util::serde::IoFormat;
|
use crate::util::serde::IoFormat;
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct RestorePackageParams {
|
pub struct RestorePackageParams {
|
||||||
pub ids: Vec<PackageId>,
|
pub ids: Vec<PackageId>,
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ impl Map for CifsTargets {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct CifsBackupTarget {
|
pub struct CifsBackupTarget {
|
||||||
hostname: String,
|
hostname: String,
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
@@ -68,7 +68,7 @@ pub fn cifs() -> ParentHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct AddParams {
|
pub struct AddParams {
|
||||||
pub hostname: String,
|
pub hostname: String,
|
||||||
@@ -122,7 +122,7 @@ pub async fn add(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct UpdateParams {
|
pub struct UpdateParams {
|
||||||
pub id: BackupTargetId,
|
pub id: BackupTargetId,
|
||||||
@@ -186,7 +186,7 @@ pub async fn update(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct RemoveParams {
|
pub struct RemoveParams {
|
||||||
pub id: BackupTargetId,
|
pub id: BackupTargetId,
|
||||||
|
|||||||
@@ -34,9 +34,9 @@ pub mod cifs;
|
|||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
#[serde(tag = "type")]
|
#[serde(tag = "type")]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub enum BackupTarget {
|
pub enum BackupTarget {
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
Disk {
|
Disk {
|
||||||
vendor: Option<String>,
|
vendor: Option<String>,
|
||||||
model: Option<String>,
|
model: Option<String>,
|
||||||
@@ -109,7 +109,7 @@ impl Serialize for BackupTargetId {
|
|||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
#[serde(tag = "type")]
|
#[serde(tag = "type")]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub enum BackupTargetFS {
|
pub enum BackupTargetFS {
|
||||||
Disk(BlockDev<PathBuf>),
|
Disk(BlockDev<PathBuf>),
|
||||||
Cifs(Cifs),
|
Cifs(Cifs),
|
||||||
@@ -190,7 +190,7 @@ pub async fn list(ctx: RpcContext) -> Result<BTreeMap<BackupTargetId, BackupTarg
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct BackupInfo {
|
pub struct BackupInfo {
|
||||||
pub version: Version,
|
pub version: Version,
|
||||||
pub timestamp: Option<DateTime<Utc>>,
|
pub timestamp: Option<DateTime<Utc>>,
|
||||||
@@ -198,7 +198,7 @@ pub struct BackupInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct PackageBackupInfo {
|
pub struct PackageBackupInfo {
|
||||||
pub title: String,
|
pub title: String,
|
||||||
pub version: Version,
|
pub version: Version,
|
||||||
@@ -243,7 +243,7 @@ fn display_backup_info(params: WithIoFormat<InfoParams>, info: BackupInfo) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct InfoParams {
|
pub struct InfoParams {
|
||||||
target_id: BackupTargetId,
|
target_id: BackupTargetId,
|
||||||
@@ -277,7 +277,7 @@ lazy_static::lazy_static! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct MountParams {
|
pub struct MountParams {
|
||||||
target_id: BackupTargetId,
|
target_id: BackupTargetId,
|
||||||
@@ -312,7 +312,7 @@ pub async fn mount(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct UmountParams {
|
pub struct UmountParams {
|
||||||
target_id: Option<BackupTargetId>,
|
target_id: Option<BackupTargetId>,
|
||||||
|
|||||||
@@ -9,14 +9,14 @@ use crate::prelude::*;
|
|||||||
use crate::status::health_check::HealthCheckId;
|
use crate::status::health_check::HealthCheckId;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct ConfigRes {
|
pub struct ConfigRes {
|
||||||
pub config: Option<Config>,
|
pub config: Option<Config>,
|
||||||
pub spec: ConfigSpec,
|
pub spec: ConfigSpec,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct SetResult {
|
pub struct SetResult {
|
||||||
pub depends_on: BTreeMap<PackageId, BTreeSet<HealthCheckId>>,
|
pub depends_on: BTreeMap<PackageId, BTreeSet<HealthCheckId>>,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ pub enum MatchError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct ConfigParams {
|
pub struct ConfigParams {
|
||||||
pub id: PackageId,
|
pub id: PackageId,
|
||||||
@@ -157,7 +157,7 @@ pub async fn get(ctx: RpcContext, _: Empty, id: PackageId) -> Result<ConfigRes,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct SetParams {
|
pub struct SetParams {
|
||||||
#[arg(long = "timeout")]
|
#[arg(long = "timeout")]
|
||||||
pub timeout: Option<crate::util::serde::Duration>,
|
pub timeout: Option<crate::util::serde::Duration>,
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ lazy_static::lazy_static! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Serialize, Deserialize)]
|
#[derive(Clone, Serialize, Deserialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct SetupResult {
|
pub struct SetupResult {
|
||||||
pub tor_address: String,
|
pub tor_address: String,
|
||||||
pub lan_address: String,
|
pub lan_address: String,
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ use crate::prelude::*;
|
|||||||
use crate::Error;
|
use crate::Error;
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct ControlParams {
|
pub struct ControlParams {
|
||||||
pub id: PackageId,
|
pub id: PackageId,
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ pub enum RevisionsRes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct CliDumpParams {
|
pub struct CliDumpParams {
|
||||||
#[arg(long = "include-private", short = 'p')]
|
#[arg(long = "include-private", short = 'p')]
|
||||||
@@ -216,7 +216,7 @@ async fn cli_dump(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct DumpParams {
|
pub struct DumpParams {
|
||||||
#[arg(long = "include-private", short = 'p')]
|
#[arg(long = "include-private", short = 'p')]
|
||||||
@@ -272,7 +272,7 @@ async fn cli_apply(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct ApplyParams {
|
pub struct ApplyParams {
|
||||||
expr: String,
|
expr: String,
|
||||||
@@ -310,7 +310,7 @@ pub fn put() -> ParentHandler {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct UiParams {
|
pub struct UiParams {
|
||||||
pointer: JsonPointer,
|
pointer: JsonPointer,
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ pub mod private;
|
|||||||
pub mod public;
|
pub mod public;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, HasModel)]
|
#[derive(Debug, Deserialize, Serialize, HasModel)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[model = "Model<Self>"]
|
#[model = "Model<Self>"]
|
||||||
pub struct Database {
|
pub struct Database {
|
||||||
pub public: Public,
|
pub public: Public,
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ pub enum ManifestPreference {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, HasModel)]
|
#[derive(Debug, Deserialize, Serialize, HasModel)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[serde(tag = "state")]
|
#[serde(tag = "state")]
|
||||||
#[model = "Model<Self>"]
|
#[model = "Model<Self>"]
|
||||||
pub enum PackageState {
|
pub enum PackageState {
|
||||||
@@ -257,14 +257,14 @@ impl Model<PackageState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, HasModel)]
|
#[derive(Debug, Deserialize, Serialize, HasModel)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[model = "Model<Self>"]
|
#[model = "Model<Self>"]
|
||||||
pub struct InstallingState {
|
pub struct InstallingState {
|
||||||
pub installing_info: InstallingInfo,
|
pub installing_info: InstallingInfo,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, HasModel)]
|
#[derive(Debug, Deserialize, Serialize, HasModel)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[model = "Model<Self>"]
|
#[model = "Model<Self>"]
|
||||||
pub struct UpdatingState {
|
pub struct UpdatingState {
|
||||||
pub manifest: Manifest,
|
pub manifest: Manifest,
|
||||||
@@ -272,14 +272,14 @@ pub struct UpdatingState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, HasModel)]
|
#[derive(Debug, Deserialize, Serialize, HasModel)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[model = "Model<Self>"]
|
#[model = "Model<Self>"]
|
||||||
pub struct InstalledState {
|
pub struct InstalledState {
|
||||||
pub manifest: Manifest,
|
pub manifest: Manifest,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, HasModel)]
|
#[derive(Debug, Deserialize, Serialize, HasModel)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[model = "Model<Self>"]
|
#[model = "Model<Self>"]
|
||||||
pub struct InstallingInfo {
|
pub struct InstallingInfo {
|
||||||
pub new_manifest: Manifest,
|
pub new_manifest: Manifest,
|
||||||
@@ -287,7 +287,7 @@ pub struct InstallingInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, HasModel)]
|
#[derive(Debug, Deserialize, Serialize, HasModel)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[model = "Model<Self>"]
|
#[model = "Model<Self>"]
|
||||||
pub struct PackageDataEntry {
|
pub struct PackageDataEntry {
|
||||||
pub state_info: PackageState,
|
pub state_info: PackageState,
|
||||||
@@ -405,7 +405,7 @@ impl Map for CurrentDependencies {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, HasModel)]
|
#[derive(Debug, Deserialize, Serialize, HasModel)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[model = "Model<Self>"]
|
#[model = "Model<Self>"]
|
||||||
pub struct StaticDependencyInfo {
|
pub struct StaticDependencyInfo {
|
||||||
pub title: String,
|
pub title: String,
|
||||||
@@ -413,11 +413,11 @@ pub struct StaticDependencyInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize, TS)]
|
#[derive(Clone, Debug, Deserialize, Serialize, TS)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[serde(tag = "kind")]
|
#[serde(tag = "kind")]
|
||||||
pub enum CurrentDependencyInfo {
|
pub enum CurrentDependencyInfo {
|
||||||
Exists,
|
Exists,
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
Running {
|
Running {
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
health_checks: BTreeSet<HealthCheckId>,
|
health_checks: BTreeSet<HealthCheckId>,
|
||||||
@@ -438,7 +438,7 @@ impl Map for InterfaceAddressMap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, HasModel)]
|
#[derive(Debug, Deserialize, Serialize, HasModel)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[model = "Model<Self>"]
|
#[model = "Model<Self>"]
|
||||||
pub struct InterfaceAddresses {
|
pub struct InterfaceAddresses {
|
||||||
pub tor_address: Option<String>,
|
pub tor_address: Option<String>,
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ use crate::ssh::SshKeys;
|
|||||||
use crate::util::serde::Pem;
|
use crate::util::serde::Pem;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, HasModel)]
|
#[derive(Debug, Deserialize, Serialize, HasModel)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[model = "Model<Self>"]
|
#[model = "Model<Self>"]
|
||||||
pub struct Private {
|
pub struct Private {
|
||||||
pub key_store: KeyStore,
|
pub key_store: KeyStore,
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ use crate::version::{Current, VersionT};
|
|||||||
use crate::{ARCH, PLATFORM};
|
use crate::{ARCH, PLATFORM};
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, HasModel)]
|
#[derive(Debug, Deserialize, Serialize, HasModel)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[model = "Model<Self>"]
|
#[model = "Model<Self>"]
|
||||||
// #[macro_debug]
|
// #[macro_debug]
|
||||||
pub struct Public {
|
pub struct Public {
|
||||||
@@ -102,7 +102,7 @@ fn get_platform() -> InternedString {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, HasModel)]
|
#[derive(Debug, Deserialize, Serialize, HasModel)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[model = "Model<Self>"]
|
#[model = "Model<Self>"]
|
||||||
pub struct ServerInfo {
|
pub struct ServerInfo {
|
||||||
#[serde(default = "get_arch")]
|
#[serde(default = "get_arch")]
|
||||||
@@ -137,7 +137,7 @@ pub struct ServerInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, HasModel)]
|
#[derive(Debug, Deserialize, Serialize, HasModel)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[model = "Model<Self>"]
|
#[model = "Model<Self>"]
|
||||||
pub struct IpInfo {
|
pub struct IpInfo {
|
||||||
pub ipv4_range: Option<Ipv4Net>,
|
pub ipv4_range: Option<Ipv4Net>,
|
||||||
@@ -165,7 +165,7 @@ pub struct BackupProgress {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, HasModel)]
|
#[derive(Debug, Default, Deserialize, Serialize, HasModel)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[model = "Model<Self>"]
|
#[model = "Model<Self>"]
|
||||||
pub struct ServerStatus {
|
pub struct ServerStatus {
|
||||||
pub backup_progress: Option<BTreeMap<PackageId, BackupProgress>>,
|
pub backup_progress: Option<BTreeMap<PackageId, BackupProgress>>,
|
||||||
@@ -178,7 +178,7 @@ pub struct ServerStatus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, HasModel)]
|
#[derive(Debug, Deserialize, Serialize, HasModel)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[model = "Model<Self>"]
|
#[model = "Model<Self>"]
|
||||||
pub struct UpdateProgress {
|
pub struct UpdateProgress {
|
||||||
pub size: Option<u64>,
|
pub size: Option<u64>,
|
||||||
@@ -186,7 +186,7 @@ pub struct UpdateProgress {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, HasModel)]
|
#[derive(Debug, Deserialize, Serialize, HasModel)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[model = "Model<Self>"]
|
#[model = "Model<Self>"]
|
||||||
pub struct WifiInfo {
|
pub struct WifiInfo {
|
||||||
pub ssids: Vec<String>,
|
pub ssids: Vec<String>,
|
||||||
@@ -195,7 +195,7 @@ pub struct WifiInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct ServerSpecs {
|
pub struct ServerSpecs {
|
||||||
pub cpu: String,
|
pub cpu: String,
|
||||||
pub disk: String,
|
pub disk: String,
|
||||||
@@ -203,7 +203,7 @@ pub struct ServerSpecs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct ConnectionAddresses {
|
pub struct ConnectionAddresses {
|
||||||
pub tor: Vec<String>,
|
pub tor: Vec<String>,
|
||||||
pub clearnet: Vec<String>,
|
pub clearnet: Vec<String>,
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ impl Map for Dependencies {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[serde(tag = "type")]
|
#[serde(tag = "type")]
|
||||||
pub enum DependencyRequirement {
|
pub enum DependencyRequirement {
|
||||||
OptIn { how: String },
|
OptIn { how: String },
|
||||||
@@ -50,7 +50,7 @@ impl DependencyRequirement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize, HasModel)]
|
#[derive(Clone, Debug, Deserialize, Serialize, HasModel)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[model = "Model<Self>"]
|
#[model = "Model<Self>"]
|
||||||
pub struct DepInfo {
|
pub struct DepInfo {
|
||||||
pub version: VersionRange,
|
pub version: VersionRange,
|
||||||
@@ -61,12 +61,10 @@ pub struct DepInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct ConfigureParams {
|
pub struct ConfigureParams {
|
||||||
#[arg(name = "dependent-id")]
|
|
||||||
dependent_id: PackageId,
|
dependent_id: PackageId,
|
||||||
#[arg(name = "dependency-id")]
|
|
||||||
dependency_id: PackageId,
|
dependency_id: PackageId,
|
||||||
}
|
}
|
||||||
pub fn configure() -> ParentHandler<ConfigureParams> {
|
pub fn configure() -> ParentHandler<ConfigureParams> {
|
||||||
@@ -111,7 +109,7 @@ pub async fn configure_impl(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct ConfigDryRes {
|
pub struct ConfigDryRes {
|
||||||
pub old_config: Config,
|
pub old_config: Config,
|
||||||
pub new_config: Config,
|
pub new_config: Config,
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ pub fn error(ctx: DiagnosticContext) -> Result<Arc<RpcError>, Error> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct LogsParams {
|
pub struct LogsParams {
|
||||||
limit: Option<usize>,
|
limit: Option<usize>,
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ pub const BOOT_RW_PATH: &str = "/media/boot-rw";
|
|||||||
pub const REPAIR_DISK_PATH: &str = "/media/embassy/config/repair-disk";
|
pub const REPAIR_DISK_PATH: &str = "/media/embassy/config/repair-disk";
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct OsPartitionInfo {
|
pub struct OsPartitionInfo {
|
||||||
pub efi: Option<PathBuf>,
|
pub efi: Option<PathBuf>,
|
||||||
pub bios: Option<PathBuf>,
|
pub bios: Option<PathBuf>,
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ use super::FileSystem;
|
|||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct BlockDev<LogicalName: AsRef<Path>> {
|
pub struct BlockDev<LogicalName: AsRef<Path>> {
|
||||||
logicalname: LogicalName,
|
logicalname: LogicalName,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ pub async fn mount_cifs(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct Cifs {
|
pub struct Cifs {
|
||||||
pub hostname: String,
|
pub hostname: String,
|
||||||
pub path: PathBuf,
|
pub path: PathBuf,
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ pub async fn mount_httpdirfs(url: &Url, mountpoint: impl AsRef<Path>) -> Result<
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct HttpDirFS {
|
pub struct HttpDirFS {
|
||||||
url: Url,
|
url: Url,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ use crate::prelude::*;
|
|||||||
use crate::util::Invoke;
|
use crate::util::Invoke;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct IdMapped<Fs: FileSystem> {
|
pub struct IdMapped<Fs: FileSystem> {
|
||||||
filesystem: Fs,
|
filesystem: Fs,
|
||||||
from_id: u32,
|
from_id: u32,
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use super::FileSystem;
|
|||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct LoopDev<LogicalName: AsRef<Path>> {
|
pub struct LoopDev<LogicalName: AsRef<Path>> {
|
||||||
logicalname: LogicalName,
|
logicalname: LogicalName,
|
||||||
offset: u64,
|
offset: u64,
|
||||||
|
|||||||
@@ -24,14 +24,14 @@ use crate::util::{Invoke, Version};
|
|||||||
use crate::{Error, ResultExt as _};
|
use crate::{Error, ResultExt as _};
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub enum PartitionTable {
|
pub enum PartitionTable {
|
||||||
Mbr,
|
Mbr,
|
||||||
Gpt,
|
Gpt,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct DiskInfo {
|
pub struct DiskInfo {
|
||||||
pub logicalname: PathBuf,
|
pub logicalname: PathBuf,
|
||||||
pub partition_table: Option<PartitionTable>,
|
pub partition_table: Option<PartitionTable>,
|
||||||
@@ -43,7 +43,7 @@ pub struct DiskInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct PartitionInfo {
|
pub struct PartitionInfo {
|
||||||
pub logicalname: PathBuf,
|
pub logicalname: PathBuf,
|
||||||
pub label: Option<String>,
|
pub label: Option<String>,
|
||||||
@@ -54,7 +54,7 @@ pub struct PartitionInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct EmbassyOsRecoveryInfo {
|
pub struct EmbassyOsRecoveryInfo {
|
||||||
pub version: Version,
|
pub version: Version,
|
||||||
pub full: bool,
|
pub full: bool,
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ use crate::PLATFORM;
|
|||||||
|
|
||||||
/// Part of the Firmware, look there for more about
|
/// Part of the Firmware, look there for more about
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct VersionMatcher {
|
pub struct VersionMatcher {
|
||||||
/// Strip this prefix on the version matcher
|
/// Strip this prefix on the version matcher
|
||||||
semver_prefix: Option<String>,
|
semver_prefix: Option<String>,
|
||||||
@@ -28,7 +28,7 @@ pub struct VersionMatcher {
|
|||||||
/// wanted a structure that could help decide what to do
|
/// wanted a structure that could help decide what to do
|
||||||
/// for each of the firmware versions
|
/// for each of the firmware versions
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct Firmware {
|
pub struct Firmware {
|
||||||
id: String,
|
id: String,
|
||||||
/// This is the platform(s) the firmware was built for
|
/// This is the platform(s) the firmware was built for
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ pub fn inspect() -> ParentHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct HashParams {
|
pub struct HashParams {
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
@@ -39,11 +39,11 @@ pub async fn hash(_: CliContext, HashParams { path }: HashParams) -> Result<Stri
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct ManifestParams {
|
pub struct ManifestParams {
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
#[arg(name = "no-verify", long = "no-verify")]
|
#[arg(long = "no-verify")]
|
||||||
no_verify: bool,
|
no_verify: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,11 +57,11 @@ pub async fn manifest(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct InspectParams {
|
pub struct InspectParams {
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
#[arg(name = "no-verify", long = "no-verify")]
|
#[arg(long = "no-verify")]
|
||||||
no_verify: bool,
|
no_verify: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,11 +89,11 @@ pub async fn icon(
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct InstructionParams {
|
pub struct InstructionParams {
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
#[arg(name = "no-verify", long = "no-verify")]
|
#[arg(long = "no-verify")]
|
||||||
no_verify: bool,
|
no_verify: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ pub async fn list(ctx: RpcContext) -> Result<Value, Error> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, serde::Deserialize, serde::Serialize)]
|
#[derive(Debug, Clone, Copy, serde::Deserialize, serde::Serialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub enum MinMax {
|
pub enum MinMax {
|
||||||
Min,
|
Min,
|
||||||
Max,
|
Max,
|
||||||
@@ -103,7 +103,7 @@ impl std::fmt::Display for MinMax {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct InstallParams {
|
pub struct InstallParams {
|
||||||
id: PackageId,
|
id: PackageId,
|
||||||
@@ -165,7 +165,7 @@ pub async fn install(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct SideloadResponse {
|
pub struct SideloadResponse {
|
||||||
pub upload: RequestGuid,
|
pub upload: RequestGuid,
|
||||||
pub progress: RequestGuid,
|
pub progress: RequestGuid,
|
||||||
@@ -275,7 +275,7 @@ pub async fn sideload(ctx: RpcContext) -> Result<SideloadResponse, Error> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub enum CliInstallParams {
|
pub enum CliInstallParams {
|
||||||
Marketplace(InstallParams),
|
Marketplace(InstallParams),
|
||||||
Sideload(PathBuf),
|
Sideload(PathBuf),
|
||||||
@@ -392,7 +392,7 @@ pub async fn cli_install(ctx: CliContext, params: CliInstallParams) -> Result<()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct UninstallParams {
|
pub struct UninstallParams {
|
||||||
id: PackageId,
|
id: PackageId,
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ use crate::context::CliContext;
|
|||||||
use crate::util::serde::HandlerExtSerde;
|
use crate::util::serde::HandlerExtSerde;
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct EchoParams {
|
pub struct EchoParams {
|
||||||
message: String,
|
message: String,
|
||||||
|
|||||||
@@ -102,14 +102,14 @@ async fn ws_handler(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
|
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct LogResponse {
|
pub struct LogResponse {
|
||||||
entries: Reversible<LogEntry>,
|
entries: Reversible<LogEntry>,
|
||||||
start_cursor: Option<String>,
|
start_cursor: Option<String>,
|
||||||
end_cursor: Option<String>,
|
end_cursor: Option<String>,
|
||||||
}
|
}
|
||||||
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
|
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct LogFollowResponse {
|
pub struct LogFollowResponse {
|
||||||
start_cursor: Option<String>,
|
start_cursor: Option<String>,
|
||||||
guid: RequestGuid,
|
guid: RequestGuid,
|
||||||
@@ -211,7 +211,7 @@ pub enum LogSource {
|
|||||||
pub const SYSTEM_UNIT: &str = "startd";
|
pub const SYSTEM_UNIT: &str = "startd";
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct LogsParam {
|
pub struct LogsParam {
|
||||||
id: PackageId,
|
id: PackageId,
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ use crate::prelude::*;
|
|||||||
pub const LOCAL_AUTH_COOKIE_PATH: &str = "/run/embassy/rpc.authcookie";
|
pub const LOCAL_AUTH_COOKIE_PATH: &str = "/run/embassy/rpc.authcookie";
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct LoginRes {
|
pub struct LoginRes {
|
||||||
pub session: InternedString,
|
pub session: InternedString,
|
||||||
}
|
}
|
||||||
@@ -245,7 +245,7 @@ impl Borrow<str> for HashSessionToken {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct Metadata {
|
pub struct Metadata {
|
||||||
#[serde(default = "const_true")]
|
#[serde(default = "const_true")]
|
||||||
authenticated: bool,
|
authenticated: bool,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ use serde::Deserialize;
|
|||||||
use crate::context::RpcContext;
|
use crate::context::RpcContext;
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct Metadata {
|
pub struct Metadata {
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
sync_db: bool,
|
sync_db: bool,
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ pub fn dhcp() -> ParentHandler {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct UpdateParams {
|
pub struct UpdateParams {
|
||||||
interface: String,
|
interface: String,
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ use crate::SOURCE_DATE;
|
|||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, HasModel)]
|
#[derive(Debug, Deserialize, Serialize, HasModel)]
|
||||||
#[model = "Model<Self>"]
|
#[model = "Model<Self>"]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct CertStore {
|
pub struct CertStore {
|
||||||
pub root_key: Pem<PKey<Private>>,
|
pub root_key: Pem<PKey<Private>>,
|
||||||
pub root_cert: Pem<X509>,
|
pub root_cert: Pem<X509>,
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ pub fn tor() -> ParentHandler {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct ResetParams {
|
pub struct ResetParams {
|
||||||
#[arg(name = "wipe-state", short = 'w', long = "wipe-state")]
|
#[arg(name = "wipe-state", short = 'w', long = "wipe-state")]
|
||||||
@@ -143,7 +143,7 @@ pub async fn list_services(ctx: RpcContext, _: Empty) -> Result<Vec<OnionAddress
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct LogsParams {
|
pub struct LogsParams {
|
||||||
#[arg(short = 'l', long = "limit")]
|
#[arg(short = 'l', long = "limit")]
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ pub fn country() -> ParentHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct AddParams {
|
pub struct AddParams {
|
||||||
ssid: String,
|
ssid: String,
|
||||||
@@ -139,7 +139,7 @@ pub async fn add(ctx: RpcContext, AddParams { ssid, password }: AddParams) -> Re
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct SsidParams {
|
pub struct SsidParams {
|
||||||
ssid: String,
|
ssid: String,
|
||||||
@@ -217,7 +217,7 @@ pub async fn delete(ctx: RpcContext, SsidParams { ssid }: SsidParams) -> Result<
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
#[derive(serde::Serialize, serde::Deserialize)]
|
#[derive(serde::Serialize, serde::Deserialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct WiFiInfo {
|
pub struct WiFiInfo {
|
||||||
ssids: HashMap<Ssid, SignalStrength>,
|
ssids: HashMap<Ssid, SignalStrength>,
|
||||||
connected: Option<Ssid>,
|
connected: Option<Ssid>,
|
||||||
@@ -226,13 +226,13 @@ pub struct WiFiInfo {
|
|||||||
available_wifi: Vec<WifiListOut>,
|
available_wifi: Vec<WifiListOut>,
|
||||||
}
|
}
|
||||||
#[derive(serde::Serialize, serde::Deserialize, Clone)]
|
#[derive(serde::Serialize, serde::Deserialize, Clone)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct WifiListInfo {
|
pub struct WifiListInfo {
|
||||||
strength: SignalStrength,
|
strength: SignalStrength,
|
||||||
security: Vec<String>,
|
security: Vec<String>,
|
||||||
}
|
}
|
||||||
#[derive(serde::Serialize, serde::Deserialize)]
|
#[derive(serde::Serialize, serde::Deserialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct WifiListOut {
|
pub struct WifiListOut {
|
||||||
ssid: Ssid,
|
ssid: Ssid,
|
||||||
strength: SignalStrength,
|
strength: SignalStrength,
|
||||||
@@ -403,7 +403,7 @@ pub async fn get_available(ctx: RpcContext, _: Empty) -> Result<Vec<WifiListOut>
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct SetCountryParams {
|
pub struct SetCountryParams {
|
||||||
#[arg(value_parser = CountryCodeParser)]
|
#[arg(value_parser = CountryCodeParser)]
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ pub fn notification() -> ParentHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct ListParams {
|
pub struct ListParams {
|
||||||
before: Option<u32>,
|
before: Option<u32>,
|
||||||
@@ -111,7 +111,7 @@ pub async fn list(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct DeleteParams {
|
pub struct DeleteParams {
|
||||||
id: u32,
|
id: u32,
|
||||||
@@ -126,7 +126,7 @@ pub async fn delete(ctx: RpcContext, DeleteParams { id }: DeleteParams) -> Resul
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct DeleteBeforeParams {
|
pub struct DeleteBeforeParams {
|
||||||
before: u32,
|
before: u32,
|
||||||
@@ -149,7 +149,7 @@ pub async fn delete_before(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct CreateParams {
|
pub struct CreateParams {
|
||||||
package: Option<PackageId>,
|
package: Option<PackageId>,
|
||||||
@@ -173,7 +173,7 @@ pub async fn create(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub enum NotificationLevel {
|
pub enum NotificationLevel {
|
||||||
Success,
|
Success,
|
||||||
Info,
|
Info,
|
||||||
@@ -225,7 +225,7 @@ impl fmt::Display for InvalidNotificationLevel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Serialize, Deserialize)]
|
#[derive(Debug, Default, Serialize, Deserialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct Notifications(pub BTreeMap<u32, Notification>);
|
pub struct Notifications(pub BTreeMap<u32, Notification>);
|
||||||
impl Notifications {
|
impl Notifications {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
@@ -244,7 +244,7 @@ impl Map for Notifications {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct Notification {
|
pub struct Notification {
|
||||||
package_id: Option<PackageId>,
|
package_id: Option<PackageId>,
|
||||||
created_at: DateTime<Utc>,
|
created_at: DateTime<Utc>,
|
||||||
@@ -256,7 +256,7 @@ pub struct Notification {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct NotificationWithId {
|
pub struct NotificationWithId {
|
||||||
id: u32,
|
id: u32,
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ mod gpt;
|
|||||||
mod mbr;
|
mod mbr;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct PostInstallConfig {
|
pub struct PostInstallConfig {
|
||||||
os_partitions: OsPartitionInfo,
|
os_partitions: OsPartitionInfo,
|
||||||
ethernet_interface: String,
|
ethernet_interface: String,
|
||||||
@@ -120,7 +120,7 @@ async fn partition(disk: &mut DiskInfo, overwrite: bool) -> Result<OsPartitionIn
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct ExecuteParams {
|
pub struct ExecuteParams {
|
||||||
logicalname: PathBuf,
|
logicalname: PathBuf,
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ use models::PackageId;
|
|||||||
use rpc_toolkit::command;
|
use rpc_toolkit::command;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::db::model::package::ExposedUI;
|
use crate::context::RpcContext;
|
||||||
|
use crate::db::model::package::{ExposedUI, StoreExposedUI};
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
use crate::Error;
|
use crate::Error;
|
||||||
use crate::{context::RpcContext, db::model::package::StoreExposedUI};
|
|
||||||
|
|
||||||
pub fn display_properties(response: Value) {
|
pub fn display_properties(response: Value) {
|
||||||
println!("{}", response);
|
println!("{}", response);
|
||||||
@@ -58,7 +58,7 @@ impl IntoProperties for StoreExposedUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct PropertiesParam {
|
pub struct PropertiesParam {
|
||||||
id: PackageId,
|
id: PackageId,
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ async fn do_upload(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct PublishParams {
|
pub struct PublishParams {
|
||||||
location: String,
|
location: String,
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ pub fn with_query_params(ctx: RpcContext, mut url: Url) -> Url {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct GetParams {
|
pub struct GetParams {
|
||||||
url: Url,
|
url: Url,
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ use crate::util::io::from_cbor_async_reader;
|
|||||||
use crate::{Error, ErrorKind, ARCH};
|
use crate::{Error, ErrorKind, ARCH};
|
||||||
|
|
||||||
#[derive(Default, Deserialize, Serialize)]
|
#[derive(Default, Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct DockerMultiArch {
|
pub struct DockerMultiArch {
|
||||||
pub default: String,
|
pub default: String,
|
||||||
pub available: BTreeSet<String>,
|
pub available: BTreeSet<String>,
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ fn current_version() -> Version {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize, HasModel)]
|
#[derive(Clone, Debug, Deserialize, Serialize, HasModel)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[model = "Model<Self>"]
|
#[model = "Model<Self>"]
|
||||||
pub struct Manifest {
|
pub struct Manifest {
|
||||||
#[serde(default = "current_version")]
|
#[serde(default = "current_version")]
|
||||||
@@ -53,7 +53,7 @@ pub struct Manifest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct Assets {
|
pub struct Assets {
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub license: Option<PathBuf>,
|
pub license: Option<PathBuf>,
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ pub mod reader;
|
|||||||
pub const SIG_CONTEXT: &[u8] = b"s9pk";
|
pub const SIG_CONTEXT: &[u8] = b"s9pk";
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct VerifyParams {
|
pub struct VerifyParams {
|
||||||
pub path: PathBuf,
|
pub path: PathBuf,
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ pub struct Manifest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct HardwareRequirements {
|
pub struct HardwareRequirements {
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
device: BTreeMap<String, Regex>,
|
device: BTreeMap<String, Regex>,
|
||||||
@@ -85,7 +85,7 @@ impl Description {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct Alerts {
|
pub struct Alerts {
|
||||||
pub install: Option<String>,
|
pub install: Option<String>,
|
||||||
pub uninstall: Option<String>,
|
pub uninstall: Option<String>,
|
||||||
|
|||||||
@@ -257,7 +257,7 @@ struct RemoveAddressParams {
|
|||||||
#[ts(export)]
|
#[ts(export)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "kebab-case")]
|
||||||
enum AllowedStatuses {
|
enum AllowedStatuses {
|
||||||
OnlyRunning,
|
OnlyRunning, // onlyRunning
|
||||||
OnlyStopped,
|
OnlyStopped,
|
||||||
Any,
|
Any,
|
||||||
}
|
}
|
||||||
@@ -1090,20 +1090,19 @@ enum DependencyKind {
|
|||||||
#[serde(rename_all = "camelCase", tag = "kind")]
|
#[serde(rename_all = "camelCase", tag = "kind")]
|
||||||
#[ts(export)]
|
#[ts(export)]
|
||||||
enum DependencyRequirement {
|
enum DependencyRequirement {
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
Running {
|
Running {
|
||||||
#[ts(type = "string")]
|
#[ts(type = "string")]
|
||||||
id: PackageId,
|
id: PackageId,
|
||||||
#[ts(type = "string[]")]
|
#[ts(type = "string[]")]
|
||||||
#[serde(rename = "healthChecks")]
|
|
||||||
health_checks: BTreeSet<HealthCheckId>,
|
health_checks: BTreeSet<HealthCheckId>,
|
||||||
#[serde(rename = "versionSpec")]
|
|
||||||
version_spec: String,
|
version_spec: String,
|
||||||
url: String,
|
url: String,
|
||||||
},
|
},
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
Exists {
|
Exists {
|
||||||
#[ts(type = "string")]
|
#[ts(type = "string")]
|
||||||
id: PackageId,
|
id: PackageId,
|
||||||
#[serde(rename = "versionSpec")]
|
|
||||||
version_spec: String,
|
version_spec: String,
|
||||||
url: String,
|
url: String,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ async fn setup_init(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct AttachParams {
|
pub struct AttachParams {
|
||||||
#[serde(rename = "embassy-password")]
|
#[serde(rename = "embassy-password")]
|
||||||
password: Option<EncryptedWire>,
|
password: Option<EncryptedWire>,
|
||||||
@@ -185,7 +185,7 @@ pub async fn attach(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct SetupStatus {
|
pub struct SetupStatus {
|
||||||
pub bytes_transferred: u64,
|
pub bytes_transferred: u64,
|
||||||
pub total_bytes: Option<u64>,
|
pub total_bytes: Option<u64>,
|
||||||
@@ -211,7 +211,7 @@ pub fn cifs() -> ParentHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct VerifyCifsParams {
|
pub struct VerifyCifsParams {
|
||||||
hostname: String,
|
hostname: String,
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
@@ -247,14 +247,14 @@ pub async fn verify_cifs(
|
|||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
#[serde(tag = "type")]
|
#[serde(tag = "type")]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub enum RecoverySource {
|
pub enum RecoverySource {
|
||||||
Migrate { guid: String },
|
Migrate { guid: String },
|
||||||
Backup { target: BackupTargetFS },
|
Backup { target: BackupTargetFS },
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct ExecuteParams {
|
pub struct ExecuteParams {
|
||||||
embassy_logicalname: PathBuf,
|
embassy_logicalname: PathBuf,
|
||||||
embassy_password: EncryptedWire,
|
embassy_password: EncryptedWire,
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ impl ValueParserFactory for SshPubKey {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(serde::Serialize, serde::Deserialize)]
|
#[derive(serde::Serialize, serde::Deserialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct SshKeyResponse {
|
pub struct SshKeyResponse {
|
||||||
pub alg: String,
|
pub alg: String,
|
||||||
pub fingerprint: InternedString,
|
pub fingerprint: InternedString,
|
||||||
@@ -103,7 +103,7 @@ pub fn ssh() -> ParentHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct AddParams {
|
pub struct AddParams {
|
||||||
key: SshPubKey,
|
key: SshPubKey,
|
||||||
@@ -136,7 +136,7 @@ pub async fn add(ctx: RpcContext, AddParams { key }: AddParams) -> Result<SshKey
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct DeleteParams {
|
pub struct DeleteParams {
|
||||||
fingerprint: InternedString,
|
fingerprint: InternedString,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ pub use models::HealthCheckId;
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
|
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[serde(tag = "result")]
|
#[serde(tag = "result")]
|
||||||
pub enum HealthCheckResult {
|
pub enum HealthCheckResult {
|
||||||
Success,
|
Success,
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ use crate::status::health_check::HealthCheckResult;
|
|||||||
|
|
||||||
pub mod health_check;
|
pub mod health_check;
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize, HasModel)]
|
#[derive(Clone, Debug, Deserialize, Serialize, HasModel)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[model = "Model<Self>"]
|
#[model = "Model<Self>"]
|
||||||
pub struct Status {
|
pub struct Status {
|
||||||
pub configured: bool,
|
pub configured: bool,
|
||||||
@@ -21,7 +21,7 @@ pub struct Status {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize, HasModel, Default)]
|
#[derive(Clone, Debug, Deserialize, Serialize, HasModel, Default)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[model = "Model<Self>"]
|
#[model = "Model<Self>"]
|
||||||
pub struct DependencyConfigErrors(pub BTreeMap<PackageId, String>);
|
pub struct DependencyConfigErrors(pub BTreeMap<PackageId, String>);
|
||||||
impl Map for DependencyConfigErrors {
|
impl Map for DependencyConfigErrors {
|
||||||
@@ -37,7 +37,7 @@ impl Map for DependencyConfigErrors {
|
|||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)]
|
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)]
|
||||||
#[serde(tag = "status")]
|
#[serde(tag = "status")]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub enum MainStatus {
|
pub enum MainStatus {
|
||||||
Stopped,
|
Stopped,
|
||||||
Restarting,
|
Restarting,
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ pub async fn enable_zram() -> Result<(), Error> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct ZramParams {
|
pub struct ZramParams {
|
||||||
enable: bool,
|
enable: bool,
|
||||||
@@ -136,7 +136,7 @@ fn display_governor_info(params: WithIoFormat<GovernorParams>, result: GovernorI
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct GovernorParams {
|
pub struct GovernorParams {
|
||||||
set: Option<Governor>,
|
set: Option<Governor>,
|
||||||
@@ -230,7 +230,7 @@ pub async fn time(ctx: RpcContext, _: Empty) -> Result<TimeInfo, Error> {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct LogsParams {
|
pub struct LogsParams {
|
||||||
#[arg(short = 'l', long = "limit")]
|
#[arg(short = 'l', long = "limit")]
|
||||||
@@ -314,7 +314,7 @@ pub async fn logs_follow(
|
|||||||
follow_logs(ctx, LogSource::System, limit).await
|
follow_logs(ctx, LogSource::System, limit).await
|
||||||
}
|
}
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct KernelLogsParams {
|
pub struct KernelLogsParams {
|
||||||
#[arg(short = 'l', long = "limit")]
|
#[arg(short = 'l', long = "limit")]
|
||||||
@@ -509,12 +509,12 @@ impl<'de> Deserialize<'de> for GigaBytes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Clone, Debug)]
|
#[derive(Deserialize, Serialize, Clone, Debug)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct MetricsGeneral {
|
pub struct MetricsGeneral {
|
||||||
pub temperature: Option<Celsius>,
|
pub temperature: Option<Celsius>,
|
||||||
}
|
}
|
||||||
#[derive(Deserialize, Serialize, Clone, Debug)]
|
#[derive(Deserialize, Serialize, Clone, Debug)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct MetricsMemory {
|
pub struct MetricsMemory {
|
||||||
pub percentage_used: Percentage,
|
pub percentage_used: Percentage,
|
||||||
pub total: MebiBytes,
|
pub total: MebiBytes,
|
||||||
@@ -525,7 +525,7 @@ pub struct MetricsMemory {
|
|||||||
pub zram_used: MebiBytes,
|
pub zram_used: MebiBytes,
|
||||||
}
|
}
|
||||||
#[derive(Deserialize, Serialize, Clone, Debug)]
|
#[derive(Deserialize, Serialize, Clone, Debug)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct MetricsCpu {
|
pub struct MetricsCpu {
|
||||||
percentage_used: Percentage,
|
percentage_used: Percentage,
|
||||||
idle: Percentage,
|
idle: Percentage,
|
||||||
@@ -534,7 +534,7 @@ pub struct MetricsCpu {
|
|||||||
wait: Percentage,
|
wait: Percentage,
|
||||||
}
|
}
|
||||||
#[derive(Deserialize, Serialize, Clone, Debug)]
|
#[derive(Deserialize, Serialize, Clone, Debug)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct MetricsDisk {
|
pub struct MetricsDisk {
|
||||||
percentage_used: Percentage,
|
percentage_used: Percentage,
|
||||||
used: GigaBytes,
|
used: GigaBytes,
|
||||||
@@ -542,7 +542,7 @@ pub struct MetricsDisk {
|
|||||||
capacity: GigaBytes,
|
capacity: GigaBytes,
|
||||||
}
|
}
|
||||||
#[derive(Deserialize, Serialize, Clone, Debug)]
|
#[derive(Deserialize, Serialize, Clone, Debug)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct Metrics {
|
pub struct Metrics {
|
||||||
general: MetricsGeneral,
|
general: MetricsGeneral,
|
||||||
memory: MetricsMemory,
|
memory: MetricsMemory,
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ lazy_static! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Parser)]
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct UpdateSystemParams {
|
pub struct UpdateSystemParams {
|
||||||
marketplace_url: Url,
|
marketplace_url: Url,
|
||||||
@@ -60,7 +60,7 @@ pub async fn update_system(
|
|||||||
|
|
||||||
/// What is the status of the updates?
|
/// What is the status of the updates?
|
||||||
#[derive(serde::Serialize, serde::Deserialize, Clone, Debug)]
|
#[derive(serde::Serialize, serde::Deserialize, Clone, Debug)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub enum UpdateResult {
|
pub enum UpdateResult {
|
||||||
NoUpdates,
|
NoUpdates,
|
||||||
Updating,
|
Updating,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ const KNOWN_CLASSES: &[&str] = &["processor", "display"];
|
|||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
#[serde(tag = "class")]
|
#[serde(tag = "class")]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub enum LshwDevice {
|
pub enum LshwDevice {
|
||||||
Processor(LshwProcessor),
|
Processor(LshwProcessor),
|
||||||
Display(LshwDisplay),
|
Display(LshwDisplay),
|
||||||
|
|||||||
@@ -111,25 +111,25 @@ pub fn cert_dir(pkg_id: &PackageId, host_id: &HostId) -> PathBuf {
|
|||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
#[serde(tag = "type")]
|
#[serde(tag = "type")]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub enum Volume {
|
pub enum Volume {
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
Data {
|
Data {
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
readonly: bool,
|
readonly: bool,
|
||||||
},
|
},
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
Assets {},
|
Assets {},
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
Pointer {
|
Pointer {
|
||||||
package_id: PackageId,
|
package_id: PackageId,
|
||||||
volume_id: VolumeId,
|
volume_id: VolumeId,
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
readonly: bool,
|
readonly: bool,
|
||||||
},
|
},
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
Certificate { interface_id: HostId },
|
Certificate { interface_id: HostId },
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "camelCase")]
|
||||||
Backup { readonly: bool },
|
Backup { readonly: bool },
|
||||||
}
|
}
|
||||||
impl Volume {
|
impl Volume {
|
||||||
|
|||||||
@@ -21,8 +21,6 @@ import {
|
|||||||
MaybePromise,
|
MaybePromise,
|
||||||
ServiceInterfaceId,
|
ServiceInterfaceId,
|
||||||
PackageId,
|
PackageId,
|
||||||
EnsureStorePath,
|
|
||||||
ExtractStore,
|
|
||||||
ValidIfNoStupidEscape,
|
ValidIfNoStupidEscape,
|
||||||
} from "./types"
|
} from "./types"
|
||||||
import * as patterns from "./util/patterns"
|
import * as patterns from "./util/patterns"
|
||||||
@@ -60,7 +58,6 @@ import {
|
|||||||
setupInterfaces,
|
setupInterfaces,
|
||||||
} from "./interfaces/setupInterfaces"
|
} from "./interfaces/setupInterfaces"
|
||||||
import { successFailure } from "./trigger/successFailure"
|
import { successFailure } from "./trigger/successFailure"
|
||||||
import { SetupExports } from "./inits/setupExports"
|
|
||||||
import { HealthReceipt } from "./health/HealthReceipt"
|
import { HealthReceipt } from "./health/HealthReceipt"
|
||||||
import { MultiHost, Scheme, SingleHost, StaticHost } from "./interfaces/Host"
|
import { MultiHost, Scheme, SingleHost, StaticHost } from "./interfaces/Host"
|
||||||
import { ServiceInterfaceBuilder } from "./interfaces/ServiceInterfaceBuilder"
|
import { ServiceInterfaceBuilder } from "./interfaces/ServiceInterfaceBuilder"
|
||||||
@@ -78,6 +75,8 @@ import { Mounts } from "./mainFn/Mounts"
|
|||||||
import { Dependency } from "./Dependency"
|
import { Dependency } from "./Dependency"
|
||||||
import * as T from "./types"
|
import * as T from "./types"
|
||||||
import { Checker, EmVer } from "./emverLite/mod"
|
import { Checker, EmVer } from "./emverLite/mod"
|
||||||
|
import { ExposedStorePaths } from "./store/setupExposeStore"
|
||||||
|
import { PathBuilder, extractJsonPath, pathBuilder } from "./store/PathBuilder"
|
||||||
|
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
type AnyNeverCond<T extends any[], Then, Else> =
|
type AnyNeverCond<T extends any[], Then, Else> =
|
||||||
@@ -150,25 +149,29 @@ export class StartSdk<Manifest extends SDKManifest, Store> {
|
|||||||
},
|
},
|
||||||
|
|
||||||
store: {
|
store: {
|
||||||
get: <E extends Effects, Path extends string = never>(
|
get: <E extends Effects, StoreValue = unknown>(
|
||||||
effects: E,
|
effects: E,
|
||||||
packageId: string,
|
packageId: string,
|
||||||
path: EnsureStorePath<Store, Path>,
|
path: PathBuilder<Store, StoreValue>,
|
||||||
) =>
|
) =>
|
||||||
removeConstType<E>()(
|
removeConstType<E>()(
|
||||||
getStore<Store, Path>(effects, path as any, {
|
getStore<Store, StoreValue>(effects, path, {
|
||||||
packageId,
|
packageId,
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
getOwn: <E extends Effects, Path extends string>(
|
getOwn: <E extends Effects, StoreValue = unknown>(
|
||||||
effects: E,
|
effects: E,
|
||||||
path: EnsureStorePath<Store, Path>,
|
path: PathBuilder<Store, StoreValue>,
|
||||||
) => removeConstType<E>()(getStore<Store, Path>(effects, path as any)),
|
) => removeConstType<E>()(getStore<Store, StoreValue>(effects, path)),
|
||||||
setOwn: <E extends Effects, Path extends string | never>(
|
setOwn: <E extends Effects, Path extends PathBuilder<Store, unknown>>(
|
||||||
effects: E,
|
effects: E,
|
||||||
path: EnsureStorePath<Store, Path>,
|
path: Path,
|
||||||
value: ExtractStore<Store, Path>,
|
value: Path extends PathBuilder<Store, infer Value> ? Value : never,
|
||||||
) => effects.store.set<Store, Path>({ value, path: path as any }),
|
) =>
|
||||||
|
effects.store.set<Store>({
|
||||||
|
value,
|
||||||
|
path: extractJsonPath(path),
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
|
|
||||||
host: {
|
host: {
|
||||||
@@ -179,7 +182,41 @@ export class StartSdk<Manifest extends SDKManifest, Store> {
|
|||||||
multi: (effects: Effects, id: string) => new MultiHost({ id, effects }),
|
multi: (effects: Effects, id: string) => new MultiHost({ id, effects }),
|
||||||
},
|
},
|
||||||
nullIfEmpty,
|
nullIfEmpty,
|
||||||
|
runCommand: async <A extends string>(
|
||||||
|
effects: Effects,
|
||||||
|
imageId: Manifest["images"][number],
|
||||||
|
command: ValidIfNoStupidEscape<A> | [string, ...string[]],
|
||||||
|
options: CommandOptions & {
|
||||||
|
mounts?: { path: string; options: MountOptions }[]
|
||||||
|
},
|
||||||
|
): Promise<{ stdout: string | Buffer; stderr: string | Buffer }> => {
|
||||||
|
return runCommand<Manifest>(effects, imageId, command, options)
|
||||||
|
},
|
||||||
|
|
||||||
|
createAction: <
|
||||||
|
ConfigType extends
|
||||||
|
| Record<string, any>
|
||||||
|
| Config<any, any>
|
||||||
|
| Config<any, never>,
|
||||||
|
Type extends Record<string, any> = ExtractConfigType<ConfigType>,
|
||||||
|
>(
|
||||||
|
id: string,
|
||||||
|
metaData: Omit<ActionMetadata, "input"> & {
|
||||||
|
input: Config<Type, Store> | Config<Type, never>
|
||||||
|
},
|
||||||
|
fn: (options: {
|
||||||
|
effects: Effects
|
||||||
|
input: Type
|
||||||
|
}) => Promise<ActionResult>,
|
||||||
|
) => {
|
||||||
|
const { input, ...rest } = metaData
|
||||||
|
return createAction<Manifest, Store, ConfigType, Type>(
|
||||||
|
id,
|
||||||
|
rest,
|
||||||
|
fn,
|
||||||
|
input,
|
||||||
|
)
|
||||||
|
},
|
||||||
configConstants: { smtpConfig },
|
configConstants: { smtpConfig },
|
||||||
createInterface: (
|
createInterface: (
|
||||||
effects: Effects,
|
effects: Effects,
|
||||||
@@ -197,42 +234,8 @@ export class StartSdk<Manifest extends SDKManifest, Store> {
|
|||||||
masked: boolean
|
masked: boolean
|
||||||
},
|
},
|
||||||
) => new ServiceInterfaceBuilder({ ...options, effects }),
|
) => new ServiceInterfaceBuilder({ ...options, effects }),
|
||||||
createAction: <
|
|
||||||
ConfigType extends
|
|
||||||
| Record<string, any>
|
|
||||||
| Config<any, any>
|
|
||||||
| Config<any, never>,
|
|
||||||
Type extends Record<string, any> = ExtractConfigType<ConfigType>,
|
|
||||||
>(
|
|
||||||
id: string,
|
|
||||||
metadata: Omit<ActionMetadata, "input"> & {
|
|
||||||
input: Config<Type, Store> | Config<Type, never>
|
|
||||||
},
|
|
||||||
fn: (options: {
|
|
||||||
effects: Effects
|
|
||||||
input: Type
|
|
||||||
}) => Promise<ActionResult>,
|
|
||||||
) => {
|
|
||||||
const { input, ...rest } = metadata
|
|
||||||
return createAction<Manifest, Store, ConfigType, Type>(
|
|
||||||
id,
|
|
||||||
rest,
|
|
||||||
fn,
|
|
||||||
input,
|
|
||||||
)
|
|
||||||
},
|
|
||||||
getSystemSmtp: <E extends Effects>(effects: E) =>
|
getSystemSmtp: <E extends Effects>(effects: E) =>
|
||||||
removeConstType<E>()(new GetSystemSmtp(effects)),
|
removeConstType<E>()(new GetSystemSmtp(effects)),
|
||||||
runCommand: async <A extends string>(
|
|
||||||
effects: Effects,
|
|
||||||
imageId: Manifest["images"][number],
|
|
||||||
command: ValidIfNoStupidEscape<A> | [string, ...string[]],
|
|
||||||
options: CommandOptions & {
|
|
||||||
mounts?: { path: string; options: MountOptions }[]
|
|
||||||
},
|
|
||||||
): Promise<{ stdout: string | Buffer; stderr: string | Buffer }> => {
|
|
||||||
return runCommand<Manifest>(effects, imageId, command, options)
|
|
||||||
},
|
|
||||||
|
|
||||||
createDynamicAction: <
|
createDynamicAction: <
|
||||||
ConfigType extends
|
ConfigType extends
|
||||||
@@ -242,7 +245,7 @@ export class StartSdk<Manifest extends SDKManifest, Store> {
|
|||||||
Type extends Record<string, any> = ExtractConfigType<ConfigType>,
|
Type extends Record<string, any> = ExtractConfigType<ConfigType>,
|
||||||
>(
|
>(
|
||||||
id: string,
|
id: string,
|
||||||
metadata: (options: {
|
metaData: (options: {
|
||||||
effects: Effects
|
effects: Effects
|
||||||
}) => MaybePromise<Omit<ActionMetadata, "input">>,
|
}) => MaybePromise<Omit<ActionMetadata, "input">>,
|
||||||
fn: (options: {
|
fn: (options: {
|
||||||
@@ -253,7 +256,7 @@ export class StartSdk<Manifest extends SDKManifest, Store> {
|
|||||||
) => {
|
) => {
|
||||||
return createAction<Manifest, Store, ConfigType, Type>(
|
return createAction<Manifest, Store, ConfigType, Type>(
|
||||||
id,
|
id,
|
||||||
metadata,
|
metaData,
|
||||||
fn,
|
fn,
|
||||||
input,
|
input,
|
||||||
)
|
)
|
||||||
@@ -343,7 +346,6 @@ export class StartSdk<Manifest extends SDKManifest, Store> {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setupExports: (fn: SetupExports<Store>) => fn,
|
|
||||||
setupInit: (
|
setupInit: (
|
||||||
migrations: Migrations<Manifest, Store>,
|
migrations: Migrations<Manifest, Store>,
|
||||||
install: Install<Manifest, Store>,
|
install: Install<Manifest, Store>,
|
||||||
@@ -353,15 +355,15 @@ export class StartSdk<Manifest extends SDKManifest, Store> {
|
|||||||
effects: Effects
|
effects: Effects
|
||||||
input: any
|
input: any
|
||||||
}) => Promise<DependenciesReceipt>,
|
}) => Promise<DependenciesReceipt>,
|
||||||
setupExports: SetupExports<Store>,
|
exposedStore: ExposedStorePaths,
|
||||||
) =>
|
) =>
|
||||||
setupInit<Manifest, Store>(
|
setupInit<Manifest, Store>(
|
||||||
migrations,
|
migrations,
|
||||||
install,
|
install,
|
||||||
uninstall,
|
uninstall,
|
||||||
setInterfaces,
|
setInterfaces,
|
||||||
setupExports,
|
|
||||||
setDependencies,
|
setDependencies,
|
||||||
|
exposedStore,
|
||||||
),
|
),
|
||||||
setupInstall: (fn: InstallFn<Manifest, Store>) => Install.of(fn),
|
setupInstall: (fn: InstallFn<Manifest, Store>) => Install.of(fn),
|
||||||
setupInterfaces: <
|
setupInterfaces: <
|
||||||
@@ -386,6 +388,12 @@ export class StartSdk<Manifest extends SDKManifest, Store> {
|
|||||||
this.manifest,
|
this.manifest,
|
||||||
...migrations,
|
...migrations,
|
||||||
),
|
),
|
||||||
|
setupProperties:
|
||||||
|
(
|
||||||
|
fn: (options: { effects: Effects }) => Promise<T.SdkPropertiesReturn>,
|
||||||
|
): T.ExpectedExports.Properties =>
|
||||||
|
(options) =>
|
||||||
|
fn(options).then(nullifyProperties),
|
||||||
setupUninstall: (fn: UninstallFn<Manifest, Store>) =>
|
setupUninstall: (fn: UninstallFn<Manifest, Store>) =>
|
||||||
setupUninstall<Manifest, Store>(fn),
|
setupUninstall<Manifest, Store>(fn),
|
||||||
trigger: {
|
trigger: {
|
||||||
@@ -538,6 +546,7 @@ export class StartSdk<Manifest extends SDKManifest, Store> {
|
|||||||
down: (opts: { effects: Effects }) => Promise<void>
|
down: (opts: { effects: Effects }) => Promise<void>
|
||||||
}) => Migration.of<Manifest, Store, Version>(options),
|
}) => Migration.of<Manifest, Store, Version>(options),
|
||||||
},
|
},
|
||||||
|
StorePath: pathBuilder<Store>(),
|
||||||
Value: {
|
Value: {
|
||||||
toggle: Value.toggle,
|
toggle: Value.toggle,
|
||||||
text: Value.text,
|
text: Value.text,
|
||||||
@@ -746,3 +755,20 @@ export async function runCommand<Manifest extends SDKManifest>(
|
|||||||
await overlay.destroy()
|
await overlay.destroy()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function nullifyProperties(value: T.SdkPropertiesReturn): T.PropertiesReturn {
|
||||||
|
return Object.fromEntries(
|
||||||
|
Object.entries(value).map(([k, v]) => [k, nullifyProperties_(v)]),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
function nullifyProperties_(value: T.SdkPropertiesValue): T.PropertiesValue {
|
||||||
|
if (value.type === "string") {
|
||||||
|
return { description: null, copyable: null, qr: null, ...value }
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
description: null,
|
||||||
|
...value,
|
||||||
|
value: Object.fromEntries(
|
||||||
|
Object.entries(value.value).map(([k, v]) => [k, nullifyProperties_(v)]),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import "./config"
|
import { Config } from "./config"
|
||||||
import "./list"
|
import { List } from "./list"
|
||||||
import "./value"
|
import { Value } from "./value"
|
||||||
import "./variants"
|
import { Variants } from "./variants"
|
||||||
|
|
||||||
|
export { Config, List, Value, Variants }
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import {
|
|||||||
UniqueBy,
|
UniqueBy,
|
||||||
ValueSpecList,
|
ValueSpecList,
|
||||||
ValueSpecListOf,
|
ValueSpecListOf,
|
||||||
ValueSpecText,
|
|
||||||
} from "../configTypes"
|
} from "../configTypes"
|
||||||
import { Parser, arrayOf, number, string } from "ts-matches"
|
import { Parser, arrayOf, number, string } from "ts-matches"
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import "./builder"
|
export * as constants from "./configConstants"
|
||||||
|
export * as types from "./configTypes"
|
||||||
import "./setupConfig"
|
export * as builder from "./builder"
|
||||||
import "./configDependencies"
|
|
||||||
import "./configConstants"
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import { SDKManifest } from "../manifest/ManifestTypes"
|
|||||||
import * as D from "./configDependencies"
|
import * as D from "./configDependencies"
|
||||||
import { Config, ExtractConfigType } from "./builder/config"
|
import { Config, ExtractConfigType } from "./builder/config"
|
||||||
import nullIfEmpty from "../util/nullIfEmpty"
|
import nullIfEmpty from "../util/nullIfEmpty"
|
||||||
import { InterfaceReceipt } from "../interfaces/interfaceReceipt"
|
|
||||||
import { InterfacesReceipt as InterfacesReceipt } from "../interfaces/setupInterfaces"
|
import { InterfacesReceipt as InterfacesReceipt } from "../interfaces/setupInterfaces"
|
||||||
|
|
||||||
declare const dependencyProof: unique symbol
|
declare const dependencyProof: unique symbol
|
||||||
|
|||||||
@@ -4,11 +4,12 @@ export { Overlay } from "./util/Overlay"
|
|||||||
export { StartSdk } from "./StartSdk"
|
export { StartSdk } from "./StartSdk"
|
||||||
export { setupManifest } from "./manifest/setupManifest"
|
export { setupManifest } from "./manifest/setupManifest"
|
||||||
export { FileHelper } from "./util/fileHelper"
|
export { FileHelper } from "./util/fileHelper"
|
||||||
|
export { setupExposeStore } from "./store/setupExposeStore"
|
||||||
export * as actions from "./actions"
|
export * as actions from "./actions"
|
||||||
export * as backup from "./backup"
|
export * as backup from "./backup"
|
||||||
export * as config from "./config"
|
export * as config from "./config"
|
||||||
export * as configBuilder from "./config/builder"
|
export * as CB from "./config/builder"
|
||||||
export * as configTypes from "./config/configTypes"
|
export * as CT from "./config/configTypes"
|
||||||
export * as dependencyConfig from "./dependencyConfig"
|
export * as dependencyConfig from "./dependencyConfig"
|
||||||
export * as daemons from "./mainFn/Daemons"
|
export * as daemons from "./mainFn/Daemons"
|
||||||
export * as health from "./health"
|
export * as health from "./health"
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
import { Effects, ExposeServicePaths, ExposeUiPaths } from "../types"
|
|
||||||
|
|
||||||
export type SetupExports<Store> = (opts: { effects: Effects }) =>
|
|
||||||
| {
|
|
||||||
ui: { [k: string]: ExposeUiPaths<Store> }
|
|
||||||
services: ExposeServicePaths<Store>["paths"]
|
|
||||||
}
|
|
||||||
| Promise<{
|
|
||||||
ui: { [k: string]: ExposeUiPaths<Store> }
|
|
||||||
services: ExposeServicePaths<Store>["paths"]
|
|
||||||
}>
|
|
||||||
|
|
||||||
export const setupExports = <Store>(fn: (opts: SetupExports<Store>) => void) =>
|
|
||||||
fn
|
|
||||||
@@ -1,14 +1,9 @@
|
|||||||
import { DependenciesReceipt } from "../config/setupConfig"
|
import { DependenciesReceipt } from "../config/setupConfig"
|
||||||
import { SetInterfaces } from "../interfaces/setupInterfaces"
|
import { SetInterfaces } from "../interfaces/setupInterfaces"
|
||||||
import { SDKManifest } from "../manifest/ManifestTypes"
|
import { SDKManifest } from "../manifest/ManifestTypes"
|
||||||
import {
|
import { ExposedStorePaths } from "../store/setupExposeStore"
|
||||||
Effects,
|
import { Effects, ExpectedExports } from "../types"
|
||||||
ExpectedExports,
|
|
||||||
ExposeUiPaths,
|
|
||||||
ExposeUiPathsAll,
|
|
||||||
} from "../types"
|
|
||||||
import { Migrations } from "./migrations/setupMigrations"
|
import { Migrations } from "./migrations/setupMigrations"
|
||||||
import { SetupExports } from "./setupExports"
|
|
||||||
import { Install } from "./setupInstall"
|
import { Install } from "./setupInstall"
|
||||||
import { Uninstall } from "./setupUninstall"
|
import { Uninstall } from "./setupUninstall"
|
||||||
|
|
||||||
@@ -17,11 +12,11 @@ export function setupInit<Manifest extends SDKManifest, Store>(
|
|||||||
install: Install<Manifest, Store>,
|
install: Install<Manifest, Store>,
|
||||||
uninstall: Uninstall<Manifest, Store>,
|
uninstall: Uninstall<Manifest, Store>,
|
||||||
setInterfaces: SetInterfaces<Manifest, Store, any, any>,
|
setInterfaces: SetInterfaces<Manifest, Store, any, any>,
|
||||||
setupExports: SetupExports<Store>,
|
|
||||||
setDependencies: (options: {
|
setDependencies: (options: {
|
||||||
effects: Effects
|
effects: Effects
|
||||||
input: any
|
input: any
|
||||||
}) => Promise<DependenciesReceipt>,
|
}) => Promise<DependenciesReceipt>,
|
||||||
|
exposedStore: ExposedStorePaths,
|
||||||
): {
|
): {
|
||||||
init: ExpectedExports.init
|
init: ExpectedExports.init
|
||||||
uninit: ExpectedExports.uninit
|
uninit: ExpectedExports.uninit
|
||||||
@@ -34,9 +29,7 @@ export function setupInit<Manifest extends SDKManifest, Store>(
|
|||||||
...opts,
|
...opts,
|
||||||
input: null,
|
input: null,
|
||||||
})
|
})
|
||||||
const { services, ui } = await setupExports(opts)
|
await opts.effects.exposeForDependents({ paths: exposedStore })
|
||||||
await opts.effects.exposeForDependents({ paths: services })
|
|
||||||
await opts.effects.exposeUi(forExpose(ui))
|
|
||||||
await setDependencies({ effects: opts.effects, input: null })
|
await setDependencies({ effects: opts.effects, input: null })
|
||||||
},
|
},
|
||||||
uninit: async (opts) => {
|
uninit: async (opts) => {
|
||||||
@@ -45,30 +38,3 @@ export function setupInit<Manifest extends SDKManifest, Store>(
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function forExpose<Store>(ui: { [key: string]: ExposeUiPaths<Store> }) {
|
|
||||||
return Object.fromEntries(
|
|
||||||
Object.entries(ui).map(([key, value]) => [key, forExpose_(value)]),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
function forExpose_<Store>(ui: ExposeUiPaths<Store>): ExposeUiPathsAll {
|
|
||||||
if (ui.type === ("object" as const)) {
|
|
||||||
return {
|
|
||||||
type: "object" as const,
|
|
||||||
value: Object.fromEntries(
|
|
||||||
Object.entries(ui.value).map(([key, value]) => [
|
|
||||||
key,
|
|
||||||
forExpose_(value),
|
|
||||||
]),
|
|
||||||
),
|
|
||||||
description: ui.description ?? null,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
description: null,
|
|
||||||
|
|
||||||
copyable: null,
|
|
||||||
qr: null,
|
|
||||||
...ui,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
38
sdk/lib/store/PathBuilder.ts
Normal file
38
sdk/lib/store/PathBuilder.ts
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
import { Affine } from "../util"
|
||||||
|
|
||||||
|
const pathValue = Symbol("pathValue")
|
||||||
|
export type PathValue = typeof pathValue
|
||||||
|
|
||||||
|
export type PathBuilderStored<AllStore, Store> = {
|
||||||
|
[K in PathValue]: [AllStore, Store]
|
||||||
|
}
|
||||||
|
|
||||||
|
export type PathBuilder<AllStore, Store = AllStore> = (Store extends Record<
|
||||||
|
string,
|
||||||
|
unknown
|
||||||
|
>
|
||||||
|
? {
|
||||||
|
[K in keyof Store]: PathBuilder<AllStore, Store[K]>
|
||||||
|
}
|
||||||
|
: {}) &
|
||||||
|
PathBuilderStored<AllStore, Store>
|
||||||
|
|
||||||
|
export type StorePath = string & Affine<"StorePath">
|
||||||
|
const privateSymbol = Symbol("jsonPath")
|
||||||
|
export const extractJsonPath = (builder: PathBuilder<unknown>) => {
|
||||||
|
return (builder as any)[privateSymbol] as StorePath
|
||||||
|
}
|
||||||
|
|
||||||
|
export const pathBuilder = <Store, StorePath = Store>(
|
||||||
|
paths: string[] = [],
|
||||||
|
): PathBuilder<Store, StorePath> => {
|
||||||
|
return new Proxy({} as PathBuilder<Store, StorePath>, {
|
||||||
|
get(target, prop) {
|
||||||
|
if (prop === privateSymbol) {
|
||||||
|
if (paths.length === 0) return ""
|
||||||
|
return `/${paths.join("/")}`
|
||||||
|
}
|
||||||
|
return pathBuilder<any>([...paths, prop as string])
|
||||||
|
},
|
||||||
|
}) as PathBuilder<Store, StorePath>
|
||||||
|
}
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
import { Effects, EnsureStorePath } from "../types"
|
import { Effects } from "../types"
|
||||||
|
import { PathBuilder, extractJsonPath } from "./PathBuilder"
|
||||||
|
|
||||||
export class GetStore<Store, Path extends string> {
|
export class GetStore<Store, StoreValue> {
|
||||||
constructor(
|
constructor(
|
||||||
readonly effects: Effects,
|
readonly effects: Effects,
|
||||||
readonly path: Path & EnsureStorePath<Store, Path>,
|
readonly path: PathBuilder<Store, StoreValue>,
|
||||||
readonly options: {
|
readonly options: {
|
||||||
/** Defaults to what ever the package currently in */
|
/** Defaults to what ever the package currently in */
|
||||||
packageId?: string | undefined
|
packageId?: string | undefined
|
||||||
@@ -14,9 +15,9 @@ export class GetStore<Store, Path extends string> {
|
|||||||
* Returns the value of Store at the provided path. Restart the service if the value changes
|
* Returns the value of Store at the provided path. Restart the service if the value changes
|
||||||
*/
|
*/
|
||||||
const() {
|
const() {
|
||||||
return this.effects.store.get<Store, Path>({
|
return this.effects.store.get<Store, StoreValue>({
|
||||||
...this.options,
|
...this.options,
|
||||||
path: this.path as any,
|
path: extractJsonPath(this.path),
|
||||||
callback: this.effects.restart,
|
callback: this.effects.restart,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -24,9 +25,9 @@ export class GetStore<Store, Path extends string> {
|
|||||||
* Returns the value of Store at the provided path. Does nothing if the value changes
|
* Returns the value of Store at the provided path. Does nothing if the value changes
|
||||||
*/
|
*/
|
||||||
once() {
|
once() {
|
||||||
return this.effects.store.get<Store, Path>({
|
return this.effects.store.get<Store, StoreValue>({
|
||||||
...this.options,
|
...this.options,
|
||||||
path: this.path as any,
|
path: extractJsonPath(this.path),
|
||||||
callback: () => {},
|
callback: () => {},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -40,22 +41,22 @@ export class GetStore<Store, Path extends string> {
|
|||||||
const waitForNext = new Promise<void>((resolve) => {
|
const waitForNext = new Promise<void>((resolve) => {
|
||||||
callback = resolve
|
callback = resolve
|
||||||
})
|
})
|
||||||
yield await this.effects.store.get<Store, Path>({
|
yield await this.effects.store.get<Store, StoreValue>({
|
||||||
...this.options,
|
...this.options,
|
||||||
path: this.path as any,
|
path: extractJsonPath(this.path),
|
||||||
callback: () => callback(),
|
callback: () => callback(),
|
||||||
})
|
})
|
||||||
await waitForNext
|
await waitForNext
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function getStore<Store, Path extends string>(
|
export function getStore<Store, StoreValue>(
|
||||||
effects: Effects,
|
effects: Effects,
|
||||||
path: Path & EnsureStorePath<Store, Path>,
|
path: PathBuilder<Store, StoreValue>,
|
||||||
options: {
|
options: {
|
||||||
/** Defaults to what ever the package currently in */
|
/** Defaults to what ever the package currently in */
|
||||||
packageId?: string | undefined
|
packageId?: string | undefined
|
||||||
} = {},
|
} = {},
|
||||||
) {
|
) {
|
||||||
return new GetStore<Store, Path>(effects, path as any, options)
|
return new GetStore<Store, StoreValue>(effects, path, options)
|
||||||
}
|
}
|
||||||
|
|||||||
12
sdk/lib/store/setupExposeStore.ts
Normal file
12
sdk/lib/store/setupExposeStore.ts
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import { Affine, _ } from "../util"
|
||||||
|
import { PathBuilder, extractJsonPath, pathBuilder } from "./PathBuilder"
|
||||||
|
|
||||||
|
export type ExposedStorePaths = string[] & Affine<"ExposedStorePaths">
|
||||||
|
|
||||||
|
export const setupExposeStore = <Store extends Record<string, any>>(
|
||||||
|
fn: (pathBuilder: PathBuilder<Store>) => PathBuilder<Store, any>[],
|
||||||
|
) => {
|
||||||
|
return fn(pathBuilder<Store>()).map(
|
||||||
|
(x) => extractJsonPath(x) as string,
|
||||||
|
) as ExposedStorePaths
|
||||||
|
}
|
||||||
@@ -425,7 +425,9 @@ describe("values", () => {
|
|||||||
const value = Value.dynamicDatetime<{ test: "a" }>(
|
const value = Value.dynamicDatetime<{ test: "a" }>(
|
||||||
async ({ effects }) => {
|
async ({ effects }) => {
|
||||||
;async () => {
|
;async () => {
|
||||||
;(await sdk.store.getOwn(effects, "/test").once()) satisfies "a"
|
;(await sdk.store
|
||||||
|
.getOwn(effects, sdk.StorePath.test)
|
||||||
|
.once()) satisfies "a"
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ describe("startosTypeValidation ", () => {
|
|||||||
setConfigured: {} as SetConfigured,
|
setConfigured: {} as SetConfigured,
|
||||||
setHealth: {} as SetHealth,
|
setHealth: {} as SetHealth,
|
||||||
exposeForDependents: {} as ExposeForDependentsParams,
|
exposeForDependents: {} as ExposeForDependentsParams,
|
||||||
exposeUi: {} as { [key: string]: ExposedUI },
|
|
||||||
getSslCertificate: {} as GetSslCertificateParams,
|
getSslCertificate: {} as GetSslCertificateParams,
|
||||||
getSslKey: {} as GetSslKeyParams,
|
getSslKey: {} as GetSslKeyParams,
|
||||||
getServiceInterface: {} as GetServiceInterfaceParams,
|
getServiceInterface: {} as GetServiceInterfaceParams,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { MainEffects, StartSdk } from "../StartSdk"
|
import { MainEffects, StartSdk } from "../StartSdk"
|
||||||
|
import { extractJsonPath } from "../store/PathBuilder"
|
||||||
import { Effects } from "../types"
|
import { Effects } from "../types"
|
||||||
|
|
||||||
type Store = {
|
type Store = {
|
||||||
@@ -17,19 +18,21 @@ const sdk = StartSdk.of()
|
|||||||
.withStore<Store>()
|
.withStore<Store>()
|
||||||
.build(true)
|
.build(true)
|
||||||
|
|
||||||
|
const storePath = sdk.StorePath
|
||||||
|
|
||||||
describe("Store", () => {
|
describe("Store", () => {
|
||||||
test("types", async () => {
|
test("types", async () => {
|
||||||
;async () => {
|
;async () => {
|
||||||
sdk.store.setOwn(todo<Effects>(), "/config", {
|
sdk.store.setOwn(todo<Effects>(), storePath.config, {
|
||||||
someValue: "a",
|
someValue: "a",
|
||||||
})
|
})
|
||||||
sdk.store.setOwn(todo<Effects>(), "/config/someValue", "b")
|
sdk.store.setOwn(todo<Effects>(), storePath.config.someValue, "b")
|
||||||
sdk.store.setOwn(todo<Effects>(), "", {
|
sdk.store.setOwn(todo<Effects>(), storePath, {
|
||||||
config: { someValue: "b" },
|
config: { someValue: "b" },
|
||||||
})
|
})
|
||||||
sdk.store.setOwn(
|
sdk.store.setOwn(
|
||||||
todo<Effects>(),
|
todo<Effects>(),
|
||||||
"/config/someValue",
|
storePath.config.someValue,
|
||||||
|
|
||||||
// @ts-expect-error Type is wrong for the setting value
|
// @ts-expect-error Type is wrong for the setting value
|
||||||
5,
|
5,
|
||||||
@@ -41,48 +44,42 @@ describe("Store", () => {
|
|||||||
"someValue",
|
"someValue",
|
||||||
)
|
)
|
||||||
|
|
||||||
todo<Effects>().store.set<Store, "/config/someValue">({
|
todo<Effects>().store.set<Store>({
|
||||||
path: "/config/someValue",
|
path: extractJsonPath(storePath.config.someValue),
|
||||||
value: "b",
|
value: "b",
|
||||||
})
|
})
|
||||||
todo<Effects>().store.set<Store, "/config/some2Value">({
|
todo<Effects>().store.set<Store, "/config/some2Value">({
|
||||||
//@ts-expect-error Path is wrong
|
path: extractJsonPath(storePath.config.someValue),
|
||||||
path: "/config/someValue",
|
|
||||||
//@ts-expect-error Path is wrong
|
//@ts-expect-error Path is wrong
|
||||||
value: "someValueIn",
|
value: "someValueIn",
|
||||||
})
|
})
|
||||||
todo<Effects>().store.set<Store, "/config/someValue">({
|
|
||||||
//@ts-expect-error Path is wrong
|
|
||||||
path: "/config/some2Value",
|
|
||||||
value: "a",
|
|
||||||
})
|
|
||||||
;(await sdk.store
|
;(await sdk.store
|
||||||
.getOwn(todo<MainEffects>(), "/config/someValue")
|
.getOwn(todo<MainEffects>(), storePath.config.someValue)
|
||||||
.const()) satisfies string
|
.const()) satisfies string
|
||||||
;(await sdk.store
|
;(await sdk.store
|
||||||
.getOwn(todo<MainEffects>(), "/config")
|
.getOwn(todo<MainEffects>(), storePath.config)
|
||||||
.const()) satisfies Store["config"]
|
.const()) satisfies Store["config"]
|
||||||
await sdk.store // @ts-expect-error Path is wrong
|
await sdk.store // @ts-expect-error Path is wrong
|
||||||
.getOwn(todo<MainEffects>(), "/config/somdsfeValue")
|
.getOwn(todo<MainEffects>(), "/config/somdsfeValue")
|
||||||
.const()
|
.const()
|
||||||
/// ----------------- ERRORS -----------------
|
/// ----------------- ERRORS -----------------
|
||||||
|
|
||||||
sdk.store.setOwn(todo<MainEffects>(), "", {
|
sdk.store.setOwn(todo<MainEffects>(), storePath, {
|
||||||
// @ts-expect-error Type is wrong for the setting value
|
// @ts-expect-error Type is wrong for the setting value
|
||||||
config: { someValue: "notInAOrB" },
|
config: { someValue: "notInAOrB" },
|
||||||
})
|
})
|
||||||
sdk.store.setOwn(
|
sdk.store.setOwn(
|
||||||
todo<MainEffects>(),
|
todo<MainEffects>(),
|
||||||
"/config/someValue",
|
sdk.StorePath.config.someValue,
|
||||||
// @ts-expect-error Type is wrong for the setting value
|
// @ts-expect-error Type is wrong for the setting value
|
||||||
"notInAOrB",
|
"notInAOrB",
|
||||||
)
|
)
|
||||||
;(await sdk.store
|
;(await sdk.store
|
||||||
.getOwn(todo<Effects>(), "/config/someValue")
|
.getOwn(todo<Effects>(), storePath.config.someValue)
|
||||||
// @ts-expect-error Const should normally not be callable
|
// @ts-expect-error Const should normally not be callable
|
||||||
.const()) satisfies string
|
.const()) satisfies string
|
||||||
;(await sdk.store
|
;(await sdk.store
|
||||||
.getOwn(todo<Effects>(), "/config")
|
.getOwn(todo<Effects>(), storePath.config)
|
||||||
// @ts-expect-error Const should normally not be callable
|
// @ts-expect-error Const should normally not be callable
|
||||||
.const()) satisfies Store["config"]
|
.const()) satisfies Store["config"]
|
||||||
await sdk.store // @ts-expect-error Path is wrong
|
await sdk.store // @ts-expect-error Path is wrong
|
||||||
@@ -92,14 +89,14 @@ describe("Store", () => {
|
|||||||
|
|
||||||
///
|
///
|
||||||
;(await sdk.store
|
;(await sdk.store
|
||||||
.getOwn(todo<MainEffects>(), "/config/someValue")
|
.getOwn(todo<MainEffects>(), storePath.config.someValue)
|
||||||
// @ts-expect-error satisfies type is wrong
|
// @ts-expect-error satisfies type is wrong
|
||||||
.const()) satisfies number
|
.const()) satisfies number
|
||||||
;(await sdk.store // @ts-expect-error Path is wrong
|
await sdk.store // @ts-expect-error Path is wrong
|
||||||
.getOwn(todo<MainEffects>(), "/config/")
|
.getOwn(todo<MainEffects>(), extractJsonPath(storePath.config))
|
||||||
.const()) satisfies Store["config"]
|
.const()
|
||||||
;(await todo<Effects>().store.get<Store, "/config/someValue">({
|
;(await todo<Effects>().store.get({
|
||||||
path: "/config/someValue",
|
path: extractJsonPath(storePath.config.someValue),
|
||||||
callback: noop,
|
callback: noop,
|
||||||
})) satisfies string
|
})) satisfies string
|
||||||
await todo<Effects>().store.get<Store, "/config/someValue">({
|
await todo<Effects>().store.get<Store, "/config/someValue">({
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import { InputSpec } from "./config/configTypes"
|
|||||||
import { DependenciesReceipt } from "./config/setupConfig"
|
import { DependenciesReceipt } from "./config/setupConfig"
|
||||||
import { BindOptions, Scheme } from "./interfaces/Host"
|
import { BindOptions, Scheme } from "./interfaces/Host"
|
||||||
import { Daemons } from "./mainFn/Daemons"
|
import { Daemons } from "./mainFn/Daemons"
|
||||||
|
import { PathBuilder, StorePath } from "./store/PathBuilder"
|
||||||
|
import { ExposedStorePaths } from "./store/setupExposeStore"
|
||||||
import { UrlString } from "./util/getServiceInterface"
|
import { UrlString } from "./util/getServiceInterface"
|
||||||
|
|
||||||
export { SDKManifest } from "./manifest/ManifestTypes"
|
export { SDKManifest } from "./manifest/ManifestTypes"
|
||||||
@@ -93,6 +95,10 @@ export namespace ExpectedExports {
|
|||||||
* that this service could use.
|
* that this service could use.
|
||||||
*/
|
*/
|
||||||
export type dependencyConfig = Record<PackageId, DependencyConfig | null>
|
export type dependencyConfig = Record<PackageId, DependencyConfig | null>
|
||||||
|
|
||||||
|
export type Properties = (options: {
|
||||||
|
effects: Effects
|
||||||
|
}) => Promise<PropertiesReturn>
|
||||||
}
|
}
|
||||||
export type TimeMs = number
|
export type TimeMs = number
|
||||||
export type VersionString = string
|
export type VersionString = string
|
||||||
@@ -249,31 +255,21 @@ export type ServiceInterfaceWithHostInfo = ServiceInterface & {
|
|||||||
hostInfo: HostInfo
|
hostInfo: HostInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
// prettier-ignore
|
|
||||||
export type ExposeAllServicePaths<Store, PreviousPath extends string = ""> =
|
|
||||||
Store extends never ? string :
|
|
||||||
Store extends Record<string, unknown> ? {[K in keyof Store & string]: ExposeAllServicePaths<Store[K], `${PreviousPath}/${K & string}`>}[keyof Store & string] :
|
|
||||||
PreviousPath
|
|
||||||
// prettier-ignore
|
|
||||||
export type ExposeAllUiPaths<Store, PreviousPath extends string = ""> =
|
|
||||||
Store extends Record<string, unknown> ? {[K in keyof Store & string]: ExposeAllUiPaths<Store[K], `${PreviousPath}/${K & string}`>}[keyof Store & string] :
|
|
||||||
Store extends string ? PreviousPath :
|
|
||||||
never
|
|
||||||
export type ExposeServicePaths<Store = never> = {
|
export type ExposeServicePaths<Store = never> = {
|
||||||
/** The path to the value in the Store. [JsonPath](https://jsonpath.com/) */
|
/** The path to the value in the Store. [JsonPath](https://jsonpath.com/) */
|
||||||
paths: Store extends never ? string[] : ExposeAllServicePaths<Store>[]
|
paths: ExposedStorePaths
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ExposeUiPaths<Store> =
|
export type SdkPropertiesValue =
|
||||||
| {
|
| {
|
||||||
type: "object"
|
type: "object"
|
||||||
value: { [k: string]: ExposeUiPaths<Store> }
|
value: { [k: string]: SdkPropertiesValue }
|
||||||
description?: string
|
description?: string
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
type: "string"
|
type: "string"
|
||||||
/** The path to the value in the Store. [JsonPath](https://jsonpath.com/) */
|
/** Value */
|
||||||
path: ExposeAllUiPaths<Store>
|
value: string
|
||||||
/** A human readable description or explanation of the value */
|
/** A human readable description or explanation of the value */
|
||||||
description?: string
|
description?: string
|
||||||
/** (string/number only) Whether or not to mask the value, for example, when displaying a password */
|
/** (string/number only) Whether or not to mask the value, for example, when displaying a password */
|
||||||
@@ -283,16 +279,21 @@ export type ExposeUiPaths<Store> =
|
|||||||
/** (string/number only) Whether or not to include a button for displaying the value as a QR code */
|
/** (string/number only) Whether or not to include a button for displaying the value as a QR code */
|
||||||
qr?: boolean
|
qr?: boolean
|
||||||
}
|
}
|
||||||
export type ExposeUiPathsAll =
|
|
||||||
|
export type SdkPropertiesReturn = {
|
||||||
|
[key: string]: SdkPropertiesValue
|
||||||
|
}
|
||||||
|
|
||||||
|
export type PropertiesValue =
|
||||||
| {
|
| {
|
||||||
type: "object"
|
type: "object"
|
||||||
value: { [k: string]: ExposeUiPathsAll }
|
value: { [k: string]: PropertiesValue }
|
||||||
description: string | null
|
description: string | null
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
type: "string"
|
type: "string"
|
||||||
/** The path to the value in the Store. [JsonPath](https://jsonpath.com/) */
|
/** Value */
|
||||||
path: string
|
value: string
|
||||||
/** A human readable description or explanation of the value */
|
/** A human readable description or explanation of the value */
|
||||||
description: string | null
|
description: string | null
|
||||||
/** (string/number only) Whether or not to mask the value, for example, when displaying a password */
|
/** (string/number only) Whether or not to mask the value, for example, when displaying a password */
|
||||||
@@ -303,6 +304,10 @@ export type ExposeUiPathsAll =
|
|||||||
qr: boolean | null
|
qr: boolean | null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type PropertiesReturn = {
|
||||||
|
[key: string]: PropertiesValue
|
||||||
|
}
|
||||||
|
|
||||||
/** Used to reach out from the pure js runtime */
|
/** Used to reach out from the pure js runtime */
|
||||||
export type Effects = {
|
export type Effects = {
|
||||||
executeAction<Input>(opts: {
|
executeAction<Input>(opts: {
|
||||||
@@ -362,18 +367,18 @@ export type Effects = {
|
|||||||
|
|
||||||
store: {
|
store: {
|
||||||
/** Get a value in a json like data, can be observed and subscribed */
|
/** Get a value in a json like data, can be observed and subscribed */
|
||||||
get<Store = never, Path extends string = never>(options: {
|
get<Store = never, ExtractStore = unknown>(options: {
|
||||||
/** If there is no packageId it is assumed the current package */
|
/** If there is no packageId it is assumed the current package */
|
||||||
packageId?: string
|
packageId?: string
|
||||||
/** The path defaults to root level, using the [JsonPath](https://jsonpath.com/) */
|
/** The path defaults to root level, using the [JsonPath](https://jsonpath.com/) */
|
||||||
path: Path & EnsureStorePath<Store, Path>
|
path: StorePath
|
||||||
callback: (config: unknown, previousConfig: unknown) => void
|
callback: (config: unknown, previousConfig: unknown) => void
|
||||||
}): Promise<ExtractStore<Store, Path>>
|
}): Promise<ExtractStore>
|
||||||
/** Used to store values that can be accessed and subscribed to */
|
/** Used to store values that can be accessed and subscribed to */
|
||||||
set<Store = never, Path extends string = never>(options: {
|
set<Store = never, ExtractStore = unknown>(options: {
|
||||||
/** Sets the value for the wrapper at the path, it will override, using the [JsonPath](https://jsonpath.com/) */
|
/** Sets the value for the wrapper at the path, it will override, using the [JsonPath](https://jsonpath.com/) */
|
||||||
path: Path & EnsureStorePath<Store, Path>
|
path: StorePath
|
||||||
value: ExtractStore<Store, Path>
|
value: ExtractStore
|
||||||
}): Promise<void>
|
}): Promise<void>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -400,7 +405,6 @@ export type Effects = {
|
|||||||
|
|
||||||
exposeForDependents(options: { paths: string[] }): Promise<void>
|
exposeForDependents(options: { paths: string[] }): Promise<void>
|
||||||
|
|
||||||
exposeUi(options: { [key: string]: ExposeUiPathsAll }): Promise<void>
|
|
||||||
/**
|
/**
|
||||||
* There are times that we want to see the addresses that where exported
|
* There are times that we want to see the addresses that where exported
|
||||||
* @param options.addressId If we want to filter the address id
|
* @param options.addressId If we want to filter the address id
|
||||||
@@ -525,22 +529,6 @@ export type Effects = {
|
|||||||
stopped(options: { packageId: string | null }): Promise<boolean>
|
stopped(options: { packageId: string | null }): Promise<boolean>
|
||||||
}
|
}
|
||||||
|
|
||||||
// prettier-ignore
|
|
||||||
export type ExtractStore<Store, Path extends string> =
|
|
||||||
Path extends `/${infer A }/${infer Rest }` ? (A extends keyof Store ? ExtractStore<Store[A], `/${Rest}`> : never) :
|
|
||||||
Path extends `/${infer A }` ? (A extends keyof Store ? Store[A] : never) :
|
|
||||||
Path extends '' ? Store :
|
|
||||||
never
|
|
||||||
|
|
||||||
// prettier-ignore
|
|
||||||
type _EnsureStorePath<Store, Path extends string, Origin extends string> =
|
|
||||||
Path extends`/${infer A }/${infer Rest}` ? (Store extends {[K in A & string]: infer NextStore} ? _EnsureStorePath<NextStore, `/${Rest}`, Origin> : never) :
|
|
||||||
Path extends `/${infer A }` ? (Store extends {[K in A]: infer B} ? Origin : never) :
|
|
||||||
Path extends '' ? Origin :
|
|
||||||
never
|
|
||||||
// prettier-ignore
|
|
||||||
export type EnsureStorePath<Store, Path extends string> = _EnsureStorePath<Store, Path, Path>
|
|
||||||
|
|
||||||
/** rsync options: https://linux.die.net/man/1/rsync
|
/** rsync options: https://linux.die.net/man/1/rsync
|
||||||
*/
|
*/
|
||||||
export type BackupOptions = {
|
export type BackupOptions = {
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ export const isKnownError = (e: unknown): e is T.KnownError =>
|
|||||||
|
|
||||||
declare const affine: unique symbol
|
declare const affine: unique symbol
|
||||||
|
|
||||||
|
export type Affine<A> = { [affine]: A }
|
||||||
|
|
||||||
type NeverPossible = { [affine]: string }
|
type NeverPossible = { [affine]: string }
|
||||||
export type NoAny<A> = NeverPossible extends A
|
export type NoAny<A> = NeverPossible extends A
|
||||||
? keyof NeverPossible extends keyof A
|
? keyof NeverPossible extends keyof A
|
||||||
|
|||||||
Reference in New Issue
Block a user