wip: types

This commit is contained in:
Aiden McClelland
2025-11-10 09:45:30 -07:00
parent f83df5682c
commit 14fcb60670
50 changed files with 529 additions and 298 deletions

View File

@@ -32,6 +32,7 @@ pub fn admin_api<C: Context>() -> ParentHandler<C> {
"add",
from_fn_async(cli_add_admin)
.no_display()
.no_ts()
.with_about("Add admin signer"),
)
.subcommand(
@@ -72,7 +73,7 @@ fn signers_api<C: Context>() -> ParentHandler<C> {
)
.subcommand(
"add",
from_fn_async(cli_add_signer).with_about("Add signer"),
from_fn_async(cli_add_signer).no_ts().with_about("Add signer"),
)
.subcommand(
"edit",

View File

@@ -22,18 +22,24 @@ pub fn db_api<C: Context>() -> ParentHandler<C> {
"dump",
from_fn_async(cli_dump)
.with_display_serializable()
.no_ts()
.with_about("Filter/query db to display tables and records"),
)
.subcommand(
"dump",
from_fn_async(dump)
.with_metadata("admin", Value::Bool(true))
.no_cli(),
.no_cli()
.custom_ts(
DumpParams::inline(),
format!("{{ id: number; value: unknown }}"),
),
)
.subcommand(
"apply",
from_fn_async(cli_apply)
.no_display()
.no_ts()
.with_about("Update a db record"),
)
.subcommand(

View File

@@ -11,7 +11,6 @@ use crate::context::CliContext;
use crate::middleware::cors::Cors;
use crate::middleware::signature::SignatureAuth;
use crate::net::static_server::{bad_request, not_found, server_error};
use crate::net::web_server::{Accept, WebServer};
use crate::prelude::*;
use crate::registry::context::RegistryContext;
use crate::registry::device_info::DeviceInfoMiddleware;

View File

@@ -30,6 +30,7 @@ pub fn get_api<C: Context>() -> ParentHandler<C> {
"iso",
from_fn_async(cli_get_os_asset)
.no_display()
.no_ts()
.with_about("Download iso"),
)
.subcommand("img", from_fn_async(get_img).no_cli())
@@ -37,6 +38,7 @@ pub fn get_api<C: Context>() -> ParentHandler<C> {
"img",
from_fn_async(cli_get_os_asset)
.no_display()
.no_ts()
.with_about("Download img"),
)
.subcommand("squashfs", from_fn_async(get_squashfs).no_cli())
@@ -44,6 +46,7 @@ pub fn get_api<C: Context>() -> ParentHandler<C> {
"squashfs",
from_fn_async(cli_get_os_asset)
.no_display()
.no_ts()
.with_about("Download squashfs"),
)
}

View File

@@ -11,6 +11,7 @@ pub fn asset_api<C: Context>() -> ParentHandler<C> {
"add",
from_fn_async(add::cli_add_asset)
.no_display()
.no_ts()
.with_about("Add asset to registry"),
)
.subcommand("remove", add::remove_api::<C>())
@@ -19,6 +20,7 @@ pub fn asset_api<C: Context>() -> ParentHandler<C> {
"sign",
from_fn_async(sign::cli_sign_asset)
.no_display()
.no_ts()
.with_about("Sign file and add to registry index"),
)
// TODO: remove signature api

View File

@@ -46,6 +46,10 @@ pub fn version_api<C: Context>() -> ParentHandler<C> {
"get",
from_fn_async(get_version)
.with_metadata("get_device_info", Value::Bool(true))
.custom_ts(
GetOsVersionParams::inline(),
BTreeMap::<String, OsVersionInfo>::inline(),
)
.with_display_serializable()
.with_custom_display_fn(|handle, result| {
display_version_info(handle.params, result)

View File

@@ -29,6 +29,7 @@ pub fn package_api<C: Context>() -> ParentHandler<C> {
"add",
from_fn_async(add::cli_add_package)
.no_display()
.no_ts()
.with_about("Add package to registry index"),
)
.subcommand(