From f021ad9b0a4afdbdbabf3b96585eef8716587d6a Mon Sep 17 00:00:00 2001 From: Aiden McClelland <3732071+dr-bonez@users.noreply.github.com> Date: Mon, 1 Apr 2024 13:14:22 -0600 Subject: [PATCH] export api types to ts (#2583) --- Makefile | 2 +- core/Cargo.lock | 4 +- core/models/Cargo.toml | 2 +- core/startos/Cargo.toml | 2 +- core/startos/bindings/ActionParams.ts | 9 + core/startos/bindings/AddImageParams.ts | 4 + core/startos/bindings/AddParams.ts | 4 + core/startos/bindings/ApplyParams.ts | 3 + core/startos/bindings/AttachParams.ts | 7 + core/startos/bindings/BackupParams.ts | 11 + core/startos/bindings/BackupTargetFS.ts | 7 + core/startos/bindings/BackupTargetId.ts | 3 + core/startos/bindings/BlockDev.ts | 3 + core/startos/bindings/Cifs.ts | 8 + core/startos/bindings/ConfigParams.ts | 4 + core/startos/bindings/ConfigureParams.ts | 7 + core/startos/bindings/ConnectParams.ts | 4 + core/startos/bindings/ControlParams.ts | 4 + core/startos/bindings/CreateParams.ts | 10 + core/startos/bindings/DeleteBeforeParams.ts | 3 + core/startos/bindings/DeleteParams.ts | 3 + core/startos/bindings/DumpParams.ts | 3 + core/startos/bindings/EchoParams.ts | 3 + core/startos/bindings/EditManifestParams.ts | 3 + core/startos/bindings/EncryptedWire.ts | 3 + core/startos/bindings/ExecuteParams.ts | 10 + core/startos/bindings/GetParams.ts | 3 + core/startos/bindings/GovernorParams.ts | 4 + core/startos/bindings/InfoParams.ts | 4 + core/startos/bindings/InstallParams.ts | 10 + core/startos/bindings/KernelLogsParams.ts | 8 + core/startos/bindings/KillParams.ts | 3 + core/startos/bindings/ListParams.ts | 3 + core/startos/bindings/LoginParams.ts | 8 + core/startos/bindings/LogoutParams.ts | 3 + core/startos/bindings/LogsParams.ts | 8 + core/startos/bindings/MinMax.ts | 3 + core/startos/bindings/NotificationLevel.ts | 3 + core/startos/bindings/PasswordType.ts | 4 + core/startos/bindings/RecoverySource.ts | 6 + core/startos/bindings/RemoveParams.ts | 3 + core/startos/bindings/ResetParams.ts | 3 + core/startos/bindings/ResetPasswordParams.ts | 7 + core/startos/bindings/RestorePackageParams.ts | 9 + core/startos/bindings/Session.ts | 3 + core/startos/bindings/SessionList.ts | 4 + core/startos/bindings/Sessions.ts | 5 + core/startos/bindings/SetCountryParams.ts | 3 + core/startos/bindings/SetParams.ts | 7 + core/startos/bindings/SshPubKey.ts | 3 + core/startos/bindings/SsidParams.ts | 3 + core/startos/bindings/UiParams.ts | 3 + core/startos/bindings/UmountParams.ts | 4 + core/startos/bindings/UninstallParams.ts | 4 + core/startos/bindings/UpdateParams.ts | 3 + core/startos/bindings/UpdateSystemParams.ts | 3 + core/startos/bindings/VerifyCifsParams.ts | 9 + core/startos/bindings/VerifyParams.ts | 3 + core/startos/bindings/ZramParams.ts | 3 + core/startos/bindings/index.ts | 249 +++++++++++------- core/startos/src/action.rs | 7 +- core/startos/src/auth.rs | 36 ++- core/startos/src/backup/backup_bulk.rs | 4 +- core/startos/src/backup/restore.rs | 4 +- core/startos/src/backup/target/cifs.rs | 10 +- core/startos/src/backup/target/mod.rs | 15 +- core/startos/src/config/mod.rs | 8 +- core/startos/src/control.rs | 4 +- core/startos/src/db/mod.rs | 13 +- core/startos/src/dependencies.rs | 3 +- core/startos/src/diagnostic.rs | 5 +- .../src/disk/mount/filesystem/block_dev.rs | 4 +- .../startos/src/disk/mount/filesystem/cifs.rs | 3 +- core/startos/src/inspect.rs | 12 +- core/startos/src/install/mod.rs | 10 +- core/startos/src/lib.rs | 4 +- core/startos/src/lxc/mod.rs | 9 +- core/startos/src/net/dhcp.rs | 4 +- core/startos/src/net/tor.rs | 8 +- core/startos/src/net/wifi.rs | 11 +- core/startos/src/notifications.rs | 19 +- core/startos/src/os_install/mod.rs | 4 +- core/startos/src/registry/admin.rs | 1 + core/startos/src/registry/marketplace.rs | 5 +- core/startos/src/s9pk/rpc.rs | 7 +- core/startos/src/s9pk/v1/mod.rs | 4 +- core/startos/src/service/mod.rs | 7 +- core/startos/src/service/rpc.rs | 4 +- core/startos/src/setup.rs | 14 +- core/startos/src/ssh.rs | 11 +- core/startos/src/system.rs | 15 +- core/startos/src/update/mod.rs | 5 +- core/startos/src/util/crypto.rs | 9 +- core/startos/src/util/serde.rs | 2 +- 94 files changed, 629 insertions(+), 179 deletions(-) create mode 100644 core/startos/bindings/ActionParams.ts create mode 100644 core/startos/bindings/AddImageParams.ts create mode 100644 core/startos/bindings/AddParams.ts create mode 100644 core/startos/bindings/ApplyParams.ts create mode 100644 core/startos/bindings/AttachParams.ts create mode 100644 core/startos/bindings/BackupParams.ts create mode 100644 core/startos/bindings/BackupTargetFS.ts create mode 100644 core/startos/bindings/BackupTargetId.ts create mode 100644 core/startos/bindings/BlockDev.ts create mode 100644 core/startos/bindings/Cifs.ts create mode 100644 core/startos/bindings/ConfigParams.ts create mode 100644 core/startos/bindings/ConfigureParams.ts create mode 100644 core/startos/bindings/ConnectParams.ts create mode 100644 core/startos/bindings/ControlParams.ts create mode 100644 core/startos/bindings/CreateParams.ts create mode 100644 core/startos/bindings/DeleteBeforeParams.ts create mode 100644 core/startos/bindings/DeleteParams.ts create mode 100644 core/startos/bindings/DumpParams.ts create mode 100644 core/startos/bindings/EchoParams.ts create mode 100644 core/startos/bindings/EditManifestParams.ts create mode 100644 core/startos/bindings/EncryptedWire.ts create mode 100644 core/startos/bindings/ExecuteParams.ts create mode 100644 core/startos/bindings/GetParams.ts create mode 100644 core/startos/bindings/GovernorParams.ts create mode 100644 core/startos/bindings/InfoParams.ts create mode 100644 core/startos/bindings/InstallParams.ts create mode 100644 core/startos/bindings/KernelLogsParams.ts create mode 100644 core/startos/bindings/KillParams.ts create mode 100644 core/startos/bindings/ListParams.ts create mode 100644 core/startos/bindings/LoginParams.ts create mode 100644 core/startos/bindings/LogoutParams.ts create mode 100644 core/startos/bindings/LogsParams.ts create mode 100644 core/startos/bindings/MinMax.ts create mode 100644 core/startos/bindings/NotificationLevel.ts create mode 100644 core/startos/bindings/PasswordType.ts create mode 100644 core/startos/bindings/RecoverySource.ts create mode 100644 core/startos/bindings/RemoveParams.ts create mode 100644 core/startos/bindings/ResetParams.ts create mode 100644 core/startos/bindings/ResetPasswordParams.ts create mode 100644 core/startos/bindings/RestorePackageParams.ts create mode 100644 core/startos/bindings/Session.ts create mode 100644 core/startos/bindings/SessionList.ts create mode 100644 core/startos/bindings/Sessions.ts create mode 100644 core/startos/bindings/SetCountryParams.ts create mode 100644 core/startos/bindings/SetParams.ts create mode 100644 core/startos/bindings/SshPubKey.ts create mode 100644 core/startos/bindings/SsidParams.ts create mode 100644 core/startos/bindings/UiParams.ts create mode 100644 core/startos/bindings/UmountParams.ts create mode 100644 core/startos/bindings/UninstallParams.ts create mode 100644 core/startos/bindings/UpdateParams.ts create mode 100644 core/startos/bindings/UpdateSystemParams.ts create mode 100644 core/startos/bindings/VerifyCifsParams.ts create mode 100644 core/startos/bindings/VerifyParams.ts create mode 100644 core/startos/bindings/ZramParams.ts diff --git a/Makefile b/Makefile index 1d9f2cdaf..c988b11b8 100644 --- a/Makefile +++ b/Makefile @@ -183,7 +183,7 @@ container-runtime/node_modules: container-runtime/package.json container-runtime core/startos/bindings: $(shell git ls-files -- core ':!:core/startos/bindings/*') $(ENVIRONMENT_FILE) rm -rf core/startos/bindings (cd core/ && cargo test --features=test) - ls core/startos/bindings/*.ts | sed 's/core\/startos\/bindings\/\([^.]*\)\.ts/export { \1 } from ".\/\1.ts";/g' > core/startos/bindings/index.ts + ls core/startos/bindings/*.ts | sed 's/core\/startos\/bindings\/\([^.]*\)\.ts/export { \1 } from ".\/\1";/g' > core/startos/bindings/index.ts npm --prefix sdk exec -- prettier -w ./core/startos/bindings/*.ts sdk/dist: $(shell git ls-files sdk) core/startos/bindings diff --git a/core/Cargo.lock b/core/Cargo.lock index 305910a0a..5a5552829 100644 --- a/core/Cargo.lock +++ b/core/Cargo.lock @@ -5400,7 +5400,7 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "ts-rs" version = "8.1.0" -source = "git+https://github.com/dr-bonez/ts-rs.git?branch=feature/top-level-type-override#3f7ff0f0f418c7fa1f1cf6b48697ca9e74f68201" +source = "git+https://github.com/dr-bonez/ts-rs.git?branch=feature/top-level-as#d5f359d803158e06f47977a6f785878a82221d4f" dependencies = [ "thiserror", "ts-rs-macros", @@ -5409,7 +5409,7 @@ dependencies = [ [[package]] name = "ts-rs-macros" version = "8.1.0" -source = "git+https://github.com/dr-bonez/ts-rs.git?branch=feature/top-level-type-override#3f7ff0f0f418c7fa1f1cf6b48697ca9e74f68201" +source = "git+https://github.com/dr-bonez/ts-rs.git?branch=feature/top-level-as#d5f359d803158e06f47977a6f785878a82221d4f" dependencies = [ "Inflector", "proc-macro2", diff --git a/core/models/Cargo.toml b/core/models/Cargo.toml index b6a506774..3611f45d5 100644 --- a/core/models/Cargo.toml +++ b/core/models/Cargo.toml @@ -32,7 +32,7 @@ sqlx = { version = "0.7.2", features = [ "postgres", ] } ssh-key = "0.6.2" -ts-rs = { git = "https://github.com/dr-bonez/ts-rs.git", branch = "feature/top-level-type-override" } # "8" +ts-rs = { git = "https://github.com/dr-bonez/ts-rs.git", branch = "feature/top-level-as" } # "8" thiserror = "1.0" tokio = { version = "1", features = ["full"] } torut = { git = "https://github.com/Start9Labs/torut.git", branch = "update/dependencies" } diff --git a/core/startos/Cargo.toml b/core/startos/Cargo.toml index d1a333447..12e2696ac 100644 --- a/core/startos/Cargo.toml +++ b/core/startos/Cargo.toml @@ -176,7 +176,7 @@ tracing-futures = "0.2.5" tracing-journald = "0.3.0" tracing-subscriber = { version = "0.3.17", features = ["env-filter"] } trust-dns-server = "0.23.1" -ts-rs = { git = "https://github.com/dr-bonez/ts-rs.git", branch = "feature/top-level-type-override" } # "8.1.0" +ts-rs = { git = "https://github.com/dr-bonez/ts-rs.git", branch = "feature/top-level-as" } # "8.1.0" typed-builder = "0.18.0" url = { version = "2.4.1", features = ["serde"] } urlencoding = "2.1.3" diff --git a/core/startos/bindings/ActionParams.ts b/core/startos/bindings/ActionParams.ts new file mode 100644 index 000000000..a57d7f72d --- /dev/null +++ b/core/startos/bindings/ActionParams.ts @@ -0,0 +1,9 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ActionId } from "./ActionId"; +import type { PackageId } from "./PackageId"; + +export type ActionParams = { + id: PackageId; + actionId: ActionId; + input: { [key: string]: any } | null; +}; diff --git a/core/startos/bindings/AddImageParams.ts b/core/startos/bindings/AddImageParams.ts new file mode 100644 index 000000000..628c73354 --- /dev/null +++ b/core/startos/bindings/AddImageParams.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ImageId } from "./ImageId"; + +export type AddImageParams = { id: ImageId; image: string }; diff --git a/core/startos/bindings/AddParams.ts b/core/startos/bindings/AddParams.ts new file mode 100644 index 000000000..03a4ea947 --- /dev/null +++ b/core/startos/bindings/AddParams.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { SshPubKey } from "./SshPubKey"; + +export type AddParams = { key: SshPubKey }; diff --git a/core/startos/bindings/ApplyParams.ts b/core/startos/bindings/ApplyParams.ts new file mode 100644 index 000000000..5ace9cd38 --- /dev/null +++ b/core/startos/bindings/ApplyParams.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type ApplyParams = { expr: string; path: string | null }; diff --git a/core/startos/bindings/AttachParams.ts b/core/startos/bindings/AttachParams.ts new file mode 100644 index 000000000..b3f7a23e7 --- /dev/null +++ b/core/startos/bindings/AttachParams.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { EncryptedWire } from "./EncryptedWire"; + +export type AttachParams = { + startOsPassword: EncryptedWire | null; + guid: string; +}; diff --git a/core/startos/bindings/BackupParams.ts b/core/startos/bindings/BackupParams.ts new file mode 100644 index 000000000..d10e47425 --- /dev/null +++ b/core/startos/bindings/BackupParams.ts @@ -0,0 +1,11 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { BackupTargetId } from "./BackupTargetId"; +import type { PackageId } from "./PackageId"; +import type { PasswordType } from "./PasswordType"; + +export type BackupParams = { + targetId: BackupTargetId; + oldPassword: PasswordType | null; + packageIds: Array | null; + password: PasswordType; +}; diff --git a/core/startos/bindings/BackupTargetFS.ts b/core/startos/bindings/BackupTargetFS.ts new file mode 100644 index 000000000..99a56c3e4 --- /dev/null +++ b/core/startos/bindings/BackupTargetFS.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { BlockDev } from "./BlockDev"; +import type { Cifs } from "./Cifs"; + +export type BackupTargetFS = + | ({ type: "disk" } & BlockDev) + | ({ type: "cifs" } & Cifs); diff --git a/core/startos/bindings/BackupTargetId.ts b/core/startos/bindings/BackupTargetId.ts new file mode 100644 index 000000000..e62366d97 --- /dev/null +++ b/core/startos/bindings/BackupTargetId.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type BackupTargetId = string; diff --git a/core/startos/bindings/BlockDev.ts b/core/startos/bindings/BlockDev.ts new file mode 100644 index 000000000..f98a545cb --- /dev/null +++ b/core/startos/bindings/BlockDev.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type BlockDev = { logicalname: string }; diff --git a/core/startos/bindings/Cifs.ts b/core/startos/bindings/Cifs.ts new file mode 100644 index 000000000..98c18afc7 --- /dev/null +++ b/core/startos/bindings/Cifs.ts @@ -0,0 +1,8 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type Cifs = { + hostname: string; + path: string; + username: string; + password: string | null; +}; diff --git a/core/startos/bindings/ConfigParams.ts b/core/startos/bindings/ConfigParams.ts new file mode 100644 index 000000000..6c81b4691 --- /dev/null +++ b/core/startos/bindings/ConfigParams.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { PackageId } from "./PackageId"; + +export type ConfigParams = { id: PackageId }; diff --git a/core/startos/bindings/ConfigureParams.ts b/core/startos/bindings/ConfigureParams.ts new file mode 100644 index 000000000..931e8b52e --- /dev/null +++ b/core/startos/bindings/ConfigureParams.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { PackageId } from "./PackageId"; + +export type ConfigureParams = { + dependentId: PackageId; + dependencyId: PackageId; +}; diff --git a/core/startos/bindings/ConnectParams.ts b/core/startos/bindings/ConnectParams.ts new file mode 100644 index 000000000..df5f5c779 --- /dev/null +++ b/core/startos/bindings/ConnectParams.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { PackageId } from "./PackageId"; + +export type ConnectParams = { id: PackageId }; diff --git a/core/startos/bindings/ControlParams.ts b/core/startos/bindings/ControlParams.ts new file mode 100644 index 000000000..32739363f --- /dev/null +++ b/core/startos/bindings/ControlParams.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { PackageId } from "./PackageId"; + +export type ControlParams = { id: PackageId }; diff --git a/core/startos/bindings/CreateParams.ts b/core/startos/bindings/CreateParams.ts new file mode 100644 index 000000000..4889f2ddf --- /dev/null +++ b/core/startos/bindings/CreateParams.ts @@ -0,0 +1,10 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { NotificationLevel } from "./NotificationLevel"; +import type { PackageId } from "./PackageId"; + +export type CreateParams = { + package: PackageId | null; + level: NotificationLevel; + title: string; + message: string; +}; diff --git a/core/startos/bindings/DeleteBeforeParams.ts b/core/startos/bindings/DeleteBeforeParams.ts new file mode 100644 index 000000000..55297106a --- /dev/null +++ b/core/startos/bindings/DeleteBeforeParams.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type DeleteBeforeParams = { before: number }; diff --git a/core/startos/bindings/DeleteParams.ts b/core/startos/bindings/DeleteParams.ts new file mode 100644 index 000000000..34161c3b9 --- /dev/null +++ b/core/startos/bindings/DeleteParams.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type DeleteParams = { fingerprint: string }; diff --git a/core/startos/bindings/DumpParams.ts b/core/startos/bindings/DumpParams.ts new file mode 100644 index 000000000..88402caf4 --- /dev/null +++ b/core/startos/bindings/DumpParams.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type DumpParams = {}; diff --git a/core/startos/bindings/EchoParams.ts b/core/startos/bindings/EchoParams.ts new file mode 100644 index 000000000..16638a940 --- /dev/null +++ b/core/startos/bindings/EchoParams.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type EchoParams = { message: string }; diff --git a/core/startos/bindings/EditManifestParams.ts b/core/startos/bindings/EditManifestParams.ts new file mode 100644 index 000000000..19fda62bf --- /dev/null +++ b/core/startos/bindings/EditManifestParams.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type EditManifestParams = { expression: string }; diff --git a/core/startos/bindings/EncryptedWire.ts b/core/startos/bindings/EncryptedWire.ts new file mode 100644 index 000000000..efffd7112 --- /dev/null +++ b/core/startos/bindings/EncryptedWire.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type EncryptedWire = { encrypted: any }; diff --git a/core/startos/bindings/ExecuteParams.ts b/core/startos/bindings/ExecuteParams.ts new file mode 100644 index 000000000..eba6e1023 --- /dev/null +++ b/core/startos/bindings/ExecuteParams.ts @@ -0,0 +1,10 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { EncryptedWire } from "./EncryptedWire"; +import type { RecoverySource } from "./RecoverySource"; + +export type ExecuteParams = { + startOsLogicalname: string; + startOsPassword: EncryptedWire; + recoverySource: RecoverySource | null; + recoveryPassword: EncryptedWire | null; +}; diff --git a/core/startos/bindings/GetParams.ts b/core/startos/bindings/GetParams.ts new file mode 100644 index 000000000..cc045a267 --- /dev/null +++ b/core/startos/bindings/GetParams.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type GetParams = { url: string }; diff --git a/core/startos/bindings/GovernorParams.ts b/core/startos/bindings/GovernorParams.ts new file mode 100644 index 000000000..2af25b061 --- /dev/null +++ b/core/startos/bindings/GovernorParams.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Governor } from "./Governor"; + +export type GovernorParams = { set: Governor | null }; diff --git a/core/startos/bindings/InfoParams.ts b/core/startos/bindings/InfoParams.ts new file mode 100644 index 000000000..ae217103e --- /dev/null +++ b/core/startos/bindings/InfoParams.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { BackupTargetId } from "./BackupTargetId"; + +export type InfoParams = { targetId: BackupTargetId; password: string }; diff --git a/core/startos/bindings/InstallParams.ts b/core/startos/bindings/InstallParams.ts new file mode 100644 index 000000000..394647cff --- /dev/null +++ b/core/startos/bindings/InstallParams.ts @@ -0,0 +1,10 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { MinMax } from "./MinMax"; +import type { PackageId } from "./PackageId"; + +export type InstallParams = { + id: PackageId; + marketplaceUrl: string | null; + versionSpec: string | null; + versionPriority: MinMax | null; +}; diff --git a/core/startos/bindings/KernelLogsParams.ts b/core/startos/bindings/KernelLogsParams.ts new file mode 100644 index 000000000..a820d7b74 --- /dev/null +++ b/core/startos/bindings/KernelLogsParams.ts @@ -0,0 +1,8 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type KernelLogsParams = { + limit: number | null; + cursor: string | null; + before: boolean; + follow: boolean; +}; diff --git a/core/startos/bindings/KillParams.ts b/core/startos/bindings/KillParams.ts new file mode 100644 index 000000000..75bf6a02e --- /dev/null +++ b/core/startos/bindings/KillParams.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type KillParams = { ids: Array }; diff --git a/core/startos/bindings/ListParams.ts b/core/startos/bindings/ListParams.ts new file mode 100644 index 000000000..759bf0667 --- /dev/null +++ b/core/startos/bindings/ListParams.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type ListParams = { before: number | null; limit: number | null }; diff --git a/core/startos/bindings/LoginParams.ts b/core/startos/bindings/LoginParams.ts new file mode 100644 index 000000000..82765e23c --- /dev/null +++ b/core/startos/bindings/LoginParams.ts @@ -0,0 +1,8 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { PasswordType } from "./PasswordType"; + +export type LoginParams = { + password: PasswordType | null; + userAgent: string | null; + metadata: any; +}; diff --git a/core/startos/bindings/LogoutParams.ts b/core/startos/bindings/LogoutParams.ts new file mode 100644 index 000000000..f11b9780e --- /dev/null +++ b/core/startos/bindings/LogoutParams.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type LogoutParams = { session: string }; diff --git a/core/startos/bindings/LogsParams.ts b/core/startos/bindings/LogsParams.ts new file mode 100644 index 000000000..c6a74ec71 --- /dev/null +++ b/core/startos/bindings/LogsParams.ts @@ -0,0 +1,8 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type LogsParams = { + limit: number | null; + cursor: string | null; + before: boolean; + follow: boolean; +}; diff --git a/core/startos/bindings/MinMax.ts b/core/startos/bindings/MinMax.ts new file mode 100644 index 000000000..d5df4aa68 --- /dev/null +++ b/core/startos/bindings/MinMax.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type MinMax = "min" | "max"; diff --git a/core/startos/bindings/NotificationLevel.ts b/core/startos/bindings/NotificationLevel.ts new file mode 100644 index 000000000..8844083d4 --- /dev/null +++ b/core/startos/bindings/NotificationLevel.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type NotificationLevel = "success" | "info" | "warning" | "error"; diff --git a/core/startos/bindings/PasswordType.ts b/core/startos/bindings/PasswordType.ts new file mode 100644 index 000000000..0f36f60a2 --- /dev/null +++ b/core/startos/bindings/PasswordType.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { EncryptedWire } from "./EncryptedWire"; + +export type PasswordType = EncryptedWire | string; diff --git a/core/startos/bindings/RecoverySource.ts b/core/startos/bindings/RecoverySource.ts new file mode 100644 index 000000000..7b4e9365a --- /dev/null +++ b/core/startos/bindings/RecoverySource.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { BackupTargetFS } from "./BackupTargetFS"; + +export type RecoverySource = + | { type: "migrate"; guid: string } + | { type: "backup"; target: BackupTargetFS }; diff --git a/core/startos/bindings/RemoveParams.ts b/core/startos/bindings/RemoveParams.ts new file mode 100644 index 000000000..1424d6ffd --- /dev/null +++ b/core/startos/bindings/RemoveParams.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type RemoveParams = { guid: string }; diff --git a/core/startos/bindings/ResetParams.ts b/core/startos/bindings/ResetParams.ts new file mode 100644 index 000000000..c8a585681 --- /dev/null +++ b/core/startos/bindings/ResetParams.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type ResetParams = { wipeState: boolean; reason: string }; diff --git a/core/startos/bindings/ResetPasswordParams.ts b/core/startos/bindings/ResetPasswordParams.ts new file mode 100644 index 000000000..c7899206d --- /dev/null +++ b/core/startos/bindings/ResetPasswordParams.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { PasswordType } from "./PasswordType"; + +export type ResetPasswordParams = { + oldPassword: PasswordType | null; + newPassword: PasswordType | null; +}; diff --git a/core/startos/bindings/RestorePackageParams.ts b/core/startos/bindings/RestorePackageParams.ts new file mode 100644 index 000000000..95d34b5c1 --- /dev/null +++ b/core/startos/bindings/RestorePackageParams.ts @@ -0,0 +1,9 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { BackupTargetId } from "./BackupTargetId"; +import type { PackageId } from "./PackageId"; + +export type RestorePackageParams = { + ids: Array; + targetId: BackupTargetId; + password: string; +}; diff --git a/core/startos/bindings/Session.ts b/core/startos/bindings/Session.ts new file mode 100644 index 000000000..05a3ae65d --- /dev/null +++ b/core/startos/bindings/Session.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type Session = { loggedIn: string; lastActive: string; metadata: any }; diff --git a/core/startos/bindings/SessionList.ts b/core/startos/bindings/SessionList.ts new file mode 100644 index 000000000..ef1561188 --- /dev/null +++ b/core/startos/bindings/SessionList.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Sessions } from "./Sessions"; + +export type SessionList = { current: string; sessions: Sessions }; diff --git a/core/startos/bindings/Sessions.ts b/core/startos/bindings/Sessions.ts new file mode 100644 index 000000000..a5ac67b65 --- /dev/null +++ b/core/startos/bindings/Sessions.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type Sessions = { + [key: string]: { loggedIn: string; lastActive: string; metadata: any }; +}; diff --git a/core/startos/bindings/SetCountryParams.ts b/core/startos/bindings/SetCountryParams.ts new file mode 100644 index 000000000..a3bfb3b24 --- /dev/null +++ b/core/startos/bindings/SetCountryParams.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type SetCountryParams = { country: string }; diff --git a/core/startos/bindings/SetParams.ts b/core/startos/bindings/SetParams.ts new file mode 100644 index 000000000..1d7a835b6 --- /dev/null +++ b/core/startos/bindings/SetParams.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Duration } from "./Duration"; + +export type SetParams = { + timeout: Duration | null; + config: { [key: string]: any } | null; +}; diff --git a/core/startos/bindings/SshPubKey.ts b/core/startos/bindings/SshPubKey.ts new file mode 100644 index 000000000..edd45d0dc --- /dev/null +++ b/core/startos/bindings/SshPubKey.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type SshPubKey = string; diff --git a/core/startos/bindings/SsidParams.ts b/core/startos/bindings/SsidParams.ts new file mode 100644 index 000000000..e5e0793ce --- /dev/null +++ b/core/startos/bindings/SsidParams.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type SsidParams = { ssid: string }; diff --git a/core/startos/bindings/UiParams.ts b/core/startos/bindings/UiParams.ts new file mode 100644 index 000000000..678723e08 --- /dev/null +++ b/core/startos/bindings/UiParams.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type UiParams = { pointer: string; value: any }; diff --git a/core/startos/bindings/UmountParams.ts b/core/startos/bindings/UmountParams.ts new file mode 100644 index 000000000..e473af15f --- /dev/null +++ b/core/startos/bindings/UmountParams.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { BackupTargetId } from "./BackupTargetId"; + +export type UmountParams = { targetId: BackupTargetId | null }; diff --git a/core/startos/bindings/UninstallParams.ts b/core/startos/bindings/UninstallParams.ts new file mode 100644 index 000000000..fd8c6fba7 --- /dev/null +++ b/core/startos/bindings/UninstallParams.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { PackageId } from "./PackageId"; + +export type UninstallParams = { id: PackageId }; diff --git a/core/startos/bindings/UpdateParams.ts b/core/startos/bindings/UpdateParams.ts new file mode 100644 index 000000000..2c64f7dd8 --- /dev/null +++ b/core/startos/bindings/UpdateParams.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type UpdateParams = { interface: string }; diff --git a/core/startos/bindings/UpdateSystemParams.ts b/core/startos/bindings/UpdateSystemParams.ts new file mode 100644 index 000000000..4e266ffdc --- /dev/null +++ b/core/startos/bindings/UpdateSystemParams.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type UpdateSystemParams = { marketplaceUrl: string }; diff --git a/core/startos/bindings/VerifyCifsParams.ts b/core/startos/bindings/VerifyCifsParams.ts new file mode 100644 index 000000000..6516243ad --- /dev/null +++ b/core/startos/bindings/VerifyCifsParams.ts @@ -0,0 +1,9 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { EncryptedWire } from "./EncryptedWire"; + +export type VerifyCifsParams = { + hostname: string; + path: string; + username: string; + password: EncryptedWire | null; +}; diff --git a/core/startos/bindings/VerifyParams.ts b/core/startos/bindings/VerifyParams.ts new file mode 100644 index 000000000..49e963750 --- /dev/null +++ b/core/startos/bindings/VerifyParams.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type VerifyParams = { path: string }; diff --git a/core/startos/bindings/ZramParams.ts b/core/startos/bindings/ZramParams.ts new file mode 100644 index 000000000..b69c21349 --- /dev/null +++ b/core/startos/bindings/ZramParams.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type ZramParams = { enable: boolean }; diff --git a/core/startos/bindings/index.ts b/core/startos/bindings/index.ts index 178e49c4f..d9c75c2d6 100644 --- a/core/startos/bindings/index.ts +++ b/core/startos/bindings/index.ts @@ -1,97 +1,152 @@ -export { ActionId } from "./ActionId.ts"; -export { ActionMetadata } from "./ActionMetadata.ts"; -export { AddressInfo } from "./AddressInfo.ts"; -export { AddSslOptions } from "./AddSslOptions.ts"; -export { Alerts } from "./Alerts.ts"; -export { Algorithm } from "./Algorithm.ts"; -export { AllowedStatuses } from "./AllowedStatuses.ts"; -export { AllPackageData } from "./AllPackageData.ts"; -export { AlpnInfo } from "./AlpnInfo.ts"; -export { BackupProgress } from "./BackupProgress.ts"; -export { BindInfo } from "./BindInfo.ts"; -export { BindOptions } from "./BindOptions.ts"; -export { BindParams } from "./BindParams.ts"; -export { Callback } from "./Callback.ts"; -export { ChrootParams } from "./ChrootParams.ts"; -export { CreateOverlayedImageParams } from "./CreateOverlayedImageParams.ts"; -export { CurrentDependencies } from "./CurrentDependencies.ts"; -export { CurrentDependencyInfo } from "./CurrentDependencyInfo.ts"; -export { DataUrl } from "./DataUrl.ts"; -export { Dependencies } from "./Dependencies.ts"; -export { DependencyConfigErrors } from "./DependencyConfigErrors.ts"; -export { DependencyKind } from "./DependencyKind.ts"; -export { DependencyRequirement } from "./DependencyRequirement.ts"; -export { DepInfo } from "./DepInfo.ts"; -export { Description } from "./Description.ts"; -export { DestroyOverlayedImageParams } from "./DestroyOverlayedImageParams.ts"; -export { Duration } from "./Duration.ts"; -export { ExecuteAction } from "./ExecuteAction.ts"; -export { ExportActionParams } from "./ExportActionParams.ts"; -export { ExportedHostInfo } from "./ExportedHostInfo.ts"; -export { ExportedHostnameInfo } from "./ExportedHostnameInfo.ts"; -export { ExportedIpHostname } from "./ExportedIpHostname.ts"; -export { ExportedOnionHostname } from "./ExportedOnionHostname.ts"; -export { ExportServiceInterfaceParams } from "./ExportServiceInterfaceParams.ts"; -export { ExposeForDependentsParams } from "./ExposeForDependentsParams.ts"; -export { FullProgress } from "./FullProgress.ts"; -export { GetHostInfoParamsKind } from "./GetHostInfoParamsKind.ts"; -export { GetHostInfoParams } from "./GetHostInfoParams.ts"; -export { GetPrimaryUrlParams } from "./GetPrimaryUrlParams.ts"; -export { GetServiceInterfaceParams } from "./GetServiceInterfaceParams.ts"; -export { GetServicePortForwardParams } from "./GetServicePortForwardParams.ts"; -export { GetSslCertificateParams } from "./GetSslCertificateParams.ts"; -export { GetSslKeyParams } from "./GetSslKeyParams.ts"; -export { GetStoreParams } from "./GetStoreParams.ts"; -export { GetSystemSmtpParams } from "./GetSystemSmtpParams.ts"; -export { Governor } from "./Governor.ts"; -export { HardwareRequirements } from "./HardwareRequirements.ts"; -export { HealthCheckId } from "./HealthCheckId.ts"; -export { HealthCheckResult } from "./HealthCheckResult.ts"; -export { HostAddress } from "./HostAddress.ts"; -export { HostId } from "./HostId.ts"; -export { HostInfo } from "./HostInfo.ts"; -export { HostKind } from "./HostKind.ts"; -export { Host } from "./Host.ts"; -export { ImageId } from "./ImageId.ts"; -export { InstalledState } from "./InstalledState.ts"; -export { InstallingInfo } from "./InstallingInfo.ts"; -export { InstallingState } from "./InstallingState.ts"; -export { IpInfo } from "./IpInfo.ts"; -export { ListServiceInterfacesParams } from "./ListServiceInterfacesParams.ts"; -export { MainStatus } from "./MainStatus.ts"; -export { Manifest } from "./Manifest.ts"; -export { MaybeUtf8String } from "./MaybeUtf8String.ts"; -export { MountParams } from "./MountParams.ts"; -export { MountTarget } from "./MountTarget.ts"; -export { NamedProgress } from "./NamedProgress.ts"; -export { PackageDataEntry } from "./PackageDataEntry.ts"; -export { PackageId } from "./PackageId.ts"; -export { PackageState } from "./PackageState.ts"; -export { ParamsMaybePackageId } from "./ParamsMaybePackageId.ts"; -export { ParamsPackageId } from "./ParamsPackageId.ts"; -export { Progress } from "./Progress.ts"; -export { Public } from "./Public.ts"; -export { RemoveActionParams } from "./RemoveActionParams.ts"; -export { RemoveAddressParams } from "./RemoveAddressParams.ts"; -export { ReverseProxyBind } from "./ReverseProxyBind.ts"; -export { ReverseProxyDestination } from "./ReverseProxyDestination.ts"; -export { ReverseProxyHttp } from "./ReverseProxyHttp.ts"; -export { ReverseProxyParams } from "./ReverseProxyParams.ts"; -export { Security } from "./Security.ts"; -export { ServerInfo } from "./ServerInfo.ts"; -export { ServerSpecs } from "./ServerSpecs.ts"; -export { ServerStatus } from "./ServerStatus.ts"; -export { ServiceInterfaceId } from "./ServiceInterfaceId.ts"; -export { ServiceInterface } from "./ServiceInterface.ts"; -export { ServiceInterfaceType } from "./ServiceInterfaceType.ts"; -export { ServiceInterfaceWithHostInfo } from "./ServiceInterfaceWithHostInfo.ts"; -export { SetConfigured } from "./SetConfigured.ts"; -export { SetDependenciesParams } from "./SetDependenciesParams.ts"; -export { SetHealth } from "./SetHealth.ts"; -export { SetMainStatus } from "./SetMainStatus.ts"; -export { SetStoreParams } from "./SetStoreParams.ts"; -export { Status } from "./Status.ts"; -export { UpdateProgress } from "./UpdateProgress.ts"; -export { UpdatingState } from "./UpdatingState.ts"; -export { VolumeId } from "./VolumeId.ts"; -export { WifiInfo } from "./WifiInfo.ts"; +export { ActionId } from "./ActionId"; +export { ActionMetadata } from "./ActionMetadata"; +export { ActionParams } from "./ActionParams"; +export { AddImageParams } from "./AddImageParams"; +export { AddParams } from "./AddParams"; +export { AddressInfo } from "./AddressInfo"; +export { AddSslOptions } from "./AddSslOptions"; +export { Alerts } from "./Alerts"; +export { Algorithm } from "./Algorithm"; +export { AllowedStatuses } from "./AllowedStatuses"; +export { AllPackageData } from "./AllPackageData"; +export { AlpnInfo } from "./AlpnInfo"; +export { ApplyParams } from "./ApplyParams"; +export { AttachParams } from "./AttachParams"; +export { BackupParams } from "./BackupParams"; +export { BackupProgress } from "./BackupProgress"; +export { BackupTargetFS } from "./BackupTargetFS"; +export { BackupTargetId } from "./BackupTargetId"; +export { BindInfo } from "./BindInfo"; +export { BindOptions } from "./BindOptions"; +export { BindParams } from "./BindParams"; +export { BlockDev } from "./BlockDev"; +export { Callback } from "./Callback"; +export { ChrootParams } from "./ChrootParams"; +export { Cifs } from "./Cifs"; +export { ConfigParams } from "./ConfigParams"; +export { ConfigureParams } from "./ConfigureParams"; +export { ConnectParams } from "./ConnectParams"; +export { ControlParams } from "./ControlParams"; +export { CreateOverlayedImageParams } from "./CreateOverlayedImageParams"; +export { CreateParams } from "./CreateParams"; +export { CurrentDependencies } from "./CurrentDependencies"; +export { CurrentDependencyInfo } from "./CurrentDependencyInfo"; +export { DataUrl } from "./DataUrl"; +export { DeleteBeforeParams } from "./DeleteBeforeParams"; +export { DeleteParams } from "./DeleteParams"; +export { Dependencies } from "./Dependencies"; +export { DependencyConfigErrors } from "./DependencyConfigErrors"; +export { DependencyKind } from "./DependencyKind"; +export { DependencyRequirement } from "./DependencyRequirement"; +export { DepInfo } from "./DepInfo"; +export { Description } from "./Description"; +export { DestroyOverlayedImageParams } from "./DestroyOverlayedImageParams"; +export { DumpParams } from "./DumpParams"; +export { Duration } from "./Duration"; +export { EchoParams } from "./EchoParams"; +export { EditManifestParams } from "./EditManifestParams"; +export { EncryptedWire } from "./EncryptedWire"; +export { ExecuteAction } from "./ExecuteAction"; +export { ExecuteParams } from "./ExecuteParams"; +export { ExportActionParams } from "./ExportActionParams"; +export { ExportedHostInfo } from "./ExportedHostInfo"; +export { ExportedHostnameInfo } from "./ExportedHostnameInfo"; +export { ExportedIpHostname } from "./ExportedIpHostname"; +export { ExportedOnionHostname } from "./ExportedOnionHostname"; +export { ExportServiceInterfaceParams } from "./ExportServiceInterfaceParams"; +export { ExposeForDependentsParams } from "./ExposeForDependentsParams"; +export { FullProgress } from "./FullProgress"; +export { GetHostInfoParamsKind } from "./GetHostInfoParamsKind"; +export { GetHostInfoParams } from "./GetHostInfoParams"; +export { GetParams } from "./GetParams"; +export { GetPrimaryUrlParams } from "./GetPrimaryUrlParams"; +export { GetServiceInterfaceParams } from "./GetServiceInterfaceParams"; +export { GetServicePortForwardParams } from "./GetServicePortForwardParams"; +export { GetSslCertificateParams } from "./GetSslCertificateParams"; +export { GetSslKeyParams } from "./GetSslKeyParams"; +export { GetStoreParams } from "./GetStoreParams"; +export { GetSystemSmtpParams } from "./GetSystemSmtpParams"; +export { GovernorParams } from "./GovernorParams"; +export { Governor } from "./Governor"; +export { HardwareRequirements } from "./HardwareRequirements"; +export { HealthCheckId } from "./HealthCheckId"; +export { HealthCheckResult } from "./HealthCheckResult"; +export { HostAddress } from "./HostAddress"; +export { HostId } from "./HostId"; +export { HostInfo } from "./HostInfo"; +export { HostKind } from "./HostKind"; +export { Host } from "./Host"; +export { ImageId } from "./ImageId"; +export { InfoParams } from "./InfoParams"; +export { InstalledState } from "./InstalledState"; +export { InstallingInfo } from "./InstallingInfo"; +export { InstallingState } from "./InstallingState"; +export { InstallParams } from "./InstallParams"; +export { IpInfo } from "./IpInfo"; +export { KernelLogsParams } from "./KernelLogsParams"; +export { KillParams } from "./KillParams"; +export { ListParams } from "./ListParams"; +export { ListServiceInterfacesParams } from "./ListServiceInterfacesParams"; +export { LoginParams } from "./LoginParams"; +export { LogoutParams } from "./LogoutParams"; +export { LogsParams } from "./LogsParams"; +export { MainStatus } from "./MainStatus"; +export { Manifest } from "./Manifest"; +export { MaybeUtf8String } from "./MaybeUtf8String"; +export { MinMax } from "./MinMax"; +export { MountParams } from "./MountParams"; +export { MountTarget } from "./MountTarget"; +export { NamedProgress } from "./NamedProgress"; +export { NotificationLevel } from "./NotificationLevel"; +export { PackageDataEntry } from "./PackageDataEntry"; +export { PackageId } from "./PackageId"; +export { PackageState } from "./PackageState"; +export { ParamsMaybePackageId } from "./ParamsMaybePackageId"; +export { ParamsPackageId } from "./ParamsPackageId"; +export { PasswordType } from "./PasswordType"; +export { Progress } from "./Progress"; +export { Public } from "./Public"; +export { RecoverySource } from "./RecoverySource"; +export { RemoveActionParams } from "./RemoveActionParams"; +export { RemoveAddressParams } from "./RemoveAddressParams"; +export { RemoveParams } from "./RemoveParams"; +export { ResetParams } from "./ResetParams"; +export { ResetPasswordParams } from "./ResetPasswordParams"; +export { RestorePackageParams } from "./RestorePackageParams"; +export { ReverseProxyBind } from "./ReverseProxyBind"; +export { ReverseProxyDestination } from "./ReverseProxyDestination"; +export { ReverseProxyHttp } from "./ReverseProxyHttp"; +export { ReverseProxyParams } from "./ReverseProxyParams"; +export { Security } from "./Security"; +export { ServerInfo } from "./ServerInfo"; +export { ServerSpecs } from "./ServerSpecs"; +export { ServerStatus } from "./ServerStatus"; +export { ServiceInterfaceId } from "./ServiceInterfaceId"; +export { ServiceInterface } from "./ServiceInterface"; +export { ServiceInterfaceType } from "./ServiceInterfaceType"; +export { ServiceInterfaceWithHostInfo } from "./ServiceInterfaceWithHostInfo"; +export { SessionList } from "./SessionList"; +export { Sessions } from "./Sessions"; +export { Session } from "./Session"; +export { SetConfigured } from "./SetConfigured"; +export { SetCountryParams } from "./SetCountryParams"; +export { SetDependenciesParams } from "./SetDependenciesParams"; +export { SetHealth } from "./SetHealth"; +export { SetMainStatus } from "./SetMainStatus"; +export { SetParams } from "./SetParams"; +export { SetStoreParams } from "./SetStoreParams"; +export { SshPubKey } from "./SshPubKey"; +export { SsidParams } from "./SsidParams"; +export { Status } from "./Status"; +export { UiParams } from "./UiParams"; +export { UmountParams } from "./UmountParams"; +export { UninstallParams } from "./UninstallParams"; +export { UpdateParams } from "./UpdateParams"; +export { UpdateProgress } from "./UpdateProgress"; +export { UpdateSystemParams } from "./UpdateSystemParams"; +export { UpdatingState } from "./UpdatingState"; +export { VerifyCifsParams } from "./VerifyCifsParams"; +export { VerifyParams } from "./VerifyParams"; +export { VolumeId } from "./VolumeId"; +export { WifiInfo } from "./WifiInfo"; +export { ZramParams } from "./ZramParams"; diff --git a/core/startos/src/action.rs b/core/startos/src/action.rs index ff3998c3c..1a32856c2 100644 --- a/core/startos/src/action.rs +++ b/core/startos/src/action.rs @@ -4,6 +4,7 @@ use models::PackageId; use rpc_toolkit::command; use serde::{Deserialize, Serialize}; use tracing::instrument; +use ts_rs::TS; use crate::config::Config; use crate::context::RpcContext; @@ -47,17 +48,17 @@ pub fn display_action_result(params: WithIoFormat, result: ActionR } } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct ActionParams { #[arg(id = "id")] #[serde(rename = "id")] pub package_id: PackageId, - #[arg(id = "action-id")] - #[serde(rename = "action-id")] pub action_id: ActionId, #[command(flatten)] + #[ts(type = "{ [key: string]: any } | null")] pub input: StdinDeserializable>, } // impl C diff --git a/core/startos/src/auth.rs b/core/startos/src/auth.rs index 7adce72bc..f8e2d25a0 100644 --- a/core/startos/src/auth.rs +++ b/core/startos/src/auth.rs @@ -9,6 +9,7 @@ use rpc_toolkit::yajrc::RpcError; use rpc_toolkit::{command, from_fn_async, AnyContext, CallRemote, HandlerExt, ParentHandler}; use serde::{Deserialize, Serialize}; use tracing::instrument; +use ts_rs::TS; use crate::context::{CliContext, RpcContext}; use crate::db::model::DatabaseModel; @@ -20,7 +21,8 @@ use crate::util::crypto::EncryptedWire; use crate::util::serde::{display_serializable, HandlerExtSerde, WithIoFormat}; use crate::{ensure_code, Error, ResultExt}; -#[derive(Debug, Clone, Default, Deserialize, Serialize)] +#[derive(Debug, Clone, Default, Deserialize, Serialize, TS)] +#[ts(as = "BTreeMap::")] pub struct Sessions(pub BTreeMap); impl Sessions { pub fn new() -> Self { @@ -38,8 +40,9 @@ impl Map for Sessions { } } -#[derive(Clone, Serialize, Deserialize)] +#[derive(Clone, Serialize, Deserialize, TS)] #[serde(untagged)] +#[ts(export)] pub enum PasswordType { EncryptedWire(EncryptedWire), String(String), @@ -177,14 +180,16 @@ pub fn check_password_against_db(db: &DatabaseModel, password: &str) -> Result<( Ok(()) } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct LoginParams { password: Option, #[serde(default)] user_agent: Option, #[serde(default)] + #[ts(type = "any")] metadata: Value, } @@ -218,10 +223,12 @@ pub async fn login_impl( .await } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct LogoutParams { + #[ts(type = "string")] session: InternedString, } @@ -234,18 +241,25 @@ pub async fn logout( )) } -#[derive(Debug, Clone, Deserialize, Serialize)] +#[derive(Debug, Clone, Deserialize, Serialize, TS)] #[serde(rename_all = "camelCase")] +#[ts(export)] pub struct Session { + #[ts(type = "string")] pub logged_in: DateTime, + #[ts(type = "string")] pub last_active: DateTime, + #[ts(skip)] pub user_agent: Option, + #[ts(type = "any")] pub metadata: Value, } -#[derive(Deserialize, Serialize)] +#[derive(Deserialize, Serialize, TS)] #[serde(rename_all = "camelCase")] +#[ts(export)] pub struct SessionList { + #[ts(type = "string")] current: InternedString, sessions: Sessions, } @@ -303,11 +317,13 @@ fn display_sessions(params: WithIoFormat, arg: SessionList) { table.print_tty(false).unwrap(); } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct ListParams { #[arg(skip)] + #[ts(skip)] session: InternedString, } @@ -338,9 +354,10 @@ impl AsLogoutSessionId for KillSessionId { } } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct KillParams { ids: Vec, } @@ -351,9 +368,10 @@ pub async fn kill(ctx: RpcContext, KillParams { ids }: KillParams) -> Result<(), Ok(()) } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct ResetPasswordParams { old_password: Option, new_password: Option, diff --git a/core/startos/src/backup/backup_bulk.rs b/core/startos/src/backup/backup_bulk.rs index b9f1b877e..9a2784161 100644 --- a/core/startos/src/backup/backup_bulk.rs +++ b/core/startos/src/backup/backup_bulk.rs @@ -11,6 +11,7 @@ use models::PackageId; use serde::{Deserialize, Serialize}; use tokio::io::AsyncWriteExt; use tracing::instrument; +use ts_rs::TS; use super::target::BackupTargetId; use super::PackageBackupReport; @@ -29,9 +30,10 @@ use crate::util::io::dir_copy; use crate::util::serde::IoFormat; use crate::version::VersionT; -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct BackupParams { target_id: BackupTargetId, #[arg(long = "old-password")] diff --git a/core/startos/src/backup/restore.rs b/core/startos/src/backup/restore.rs index 70695b42e..277d4390d 100644 --- a/core/startos/src/backup/restore.rs +++ b/core/startos/src/backup/restore.rs @@ -9,6 +9,7 @@ use patch_db::json_ptr::ROOT; use serde::{Deserialize, Serialize}; use torut::onion::OnionAddressV3; use tracing::instrument; +use ts_rs::TS; use super::target::BackupTargetId; use crate::backup::os::OsBackup; @@ -24,9 +25,10 @@ use crate::s9pk::S9pk; use crate::service::service_map::DownloadInstallFuture; use crate::util::serde::IoFormat; -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct RestorePackageParams { pub ids: Vec, pub target_id: BackupTargetId, diff --git a/core/startos/src/backup/target/cifs.rs b/core/startos/src/backup/target/cifs.rs index a3bbb9759..b50004dc6 100644 --- a/core/startos/src/backup/target/cifs.rs +++ b/core/startos/src/backup/target/cifs.rs @@ -6,6 +6,7 @@ use color_eyre::eyre::eyre; use imbl_value::InternedString; use rpc_toolkit::{command, from_fn_async, HandlerExt, ParentHandler}; use serde::{Deserialize, Serialize}; +use ts_rs::TS; use super::{BackupTarget, BackupTargetId}; use crate::context::{CliContext, RpcContext}; @@ -67,9 +68,10 @@ pub fn cifs() -> ParentHandler { ) } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct AddParams { pub hostname: String, pub path: PathBuf, @@ -121,9 +123,10 @@ pub async fn add( }) } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct UpdateParams { pub id: BackupTargetId, pub hostname: String, @@ -185,9 +188,10 @@ pub async fn update( }) } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct RemoveParams { pub id: BackupTargetId, } diff --git a/core/startos/src/backup/target/mod.rs b/core/startos/src/backup/target/mod.rs index ac48d75a6..7925cadff 100644 --- a/core/startos/src/backup/target/mod.rs +++ b/core/startos/src/backup/target/mod.rs @@ -13,6 +13,7 @@ use serde::{Deserialize, Serialize}; use sha2::Sha256; use tokio::sync::Mutex; use tracing::instrument; +use ts_rs::TS; use self::cifs::CifsBackupTarget; use crate::context::{CliContext, RpcContext}; @@ -46,7 +47,8 @@ pub enum BackupTarget { Cifs(CifsBackupTarget), } -#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone)] +#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, TS)] +#[ts(type = "string")] pub enum BackupTargetId { Disk { logicalname: PathBuf }, Cifs { id: u32 }, @@ -107,7 +109,7 @@ impl Serialize for BackupTargetId { } } -#[derive(Debug, Deserialize, Serialize)] +#[derive(Debug, Deserialize, Serialize, TS)] #[serde(tag = "type")] #[serde(rename_all = "camelCase")] pub enum BackupTargetFS { @@ -242,9 +244,10 @@ fn display_backup_info(params: WithIoFormat, info: BackupInfo) { table.print_tty(false).unwrap(); } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct InfoParams { target_id: BackupTargetId, password: String, @@ -276,9 +279,10 @@ lazy_static::lazy_static! { Mutex::new(BTreeMap::new()); } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct MountParams { target_id: BackupTargetId, password: String, @@ -311,9 +315,10 @@ pub async fn mount( Ok(res) } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct UmountParams { target_id: Option, } diff --git a/core/startos/src/config/mod.rs b/core/startos/src/config/mod.rs index 18f67b05a..484d13b02 100644 --- a/core/startos/src/config/mod.rs +++ b/core/startos/src/config/mod.rs @@ -12,6 +12,7 @@ use regex::Regex; use rpc_toolkit::{from_fn_async, Empty, HandlerExt, ParentHandler}; use serde::{Deserialize, Serialize}; use tracing::instrument; +use ts_rs::TS; use crate::context::{CliContext, RpcContext}; use crate::prelude::*; @@ -125,9 +126,10 @@ pub enum MatchError { ListUniquenessViolation, } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct ConfigParams { pub id: PackageId, } @@ -156,12 +158,14 @@ pub async fn get(ctx: RpcContext, _: Empty, id: PackageId) -> Result, #[command(flatten)] + #[ts(type = "{ [key: string]: any } | null")] pub config: StdinDeserializable>, } diff --git a/core/startos/src/control.rs b/core/startos/src/control.rs index e37c88ee4..11036858a 100644 --- a/core/startos/src/control.rs +++ b/core/startos/src/control.rs @@ -4,14 +4,16 @@ use models::PackageId; use rpc_toolkit::command; use serde::{Deserialize, Serialize}; use tracing::instrument; +use ts_rs::TS; use crate::context::RpcContext; use crate::prelude::*; use crate::Error; -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct ControlParams { pub id: PackageId, } diff --git a/core/startos/src/db/mod.rs b/core/startos/src/db/mod.rs index 99602ba5a..8e28c0f3c 100644 --- a/core/startos/src/db/mod.rs +++ b/core/startos/src/db/mod.rs @@ -19,6 +19,7 @@ use serde::{Deserialize, Serialize}; use serde_json::Value; use tokio::sync::oneshot; use tracing::instrument; +use ts_rs::TS; use crate::context::{CliContext, RpcContext}; use crate::middleware::auth::{HasValidSession, HashSessionToken}; @@ -215,12 +216,14 @@ async fn cli_dump( Ok(dump) } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct DumpParams { #[arg(long = "include-private", short = 'p')] #[serde(default)] + #[ts(skip)] include_private: bool, } @@ -271,9 +274,10 @@ async fn cli_apply( Ok(()) } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct ApplyParams { expr: String, path: Option, @@ -309,11 +313,14 @@ pub fn put() -> ParentHandler { .with_remote_cli::(), ) } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct UiParams { + #[ts(type = "string")] pointer: JsonPointer, + #[ts(type = "any")] value: Value, } diff --git a/core/startos/src/dependencies.rs b/core/startos/src/dependencies.rs index d973688e9..936d1788b 100644 --- a/core/startos/src/dependencies.rs +++ b/core/startos/src/dependencies.rs @@ -43,9 +43,10 @@ pub struct DepInfo { pub optional: bool, } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct ConfigureParams { dependent_id: PackageId, dependency_id: PackageId, diff --git a/core/startos/src/diagnostic.rs b/core/startos/src/diagnostic.rs index b0820b293..86c3a4dd5 100644 --- a/core/startos/src/diagnostic.rs +++ b/core/startos/src/diagnostic.rs @@ -5,6 +5,7 @@ use clap::Parser; use rpc_toolkit::yajrc::RpcError; use rpc_toolkit::{command, from_fn, from_fn_async, AnyContext, HandlerExt, ParentHandler}; use serde::{Deserialize, Serialize}; +use ts_rs::TS; use crate::context::{CliContext, DiagnosticContext}; use crate::init::SYSTEM_REBUILD_PATH; @@ -40,10 +41,12 @@ pub fn error(ctx: DiagnosticContext) -> Result, Error> { Ok(ctx.error.clone()) } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct LogsParams { + #[ts(type = "number | null")] limit: Option, cursor: Option, before: bool, diff --git a/core/startos/src/disk/mount/filesystem/block_dev.rs b/core/startos/src/disk/mount/filesystem/block_dev.rs index 96e9d79a7..7bbef2a77 100644 --- a/core/startos/src/disk/mount/filesystem/block_dev.rs +++ b/core/startos/src/disk/mount/filesystem/block_dev.rs @@ -5,12 +5,14 @@ use digest::generic_array::GenericArray; use digest::{Digest, OutputSizeUser}; use serde::{Deserialize, Serialize}; use sha2::Sha256; +use ts_rs::TS; use super::FileSystem; use crate::prelude::*; -#[derive(Debug, Deserialize, Serialize)] +#[derive(Debug, Deserialize, Serialize, TS)] #[serde(rename_all = "camelCase")] +#[ts(concrete(LogicalName = std::path::PathBuf))] pub struct BlockDev> { logicalname: LogicalName, } diff --git a/core/startos/src/disk/mount/filesystem/cifs.rs b/core/startos/src/disk/mount/filesystem/cifs.rs index e125b9a90..87509f150 100644 --- a/core/startos/src/disk/mount/filesystem/cifs.rs +++ b/core/startos/src/disk/mount/filesystem/cifs.rs @@ -8,6 +8,7 @@ use serde::{Deserialize, Serialize}; use sha2::Sha256; use tokio::process::Command; use tracing::instrument; +use ts_rs::TS; use super::{FileSystem, MountType, ReadOnly}; use crate::disk::mount::guard::{GenericMountGuard, TmpMountGuard}; @@ -62,7 +63,7 @@ pub async fn mount_cifs( Ok(()) } -#[derive(Debug, Deserialize, Serialize)] +#[derive(Debug, Deserialize, Serialize, TS)] #[serde(rename_all = "camelCase")] pub struct Cifs { pub hostname: String, diff --git a/core/startos/src/inspect.rs b/core/startos/src/inspect.rs index 3fe84d06f..3e95faa6c 100644 --- a/core/startos/src/inspect.rs +++ b/core/startos/src/inspect.rs @@ -23,9 +23,10 @@ pub fn inspect() -> ParentHandler { .subcommand("docker-images", from_fn_async(docker_images).no_display()) } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct HashParams { path: PathBuf, } @@ -38,9 +39,10 @@ pub async fn hash(_: CliContext, HashParams { path }: HashParams) -> Result Result { .collect()) } -#[derive(Debug, Clone, Copy, serde::Deserialize, serde::Serialize)] +#[derive(Debug, Clone, Copy, serde::Deserialize, serde::Serialize, TS)] #[serde(rename_all = "camelCase")] pub enum MinMax { Min, @@ -102,12 +103,14 @@ impl std::fmt::Display for MinMax { } } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct InstallParams { id: PackageId, #[arg(short = 'm', long = "marketplace-url")] + #[ts(type = "string | null")] marketplace_url: Option, #[arg(short = 'v', long = "version-spec")] version_spec: Option, @@ -391,9 +394,10 @@ pub async fn cli_install(ctx: CliContext, params: CliInstallParams) -> Result<() Ok(()) } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct UninstallParams { id: PackageId, } diff --git a/core/startos/src/lib.rs b/core/startos/src/lib.rs index 0b3336783..c048ae61c 100644 --- a/core/startos/src/lib.rs +++ b/core/startos/src/lib.rs @@ -75,13 +75,15 @@ use rpc_toolkit::{ command, from_fn, from_fn_async, from_fn_blocking, AnyContext, HandlerExt, ParentHandler, }; use serde::{Deserialize, Serialize}; +use ts_rs::TS; use crate::context::CliContext; use crate::util::serde::HandlerExtSerde; -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct EchoParams { message: String, } diff --git a/core/startos/src/lxc/mod.rs b/core/startos/src/lxc/mod.rs index f77837238..26d2d6a37 100644 --- a/core/startos/src/lxc/mod.rs +++ b/core/startos/src/lxc/mod.rs @@ -20,6 +20,7 @@ use tokio::io::{AsyncBufReadExt, BufReader}; use tokio::process::Command; use tokio::sync::Mutex; use tokio::time::Instant; +use ts_rs::TS; use crate::context::{CliContext, RpcContext}; use crate::core::rpc_continuations::{RequestGuid, RpcContinuation}; @@ -351,8 +352,10 @@ pub async fn list(ctx: RpcContext) -> Result, Error> { Ok(ctx.dev.lxc.lock().await.keys().cloned().collect()) } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] +#[ts(export)] pub struct RemoveParams { + #[ts(type = "string")] pub guid: InternedString, } @@ -363,8 +366,10 @@ pub async fn remove(ctx: RpcContext, RemoveParams { guid }: RemoveParams) -> Res Ok(()) } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] +#[ts(export)] pub struct ConnectParams { + #[ts(type = "string")] pub guid: InternedString, } diff --git a/core/startos/src/net/dhcp.rs b/core/startos/src/net/dhcp.rs index f36df0e28..ce5de96ba 100644 --- a/core/startos/src/net/dhcp.rs +++ b/core/startos/src/net/dhcp.rs @@ -6,6 +6,7 @@ use futures::TryStreamExt; use rpc_toolkit::{from_fn_async, HandlerExt, ParentHandler}; use serde::{Deserialize, Serialize}; use tokio::sync::RwLock; +use ts_rs::TS; use crate::context::{CliContext, RpcContext}; use crate::db::model::public::IpInfo; @@ -60,9 +61,10 @@ pub fn dhcp() -> ParentHandler { .with_remote_cli::(), ) } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct UpdateParams { interface: String, } diff --git a/core/startos/src/net/tor.rs b/core/startos/src/net/tor.rs index c87f506dc..7b5e848f1 100644 --- a/core/startos/src/net/tor.rs +++ b/core/startos/src/net/tor.rs @@ -22,6 +22,7 @@ use tokio::time::Instant; use torut::control::{AsyncEvent, AuthenticatedConn, ConnError}; use torut::onion::{OnionAddressV3, TorSecretKeyV3}; use tracing::instrument; +use ts_rs::TS; use crate::context::{CliContext, RpcContext}; use crate::logs::{ @@ -104,9 +105,10 @@ pub fn tor() -> ParentHandler { .with_remote_cli::(), ) } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct ResetParams { #[arg(name = "wipe-state", short = 'w', long = "wipe-state")] wipe_state: bool, @@ -142,11 +144,13 @@ pub async fn list_services(ctx: RpcContext, _: Empty) -> Result, #[arg(short = 'c', long = "cursor")] cursor: Option, diff --git a/core/startos/src/net/wifi.rs b/core/startos/src/net/wifi.rs index 2202f5e57..38d9e3015 100644 --- a/core/startos/src/net/wifi.rs +++ b/core/startos/src/net/wifi.rs @@ -13,6 +13,7 @@ use serde::{Deserialize, Serialize}; use tokio::process::Command; use tokio::sync::RwLock; use tracing::instrument; +use ts_rs::TS; use crate::context::{CliContext, RpcContext}; use crate::prelude::*; @@ -87,9 +88,10 @@ pub fn country() -> ParentHandler { ) } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct AddParams { ssid: String, password: String, @@ -138,9 +140,10 @@ pub async fn add(ctx: RpcContext, AddParams { ssid, password }: AddParams) -> Re } Ok(()) } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct SsidParams { ssid: String, } @@ -402,11 +405,13 @@ pub async fn get_available(ctx: RpcContext, _: Empty) -> Result Ok(wifi_list) } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct SetCountryParams { #[arg(value_parser = CountryCodeParser)] + #[ts(type = "string")] country: CountryCode, } pub async fn set_country( diff --git a/core/startos/src/notifications.rs b/core/startos/src/notifications.rs index e774d912e..8daf42f59 100644 --- a/core/startos/src/notifications.rs +++ b/core/startos/src/notifications.rs @@ -11,6 +11,7 @@ use models::PackageId; use rpc_toolkit::{command, from_fn_async, HandlerExt, ParentHandler}; use serde::{Deserialize, Serialize}; use tracing::instrument; +use ts_rs::TS; use crate::backup::BackupReport; use crate::context::{CliContext, RpcContext}; @@ -48,11 +49,14 @@ pub fn notification() -> ParentHandler { ) } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct ListParams { + #[ts(type = "number | null")] before: Option, + #[ts(type = "number | null")] limit: Option, } // #[command(display(display_serializable))] @@ -110,10 +114,12 @@ pub async fn list( .await } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct DeleteParams { + #[ts(type = "number")] id: u32, } @@ -125,10 +131,12 @@ pub async fn delete(ctx: RpcContext, DeleteParams { id }: DeleteParams) -> Resul }) .await } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct DeleteBeforeParams { + #[ts(type = "number")] before: u32, } @@ -148,9 +156,10 @@ pub async fn delete_before( .await } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct CreateParams { package: Option, level: NotificationLevel, @@ -172,7 +181,7 @@ pub async fn create( .await } -#[derive(Debug, Clone, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)] +#[derive(Debug, Clone, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize, TS)] #[serde(rename_all = "camelCase")] pub enum NotificationLevel { Success, diff --git a/core/startos/src/os_install/mod.rs b/core/startos/src/os_install/mod.rs index 6d55741f4..e35cab617 100644 --- a/core/startos/src/os_install/mod.rs +++ b/core/startos/src/os_install/mod.rs @@ -6,6 +6,7 @@ use models::Error; use rpc_toolkit::{command, from_fn_async, AnyContext, HandlerExt, ParentHandler}; use serde::{Deserialize, Serialize}; use tokio::process::Command; +use ts_rs::TS; use crate::context::config::ServerConfig; use crate::context::{CliContext, InstallContext}; @@ -112,9 +113,10 @@ async fn partition(disk: &mut DiskInfo, overwrite: bool) -> Result Url { url } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct GetParams { + #[ts(type = "string")] url: Url, } diff --git a/core/startos/src/s9pk/rpc.rs b/core/startos/src/s9pk/rpc.rs index 3a98da02b..b3203bd47 100644 --- a/core/startos/src/s9pk/rpc.rs +++ b/core/startos/src/s9pk/rpc.rs @@ -8,6 +8,7 @@ use rpc_toolkit::{from_fn_async, Empty, HandlerExt, ParentHandler}; use serde::{Deserialize, Serialize}; use tokio::fs::File; use tokio::process::Command; +use ts_rs::TS; use crate::context::CliContext; use crate::prelude::*; @@ -67,7 +68,8 @@ fn inspect() -> ParentHandler { ) } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] +#[ts(export)] struct AddImageParams { id: ImageId, image: String, @@ -183,7 +185,8 @@ async fn add_image( Ok(()) } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] +#[ts(export)] struct EditManifestParams { expression: String, } diff --git a/core/startos/src/s9pk/v1/mod.rs b/core/startos/src/s9pk/v1/mod.rs index 2f95f0813..9623d7f36 100644 --- a/core/startos/src/s9pk/v1/mod.rs +++ b/core/startos/src/s9pk/v1/mod.rs @@ -2,6 +2,7 @@ use std::path::PathBuf; use clap::Parser; use serde::{Deserialize, Serialize}; +use ts_rs::TS; pub mod builder; pub mod docker; @@ -12,9 +13,10 @@ pub mod reader; pub const SIG_CONTEXT: &[u8] = b"s9pk"; -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct VerifyParams { pub path: PathBuf, } diff --git a/core/startos/src/service/mod.rs b/core/startos/src/service/mod.rs index a10857c5a..dcac05ce3 100644 --- a/core/startos/src/service/mod.rs +++ b/core/startos/src/service/mod.rs @@ -11,7 +11,9 @@ use rpc_toolkit::{from_fn_async, CallRemoteHandler, Empty, Handler, HandlerArgs} use serde::{Deserialize, Serialize}; use start_stop::StartStop; use tokio::sync::Notify; +use ts_rs::TS; +use crate::action::ActionResult; use crate::config::action::ConfigRes; use crate::context::{CliContext, RpcContext}; use crate::core::rpc_continuations::RequestGuid; @@ -28,8 +30,8 @@ use crate::service::transition::TransitionKind; use crate::status::health_check::HealthCheckResult; use crate::status::MainStatus; use crate::util::actor::{Actor, BackgroundJobs, SimpleActor}; +use crate::util::serde::Pem; use crate::volume::data_dir; -use crate::{action::ActionResult, util::serde::Pem}; pub mod cli; mod config; @@ -498,7 +500,8 @@ impl Actor for ServiceActor { } } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] +#[ts(export)] pub struct ConnectParams { pub id: PackageId, } diff --git a/core/startos/src/service/rpc.rs b/core/startos/src/service/rpc.rs index 6823a7189..65c8b98fe 100644 --- a/core/startos/src/service/rpc.rs +++ b/core/startos/src/service/rpc.rs @@ -4,6 +4,7 @@ use imbl_value::Value; use models::ProcedureName; use rpc_toolkit::yajrc::RpcMethod; use rpc_toolkit::Empty; +use ts_rs::TS; use crate::prelude::*; @@ -43,9 +44,10 @@ impl serde::Serialize for Exit { } } -#[derive(Clone, serde::Deserialize, serde::Serialize)] +#[derive(Clone, serde::Deserialize, serde::Serialize, TS)] pub struct ExecuteParams { procedure: String, + #[ts(type = "any")] input: Value, timeout: Option, } diff --git a/core/startos/src/setup.rs b/core/startos/src/setup.rs index ad76066e8..18c33d423 100644 --- a/core/startos/src/setup.rs +++ b/core/startos/src/setup.rs @@ -14,6 +14,7 @@ use tokio::io::AsyncWriteExt; use tokio::try_join; use torut::onion::OnionAddressV3; use tracing::instrument; +use ts_rs::TS; use crate::account::AccountInfo; use crate::backup::restore::recover_full_embassy; @@ -99,10 +100,11 @@ async fn setup_init( )) } -#[derive(Deserialize, Serialize)] +#[derive(Deserialize, Serialize, TS)] #[serde(rename_all = "camelCase")] +#[ts(export)] pub struct AttachParams { - #[serde(rename = "embassy-password")] + #[serde(rename = "startOsPassword")] password: Option, guid: Arc, } @@ -210,8 +212,9 @@ pub fn cifs() -> ParentHandler { ParentHandler::new().subcommand("verify", from_fn_async(verify_cifs).no_cli()) } -#[derive(Deserialize, Serialize)] +#[derive(Deserialize, Serialize, TS)] #[serde(rename_all = "camelCase")] +#[ts(export)] pub struct VerifyCifsParams { hostname: String, path: PathBuf, @@ -245,7 +248,7 @@ pub async fn verify_cifs( start_os.ok_or_else(|| Error::new(eyre!("No Backup Found"), crate::ErrorKind::NotFound)) } -#[derive(Debug, Deserialize, Serialize)] +#[derive(Debug, Deserialize, Serialize, TS)] #[serde(tag = "type")] #[serde(rename_all = "camelCase")] pub enum RecoverySource { @@ -253,8 +256,9 @@ pub enum RecoverySource { Backup { target: BackupTargetFS }, } -#[derive(Deserialize, Serialize)] +#[derive(Deserialize, Serialize, TS)] #[serde(rename_all = "camelCase")] +#[ts(export)] pub struct ExecuteParams { start_os_logicalname: PathBuf, start_os_password: EncryptedWire, diff --git a/core/startos/src/ssh.rs b/core/startos/src/ssh.rs index aaf941e1f..b7c2fef3c 100644 --- a/core/startos/src/ssh.rs +++ b/core/startos/src/ssh.rs @@ -8,6 +8,7 @@ use imbl_value::InternedString; use rpc_toolkit::{command, from_fn_async, AnyContext, Empty, HandlerExt, ParentHandler}; use serde::{Deserialize, Serialize}; use tracing::instrument; +use ts_rs::TS; use crate::context::{CliContext, RpcContext}; use crate::prelude::*; @@ -34,7 +35,8 @@ impl Map for SshKeys { } } -#[derive(Clone, Debug, Deserialize, Serialize)] +#[derive(Clone, Debug, Deserialize, Serialize, TS)] +#[ts(type = "string")] pub struct SshPubKey( #[serde(serialize_with = "crate::util::serde::serialize_display")] #[serde(deserialize_with = "crate::util::serde::deserialize_from_str")] @@ -102,9 +104,10 @@ pub fn ssh() -> ParentHandler { ) } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct AddParams { key: SshPubKey, } @@ -135,10 +138,12 @@ pub async fn add(ctx: RpcContext, AddParams { key }: AddParams) -> Result Result<(), Error> { Ok(()) } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct ZramParams { enable: bool, } @@ -135,9 +137,10 @@ fn display_governor_info(params: WithIoFormat, result: GovernorI table.print_tty(false).unwrap(); } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct GovernorParams { set: Option, } @@ -229,11 +232,13 @@ pub async fn time(ctx: RpcContext, _: Empty) -> Result { uptime: ctx.start_time.elapsed().as_secs(), }) } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct LogsParams { #[arg(short = 'l', long = "limit")] + #[ts(type = "number | null")] limit: Option, #[arg(short = 'c', long = "cursor")] cursor: Option, @@ -313,11 +318,13 @@ pub async fn logs_follow( ) -> Result { follow_logs(ctx, LogSource::System, limit).await } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct KernelLogsParams { #[arg(short = 'l', long = "limit")] + #[ts(type = "number | null")] limit: Option, #[arg(short = 'c', long = "cursor")] cursor: Option, diff --git a/core/startos/src/update/mod.rs b/core/startos/src/update/mod.rs index 26bf0357d..beb756179 100644 --- a/core/startos/src/update/mod.rs +++ b/core/startos/src/update/mod.rs @@ -12,6 +12,7 @@ use serde::{Deserialize, Serialize}; use tokio::process::Command; use tokio_stream::StreamExt; use tracing::instrument; +use ts_rs::TS; use crate::context::RpcContext; use crate::db::model::public::UpdateProgress; @@ -34,10 +35,12 @@ lazy_static! { static ref UPDATED: AtomicBool = AtomicBool::new(false); } -#[derive(Deserialize, Serialize, Parser)] +#[derive(Deserialize, Serialize, Parser, TS)] #[serde(rename_all = "camelCase")] #[command(rename_all = "kebab-case")] +#[ts(export)] pub struct UpdateSystemParams { + #[ts(type = "string")] marketplace_url: Url, } diff --git a/core/startos/src/util/crypto.rs b/core/startos/src/util/crypto.rs index aaafe6536..bb164b6ad 100644 --- a/core/startos/src/util/crypto.rs +++ b/core/startos/src/util/crypto.rs @@ -15,6 +15,9 @@ use josekit::jwk::Jwk; use serde::{Deserialize, Serialize}; use sha2::Sha256; use tracing::instrument; +use ts_rs::TS; + +use crate::prelude::*; pub fn pbkdf2(password: impl AsRef<[u8]>, salt: impl AsRef<[u8]>) -> CipherKey { let mut aeskey = CipherKey::::default(); @@ -53,9 +56,11 @@ pub fn decrypt_slice(input: impl AsRef<[u8]>, password: impl AsRef<[u8]>) -> Vec res } -#[derive(Debug, Clone, Deserialize, Serialize)] +#[derive(Debug, Clone, Deserialize, Serialize, TS)] +#[ts(export)] pub struct EncryptedWire { - encrypted: serde_json::Value, + #[ts(type = "any")] + encrypted: Value, } impl EncryptedWire { #[instrument(skip_all)] diff --git a/core/startos/src/util/serde.rs b/core/startos/src/util/serde.rs index 2fa992abd..5b1e660b5 100644 --- a/core/startos/src/util/serde.rs +++ b/core/startos/src/util/serde.rs @@ -580,7 +580,7 @@ where } } -#[derive(Deserialize, Serialize)] +#[derive(Deserialize, Serialize, TS)] pub struct StdinDeserializable(pub T); impl FromArgMatches for StdinDeserializable where