update types and format bindings

This commit is contained in:
Aiden McClelland
2024-03-28 11:20:20 -06:00
parent 65ca038eee
commit 86d61d698a
101 changed files with 457 additions and 139 deletions

View File

@@ -176,11 +176,12 @@ container-runtime/node_modules: container-runtime/package.json container-runtime
core/startos/bindings: $(shell git ls-files core) $(ENVIRONMENT_FILE) $(PLATFORM_FILE) core/startos/bindings: $(shell git ls-files core) $(ENVIRONMENT_FILE) $(PLATFORM_FILE)
rm -rf core/startos/bindings rm -rf core/startos/bindings
(cd core/ && cargo test) (cd core/ && cargo test)
npm --prefix sdk exec -- prettier -w ./core/startos/bindings/*.ts
sdk/lib/test: $(shell git ls-files sdk) core/startos/bindings sdk/lib/test: $(shell git ls-files sdk) core/startos/bindings
(cd sdk && make test) (cd sdk && make test)
sdk/dist: $(shell git ls-files sdk) sdk/dist: $(shell git ls-files sdk) core/startos/bindings
(cd sdk && make bundle) (cd sdk && make bundle)
container-runtime/dist: container-runtime/node_modules $(shell git ls-files container-runtime/src) container-runtime/package.json container-runtime/tsconfig.json container-runtime/dist: container-runtime/node_modules $(shell git ls-files container-runtime/src) container-runtime/package.json container-runtime/tsconfig.json

View File

@@ -112,8 +112,9 @@ export class MainLoop {
]) ])
if (executed.exitCode === 59) { if (executed.exitCode === 59) {
await effects.setHealth({ await effects.setHealth({
name: healthId, id: healthId,
status: "disabled", name: value.name,
result: "disabled",
message: message:
executed.stderr.toString() || executed.stdout.toString(), executed.stderr.toString() || executed.stdout.toString(),
}) })
@@ -121,8 +122,9 @@ export class MainLoop {
} }
if (executed.exitCode === 60) { if (executed.exitCode === 60) {
await effects.setHealth({ await effects.setHealth({
name: healthId, id: healthId,
status: "starting", name: value.name,
result: "starting",
message: message:
executed.stderr.toString() || executed.stdout.toString(), executed.stderr.toString() || executed.stdout.toString(),
}) })
@@ -130,8 +132,9 @@ export class MainLoop {
} }
if (executed.exitCode === 61) { if (executed.exitCode === 61) {
await effects.setHealth({ await effects.setHealth({
name: healthId, id: healthId,
status: "warning", name: value.name,
result: "loading",
message: message:
executed.stderr.toString() || executed.stdout.toString(), executed.stderr.toString() || executed.stdout.toString(),
}) })
@@ -141,15 +144,17 @@ export class MainLoop {
const message = executed.stdout.toString() const message = executed.stdout.toString()
if (!!errorMessage) { if (!!errorMessage) {
await effects.setHealth({ await effects.setHealth({
name: healthId, id: healthId,
status: "failure", name: value.name,
result: "failure",
message: errorMessage, message: errorMessage,
}) })
return return
} }
await effects.setHealth({ await effects.setHealth({
name: healthId, id: healthId,
status: "passing", name: value.name,
result: "success",
message, message,
}) })
return return
@@ -159,8 +164,9 @@ export class MainLoop {
const method = moduleCode.health?.[healthId] const method = moduleCode.health?.[healthId]
if (!method) { if (!method) {
await effects.setHealth({ await effects.setHealth({
name: healthId, id: healthId,
status: "failure", name: value.name,
result: "failure",
message: `Expecting that the js health check ${healthId} exists`, message: `Expecting that the js health check ${healthId} exists`,
}) })
return return
@@ -173,24 +179,27 @@ export class MainLoop {
if ("result" in result) { if ("result" in result) {
await effects.setHealth({ await effects.setHealth({
id: healthId,
name: value.name,
result: "success",
message: null, message: null,
name: healthId,
status: "passing",
}) })
return return
} }
if ("error" in result) { if ("error" in result) {
await effects.setHealth({ await effects.setHealth({
name: healthId, id: healthId,
status: "failure", name: value.name,
result: "failure",
message: result.error, message: result.error,
}) })
return return
} }
if (!("error-code" in result)) { if (!("error-code" in result)) {
await effects.setHealth({ await effects.setHealth({
name: healthId, id: healthId,
status: "failure", name: value.name,
result: "failure",
message: `Unknown error type ${JSON.stringify(result)}`, message: `Unknown error type ${JSON.stringify(result)}`,
}) })
return return
@@ -198,32 +207,36 @@ export class MainLoop {
const [code, message] = result["error-code"] const [code, message] = result["error-code"]
if (code === 59) { if (code === 59) {
await effects.setHealth({ await effects.setHealth({
name: healthId, id: healthId,
status: "disabled", name: value.name,
result: "disabled",
message, message,
}) })
return return
} }
if (code === 60) { if (code === 60) {
await effects.setHealth({ await effects.setHealth({
name: healthId, id: healthId,
status: "starting", name: value.name,
result: "starting",
message, message,
}) })
return return
} }
if (code === 61) { if (code === 61) {
await effects.setHealth({ await effects.setHealth({
name: healthId, id: healthId,
status: "warning", name: value.name,
result: "loading",
message, message,
}) })
return return
} }
await effects.setHealth({ await effects.setHealth({
name: healthId, id: healthId,
status: "failure", name: value.name,
result: "failure",
message: `${result["error-code"][0]}: ${result["error-code"][1]}`, message: `${result["error-code"][0]}: ${result["error-code"][1]}`,
}) })
return return

View File

@@ -1,4 +1,12 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { AllowedStatuses } from "./AllowedStatuses"; import type { AllowedStatuses } from "./AllowedStatuses";
export type ActionMetadata = { name: string, description: string, warning: string | null, input: any, disabled: boolean, allowedStatuses: AllowedStatuses, group: string | null, }; export type ActionMetadata = {
name: string;
description: string;
warning: string | null;
input: any;
disabled: boolean;
allowedStatuses: AllowedStatuses;
group: string | null;
};

View File

@@ -1,4 +1,8 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { AlpnInfo } from "./AlpnInfo"; import type { AlpnInfo } from "./AlpnInfo";
export type AddSslOptions = { scheme: string | null, preferredExternalPort: number, alpn: AlpnInfo, }; export type AddSslOptions = {
scheme: string | null;
preferredExternalPort: number;
alpn: AlpnInfo;
};

View File

@@ -2,4 +2,9 @@
import type { BindOptions } from "./BindOptions"; import type { BindOptions } from "./BindOptions";
import type { HostId } from "./HostId"; import type { HostId } from "./HostId";
export type AddressInfo = { username: string | null, hostId: HostId, bindOptions: BindOptions, suffix: string, }; export type AddressInfo = {
username: string | null;
hostId: HostId;
bindOptions: BindOptions;
suffix: string;
};

View File

@@ -1,3 +1,9 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type Alerts = { install: string | null, uninstall: string | null, restore: string | null, start: string | null, stop: string | null, }; export type Alerts = {
install: string | null;
uninstall: string | null;
restore: string | null;
start: string | null;
stop: string | null;
};

View File

@@ -1,4 +1,4 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { MaybeUtf8String } from "./MaybeUtf8String"; import type { MaybeUtf8String } from "./MaybeUtf8String";
export type AlpnInfo = "reflect" | { "specified": Array<MaybeUtf8String> }; export type AlpnInfo = "reflect" | { specified: Array<MaybeUtf8String> };

View File

@@ -1,3 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type BackupProgress = { complete: boolean, }; export type BackupProgress = { complete: boolean };

View File

@@ -1,4 +1,4 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { BindOptions } from "./BindOptions"; import type { BindOptions } from "./BindOptions";
export type BindInfo = { options: BindOptions, assignedLanPort: number | null, }; export type BindInfo = { options: BindOptions; assignedLanPort: number | null };

View File

@@ -2,4 +2,9 @@
import type { AddSslOptions } from "./AddSslOptions"; import type { AddSslOptions } from "./AddSslOptions";
import type { Security } from "./Security"; import type { Security } from "./Security";
export type BindOptions = { scheme: string | null, preferredExternalPort: number, addSsl: AddSslOptions | null, secure: Security | null, }; export type BindOptions = {
scheme: string | null;
preferredExternalPort: number;
addSsl: AddSslOptions | null;
secure: Security | null;
};

View File

@@ -4,4 +4,12 @@ import type { HostId } from "./HostId";
import type { HostKind } from "./HostKind"; import type { HostKind } from "./HostKind";
import type { Security } from "./Security"; import type { Security } from "./Security";
export type BindParams = { kind: HostKind, id: HostId, internalPort: number, scheme: string | null, preferredExternalPort: number, addSsl: AddSslOptions | null, secure: Security | null, }; export type BindParams = {
kind: HostKind;
id: HostId;
internalPort: number;
scheme: string | null;
preferredExternalPort: number;
addSsl: AddSslOptions | null;
secure: Security | null;
};

View File

@@ -1,3 +1,10 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type ChrootParams = { env: string | null, workdir: string | null, user: string | null, path: string, command: string, args: string[], }; export type ChrootParams = {
env: string | null;
workdir: string | null;
user: string | null;
path: string;
command: string;
args: string[];
};

View File

@@ -1,3 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type CreateOverlayedImageParams = { imageId: string, }; export type CreateOverlayedImageParams = { imageId: string };

View File

@@ -1,4 +1,9 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { DataUrl } from "./DataUrl"; import type { DataUrl } from "./DataUrl";
export type CurrentDependencyInfo = { title: string, icon: DataUrl, registryUrl: string, versionSpec: string, } & ({ "kind": "exists" } | { "kind": "running", healthChecks: string[], }); export type CurrentDependencyInfo = {
title: string;
icon: DataUrl;
registryUrl: string;
versionSpec: string;
} & ({ kind: "exists" } | { kind: "running"; healthChecks: string[] });

View File

@@ -1,3 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type DepInfo = { description: string | null, optional: boolean, }; export type DepInfo = { description: string | null; optional: boolean };

View File

@@ -1,3 +1,11 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type DependencyRequirement = { "kind": "running", id: string, healthChecks: string[], versionSpec: string, registryUrl: string, } | { "kind": "exists", id: string, versionSpec: string, registryUrl: string, }; export type DependencyRequirement =
| {
kind: "running";
id: string;
healthChecks: string[];
versionSpec: string;
registryUrl: string;
}
| { kind: "exists"; id: string; versionSpec: string; registryUrl: string };

View File

@@ -1,3 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type Description = { short: string, long: string, }; export type Description = { short: string; long: string };

View File

@@ -1,3 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type DestroyOverlayedImageParams = { guid: string, }; export type DestroyOverlayedImageParams = { guid: string };

View File

@@ -1,3 +1,7 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type ExecuteAction = { serviceId: string | null, actionId: string, input: any, }; export type ExecuteAction = {
serviceId: string | null;
actionId: string;
input: any;
};

View File

@@ -1,4 +1,4 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { ActionMetadata } from "./ActionMetadata"; import type { ActionMetadata } from "./ActionMetadata";
export type ExportActionParams = { id: string, metadata: ActionMetadata, }; export type ExportActionParams = { id: string; metadata: ActionMetadata };

View File

@@ -2,4 +2,13 @@
import type { AddressInfo } from "./AddressInfo"; import type { AddressInfo } from "./AddressInfo";
import type { ServiceInterfaceType } from "./ServiceInterfaceType"; import type { ServiceInterfaceType } from "./ServiceInterfaceType";
export type ExportServiceInterfaceParams = { id: string, name: string, description: string, hasPrimary: boolean, disabled: boolean, masked: boolean, addressInfo: AddressInfo, type: ServiceInterfaceType, }; export type ExportServiceInterfaceParams = {
id: string;
name: string;
description: string;
hasPrimary: boolean;
disabled: boolean;
masked: boolean;
addressInfo: AddressInfo;
type: ServiceInterfaceType;
};

View File

@@ -3,4 +3,8 @@ import type { ExportedHostnameInfo } from "./ExportedHostnameInfo";
import type { HostId } from "./HostId"; import type { HostId } from "./HostId";
import type { HostKind } from "./HostKind"; import type { HostKind } from "./HostKind";
export type ExportedHostInfo = { id: HostId, kind: HostKind, hostnames: Array<ExportedHostnameInfo>, }; export type ExportedHostInfo = {
id: HostId;
kind: HostKind;
hostnames: Array<ExportedHostnameInfo>;
};

View File

@@ -2,4 +2,11 @@
import type { ExportedIpHostname } from "./ExportedIpHostname"; import type { ExportedIpHostname } from "./ExportedIpHostname";
import type { ExportedOnionHostname } from "./ExportedOnionHostname"; import type { ExportedOnionHostname } from "./ExportedOnionHostname";
export type ExportedHostnameInfo = { "kind": "ip", networkInterfaceId: string, public: boolean, hostname: ExportedIpHostname, } | { "kind": "onion", hostname: ExportedOnionHostname, }; export type ExportedHostnameInfo =
| {
kind: "ip";
networkInterfaceId: string;
public: boolean;
hostname: ExportedIpHostname;
}
| { kind: "onion"; hostname: ExportedOnionHostname };

View File

@@ -1,3 +1,18 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type ExportedIpHostname = { "kind": "ipv4", value: string, port: number | null, sslPort: number | null, } | { "kind": "ipv6", value: string, port: number | null, sslPort: number | null, } | { "kind": "local", value: string, port: number | null, sslPort: number | null, } | { "kind": "domain", domain: string, subdomain: string | null, port: number | null, sslPort: number | null, }; export type ExportedIpHostname =
| { kind: "ipv4"; value: string; port: number | null; sslPort: number | null }
| { kind: "ipv6"; value: string; port: number | null; sslPort: number | null }
| {
kind: "local";
value: string;
port: number | null;
sslPort: number | null;
}
| {
kind: "domain";
domain: string;
subdomain: string | null;
port: number | null;
sslPort: number | null;
};

View File

@@ -1,3 +1,7 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type ExportedOnionHostname = { value: string, port: number | null, sslPort: number | null, }; export type ExportedOnionHostname = {
value: string;
port: number | null;
sslPort: number | null;
};

View File

@@ -1,3 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type ExposeForDependentsParams = { paths: string[], }; export type ExposeForDependentsParams = { paths: string[] };

View File

@@ -2,4 +2,4 @@
import type { NamedProgress } from "./NamedProgress"; import type { NamedProgress } from "./NamedProgress";
import type { Progress } from "./Progress"; import type { Progress } from "./Progress";
export type FullProgress = { overall: Progress, phases: Array<NamedProgress>, }; export type FullProgress = { overall: Progress; phases: Array<NamedProgress> };

View File

@@ -2,4 +2,9 @@
import type { Callback } from "./Callback"; import type { Callback } from "./Callback";
import type { GetHostInfoParamsKind } from "./GetHostInfoParamsKind"; import type { GetHostInfoParamsKind } from "./GetHostInfoParamsKind";
export type GetHostInfoParams = { kind: GetHostInfoParamsKind | null, serviceInterfaceId: string, packageId: string | null, callback: Callback, }; export type GetHostInfoParams = {
kind: GetHostInfoParamsKind | null;
serviceInterfaceId: string;
packageId: string | null;
callback: Callback;
};

View File

@@ -1,4 +1,8 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { Callback } from "./Callback"; import type { Callback } from "./Callback";
export type GetPrimaryUrlParams = { packageId: string | null, serviceInterfaceId: string, callback: Callback, }; export type GetPrimaryUrlParams = {
packageId: string | null;
serviceInterfaceId: string;
callback: Callback;
};

View File

@@ -1,4 +1,8 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { Callback } from "./Callback"; import type { Callback } from "./Callback";
export type GetServiceInterfaceParams = { packageId: string | null, serviceInterfaceId: string, callback: Callback, }; export type GetServiceInterfaceParams = {
packageId: string | null;
serviceInterfaceId: string;
callback: Callback;
};

View File

@@ -1,3 +1,6 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type GetServicePortForwardParams = { packageId: string | null, internalPort: number, }; export type GetServicePortForwardParams = {
packageId: string | null;
internalPort: number;
};

View File

@@ -1,4 +1,8 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { Algorithm } from "./Algorithm"; import type { Algorithm } from "./Algorithm";
export type GetSslCertificateParams = { packageId: string | null, hostId: string, algorithm: Algorithm | null, }; export type GetSslCertificateParams = {
packageId: string | null;
hostId: string;
algorithm: Algorithm | null;
};

View File

@@ -1,4 +1,8 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { Algorithm } from "./Algorithm"; import type { Algorithm } from "./Algorithm";
export type GetSslKeyParams = { packageId: string | null, hostId: string, algorithm: Algorithm | null, }; export type GetSslKeyParams = {
packageId: string | null;
hostId: string;
algorithm: Algorithm | null;
};

View File

@@ -1,3 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type GetStoreParams = { packageId: string | null, path: string, }; export type GetStoreParams = { packageId: string | null; path: string };

View File

@@ -1,4 +1,4 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { Callback } from "./Callback"; import type { Callback } from "./Callback";
export type GetSystemSmtpParams = { callback: Callback, }; export type GetSystemSmtpParams = { callback: Callback };

View File

@@ -1,3 +1,7 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type HardwareRequirements = { device: { [key: string]: string }, ram: bigint | null, arch: Array<string> | null, }; export type HardwareRequirements = {
device: { [key: string]: string };
ram: bigint | null;
arch: Array<string> | null;
};

View File

@@ -1,3 +1,9 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type HealthCheckResult = { name: string, } & ({ "result": "success", message: string, } | { "result": "disabled" } | { "result": "starting" } | { "result": "loading", message: string, } | { "result": "failure", message: string, }); export type HealthCheckResult = { name: string } & (
| { result: "success"; message: string | null }
| { result: "disabled"; message: string | null }
| { result: "starting"; message: string | null }
| { result: "loading"; message: string }
| { result: "failure"; message: string }
);

View File

@@ -3,4 +3,9 @@ import type { BindInfo } from "./BindInfo";
import type { HostAddress } from "./HostAddress"; import type { HostAddress } from "./HostAddress";
import type { HostKind } from "./HostKind"; import type { HostKind } from "./HostKind";
export type Host = { kind: HostKind, bindings: { [key: number]: BindInfo }, addresses: Array<HostAddress>, primary: HostAddress | null, }; export type Host = {
kind: HostKind;
bindings: { [key: number]: BindInfo };
addresses: Array<HostAddress>;
primary: HostAddress | null;
};

View File

@@ -1,3 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type HostAddress = { "kind": "onion", address: string, }; export type HostAddress = { kind: "onion"; address: string };

View File

@@ -1,4 +1,4 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { Manifest } from "./Manifest"; import type { Manifest } from "./Manifest";
export type InstalledState = { manifest: Manifest, }; export type InstalledState = { manifest: Manifest };

View File

@@ -2,4 +2,4 @@
import type { FullProgress } from "./FullProgress"; import type { FullProgress } from "./FullProgress";
import type { Manifest } from "./Manifest"; import type { Manifest } from "./Manifest";
export type InstallingInfo = { newManifest: Manifest, progress: FullProgress, }; export type InstallingInfo = { newManifest: Manifest; progress: FullProgress };

View File

@@ -1,4 +1,4 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { InstallingInfo } from "./InstallingInfo"; import type { InstallingInfo } from "./InstallingInfo";
export type InstallingState = { installingInfo: InstallingInfo, }; export type InstallingState = { installingInfo: InstallingInfo };

View File

@@ -1,3 +1,8 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type IpInfo = { ipv4Range: string | null, ipv4: string | null, ipv6Range: string | null, ipv6: string | null, }; export type IpInfo = {
ipv4Range: string | null;
ipv4: string | null;
ipv6Range: string | null;
ipv6: string | null;
};

View File

@@ -1,4 +1,7 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { Callback } from "./Callback"; import type { Callback } from "./Callback";
export type ListServiceInterfacesParams = { packageId: string | null, callback: Callback, }; export type ListServiceInterfacesParams = {
packageId: string | null;
callback: Callback;
};

View File

@@ -3,4 +3,18 @@ import type { Duration } from "./Duration";
import type { HealthCheckId } from "./HealthCheckId"; import type { HealthCheckId } from "./HealthCheckId";
import type { HealthCheckResult } from "./HealthCheckResult"; import type { HealthCheckResult } from "./HealthCheckResult";
export type MainStatus = { "status": "stopped" } | { "status": "restarting" } | { "status": "stopping", timeout: Duration, } | { "status": "starting" } | { "status": "running", started: string, health: { [key: HealthCheckId]: HealthCheckResult }, } | { "status": "backingUp", started: string | null, health: { [key: HealthCheckId]: HealthCheckResult }, }; export type MainStatus =
| { status: "stopped" }
| { status: "restarting" }
| { status: "stopping"; timeout: Duration }
| { status: "starting" }
| {
status: "running";
started: string;
health: { [key: HealthCheckId]: HealthCheckResult };
}
| {
status: "backingUp";
started: string | null;
health: { [key: HealthCheckId]: HealthCheckResult };
};

View File

@@ -7,4 +7,26 @@ import type { ImageId } from "./ImageId";
import type { PackageId } from "./PackageId"; import type { PackageId } from "./PackageId";
import type { VolumeId } from "./VolumeId"; import type { VolumeId } from "./VolumeId";
export type Manifest = { id: PackageId, title: string, version: string, releaseNotes: string, license: string, replaces: Array<string>, wrapperRepo: string, upstreamRepo: string, supportSite: string, marketingSite: string, donationUrl: string | null, description: Description, images: Array<ImageId>, assets: Array<VolumeId>, volumes: Array<VolumeId>, alerts: Alerts, dependencies: Dependencies, hardwareRequirements: HardwareRequirements, gitHash: string | null, osVersion: string, hasConfig: boolean, }; export type Manifest = {
id: PackageId;
title: string;
version: string;
releaseNotes: string;
license: string;
replaces: Array<string>;
wrapperRepo: string;
upstreamRepo: string;
supportSite: string;
marketingSite: string;
donationUrl: string | null;
description: Description;
images: Array<ImageId>;
assets: Array<VolumeId>;
volumes: Array<VolumeId>;
alerts: Alerts;
dependencies: Dependencies;
hardwareRequirements: HardwareRequirements;
gitHash: string | null;
osVersion: string;
hasConfig: boolean;
};

View File

@@ -1,4 +1,4 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { MountTarget } from "./MountTarget"; import type { MountTarget } from "./MountTarget";
export type MountParams = { location: string, target: MountTarget, }; export type MountParams = { location: string; target: MountTarget };

View File

@@ -1,3 +1,8 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type MountTarget = { packageId: string, volumeId: string, subpath: string | null, readonly: boolean, }; export type MountTarget = {
packageId: string;
volumeId: string;
subpath: string | null;
readonly: boolean;
};

View File

@@ -1,4 +1,4 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { Progress } from "./Progress"; import type { Progress } from "./Progress";
export type NamedProgress = { name: string, progress: Progress, }; export type NamedProgress = { name: string; progress: Progress };

View File

@@ -9,4 +9,18 @@ import type { ServiceInterfaceId } from "./ServiceInterfaceId";
import type { ServiceInterfaceWithHostInfo } from "./ServiceInterfaceWithHostInfo"; import type { ServiceInterfaceWithHostInfo } from "./ServiceInterfaceWithHostInfo";
import type { Status } from "./Status"; import type { Status } from "./Status";
export type PackageDataEntry = { stateInfo: PackageState, status: Status, marketplaceUrl: string | null, developerKey: string, icon: DataUrl, lastBackup: string | null, currentDependencies: CurrentDependencies, actions: { [key: ActionId]: ActionMetadata }, serviceInterfaces: { [key: ServiceInterfaceId]: ServiceInterfaceWithHostInfo }, hosts: HostInfo, storeExposedDependents: string[], }; export type PackageDataEntry = {
stateInfo: PackageState;
status: Status;
marketplaceUrl: string | null;
developerKey: string;
icon: DataUrl;
lastBackup: string | null;
currentDependencies: CurrentDependencies;
actions: { [key: ActionId]: ActionMetadata };
serviceInterfaces: {
[key: ServiceInterfaceId]: ServiceInterfaceWithHostInfo;
};
hosts: HostInfo;
storeExposedDependents: string[];
};

View File

@@ -3,4 +3,9 @@ import type { InstalledState } from "./InstalledState";
import type { InstallingState } from "./InstallingState"; import type { InstallingState } from "./InstallingState";
import type { UpdatingState } from "./UpdatingState"; import type { UpdatingState } from "./UpdatingState";
export type PackageState = { "state": "installing" } & InstallingState | { "state": "restoring" } & InstallingState | { "state": "updating" } & UpdatingState | { "state": "installed" } & InstalledState | { "state": "removing" } & InstalledState; export type PackageState =
| ({ state: "installing" } & InstallingState)
| ({ state: "restoring" } & InstallingState)
| ({ state: "updating" } & UpdatingState)
| ({ state: "installed" } & InstalledState)
| ({ state: "removing" } & InstalledState);

View File

@@ -1,3 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type ParamsMaybePackageId = { packageId: string | null, }; export type ParamsMaybePackageId = { packageId: string | null };

View File

@@ -1,3 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type ParamsPackageId = { packageId: string, }; export type ParamsPackageId = { packageId: string };

View File

@@ -1,3 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type Progress = boolean | { done: number, total: number | null, }; export type Progress = boolean | { done: number; total: number | null };

View File

@@ -2,4 +2,8 @@
import type { AllPackageData } from "./AllPackageData"; import type { AllPackageData } from "./AllPackageData";
import type { ServerInfo } from "./ServerInfo"; import type { ServerInfo } from "./ServerInfo";
export type Public = { serverInfo: ServerInfo, packageData: AllPackageData, ui: any, }; export type Public = {
serverInfo: ServerInfo;
packageData: AllPackageData;
ui: any;
};

View File

@@ -1,3 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type RemoveActionParams = { id: string, }; export type RemoveActionParams = { id: string };

View File

@@ -1,3 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type RemoveAddressParams = { id: string, }; export type RemoveAddressParams = { id: string };

View File

@@ -1,3 +1,7 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type ReverseProxyBind = { ip: string | null, port: number, ssl: boolean, }; export type ReverseProxyBind = {
ip: string | null;
port: number;
ssl: boolean;
};

View File

@@ -1,3 +1,7 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type ReverseProxyDestination = { ip: string | null, port: number, ssl: boolean, }; export type ReverseProxyDestination = {
ip: string | null;
port: number;
ssl: boolean;
};

View File

@@ -1,3 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type ReverseProxyHttp = { headers: null | {[key: string]: string}, }; export type ReverseProxyHttp = { headers: null | { [key: string]: string } };

View File

@@ -3,4 +3,8 @@ import type { ReverseProxyBind } from "./ReverseProxyBind";
import type { ReverseProxyDestination } from "./ReverseProxyDestination"; import type { ReverseProxyDestination } from "./ReverseProxyDestination";
import type { ReverseProxyHttp } from "./ReverseProxyHttp"; import type { ReverseProxyHttp } from "./ReverseProxyHttp";
export type ReverseProxyParams = { bind: ReverseProxyBind, dst: ReverseProxyDestination, http: ReverseProxyHttp, }; export type ReverseProxyParams = {
bind: ReverseProxyBind;
dst: ReverseProxyDestination;
http: ReverseProxyHttp;
};

View File

@@ -1,3 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type Security = { ssl: boolean, }; export type Security = { ssl: boolean };

View File

@@ -4,12 +4,32 @@ import type { IpInfo } from "./IpInfo";
import type { ServerStatus } from "./ServerStatus"; import type { ServerStatus } from "./ServerStatus";
import type { WifiInfo } from "./WifiInfo"; import type { WifiInfo } from "./WifiInfo";
export type ServerInfo = { arch: string, platform: string, id: string, hostname: string, version: string, lastBackup: string | null, export type ServerInfo = {
arch: string;
platform: string;
id: string;
hostname: string;
version: string;
lastBackup: string | null;
/** /**
* Used in the wifi to determine the region to set the system to * Used in the wifi to determine the region to set the system to
*/ */
lastWifiRegion: string | null, eosVersionCompat: string, lanAddress: string, onionAddress: string, lastWifiRegion: string | null;
eosVersionCompat: string;
lanAddress: string;
onionAddress: string;
/** /**
* for backwards compatibility * for backwards compatibility
*/ */
torAddress: string, ipInfo: { [key: string]: IpInfo }, statusInfo: ServerStatus, wifi: WifiInfo, unreadNotificationCount: number, passwordHash: string, pubkey: string, caFingerprint: string, ntpSynced: boolean, zram: boolean, governor: Governor | null, }; torAddress: string;
ipInfo: { [key: string]: IpInfo };
statusInfo: ServerStatus;
wifi: WifiInfo;
unreadNotificationCount: number;
passwordHash: string;
pubkey: string;
caFingerprint: string;
ntpSynced: boolean;
zram: boolean;
governor: Governor | null;
};

View File

@@ -1,3 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type ServerSpecs = { cpu: string, disk: string, memory: string, }; export type ServerSpecs = { cpu: string; disk: string; memory: string };

View File

@@ -3,4 +3,10 @@ import type { BackupProgress } from "./BackupProgress";
import type { PackageId } from "./PackageId"; import type { PackageId } from "./PackageId";
import type { UpdateProgress } from "./UpdateProgress"; import type { UpdateProgress } from "./UpdateProgress";
export type ServerStatus = { backupProgress: { [key: PackageId]: BackupProgress } | null, updated: boolean, updateProgress: UpdateProgress | null, shuttingDown: boolean, restarting: boolean, }; export type ServerStatus = {
backupProgress: { [key: PackageId]: BackupProgress } | null;
updated: boolean;
updateProgress: UpdateProgress | null;
shuttingDown: boolean;
restarting: boolean;
};

View File

@@ -3,4 +3,13 @@ import type { AddressInfo } from "./AddressInfo";
import type { ServiceInterfaceId } from "./ServiceInterfaceId"; import type { ServiceInterfaceId } from "./ServiceInterfaceId";
import type { ServiceInterfaceType } from "./ServiceInterfaceType"; import type { ServiceInterfaceType } from "./ServiceInterfaceType";
export type ServiceInterface = { id: ServiceInterfaceId, name: string, description: string, hasPrimary: boolean, disabled: boolean, masked: boolean, addressInfo: AddressInfo, type: ServiceInterfaceType, }; export type ServiceInterface = {
id: ServiceInterfaceId;
name: string;
description: string;
hasPrimary: boolean;
disabled: boolean;
masked: boolean;
addressInfo: AddressInfo;
type: ServiceInterfaceType;
};

View File

@@ -4,4 +4,14 @@ import type { ExportedHostInfo } from "./ExportedHostInfo";
import type { ServiceInterfaceId } from "./ServiceInterfaceId"; import type { ServiceInterfaceId } from "./ServiceInterfaceId";
import type { ServiceInterfaceType } from "./ServiceInterfaceType"; import type { ServiceInterfaceType } from "./ServiceInterfaceType";
export type ServiceInterfaceWithHostInfo = { hostInfo: ExportedHostInfo, id: ServiceInterfaceId, name: string, description: string, hasPrimary: boolean, disabled: boolean, masked: boolean, addressInfo: AddressInfo, type: ServiceInterfaceType, }; export type ServiceInterfaceWithHostInfo = {
hostInfo: ExportedHostInfo;
id: ServiceInterfaceId;
name: string;
description: string;
hasPrimary: boolean;
disabled: boolean;
masked: boolean;
addressInfo: AddressInfo;
type: ServiceInterfaceType;
};

View File

@@ -1,3 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type SetConfigured = { configured: boolean, }; export type SetConfigured = { configured: boolean };

View File

@@ -1,4 +1,6 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { DependencyRequirement } from "./DependencyRequirement"; import type { DependencyRequirement } from "./DependencyRequirement";
export type SetDependenciesParams = { dependencies: Array<DependencyRequirement>, }; export type SetDependenciesParams = {
dependencies: Array<DependencyRequirement>;
};

View File

@@ -1,4 +1,10 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { HealthCheckId } from "./HealthCheckId"; import type { HealthCheckId } from "./HealthCheckId";
export type SetHealth = { id: HealthCheckId, name: string, } & ({ "result": "success", message: string, } | { "result": "disabled" } | { "result": "starting" } | { "result": "loading", message: string, } | { "result": "failure", message: string, }); export type SetHealth = { id: HealthCheckId; name: string } & (
| { result: "success"; message: string | null }
| { result: "disabled"; message: string | null }
| { result: "starting"; message: string | null }
| { result: "loading"; message: string }
| { result: "failure"; message: string }
);

View File

@@ -1,4 +1,4 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { Status } from "./Status"; import type { Status } from "./Status";
export type SetMainStatus = { status: Status, }; export type SetMainStatus = { status: Status };

View File

@@ -1,3 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type SetStoreParams = { value: any, path: string, }; export type SetStoreParams = { value: any; path: string };

View File

@@ -2,4 +2,8 @@
import type { DependencyConfigErrors } from "./DependencyConfigErrors"; import type { DependencyConfigErrors } from "./DependencyConfigErrors";
import type { MainStatus } from "./MainStatus"; import type { MainStatus } from "./MainStatus";
export type Status = { configured: boolean, main: MainStatus, dependencyConfigErrors: DependencyConfigErrors, }; export type Status = {
configured: boolean;
main: MainStatus;
dependencyConfigErrors: DependencyConfigErrors;
};

View File

@@ -1,3 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type UpdateProgress = { size: number | null, downloaded: number, }; export type UpdateProgress = { size: number | null; downloaded: number };

View File

@@ -2,4 +2,7 @@
import type { InstallingInfo } from "./InstallingInfo"; import type { InstallingInfo } from "./InstallingInfo";
import type { Manifest } from "./Manifest"; import type { Manifest } from "./Manifest";
export type UpdatingState = { manifest: Manifest, installingInfo: InstallingInfo, }; export type UpdatingState = {
manifest: Manifest;
installingInfo: InstallingInfo;
};

View File

@@ -1,3 +1,7 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type WifiInfo = { ssids: Array<string>, selected: string | null, connected: string | null, }; export type WifiInfo = {
ssids: Array<string>;
selected: string | null;
connected: string | null;
};

View File

@@ -14,9 +14,9 @@ pub struct HealthCheckResult {
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
#[serde(tag = "result")] #[serde(tag = "result")]
pub enum HealthCheckResultKind { pub enum HealthCheckResultKind {
Success { message: String }, Success { message: Option<String> },
Disabled, Disabled { message: Option<String> },
Starting, Starting { message: Option<String> },
Loading { message: String }, Loading { message: String },
Failure { message: String }, Failure { message: String },
} }
@@ -25,10 +25,26 @@ impl std::fmt::Display for HealthCheckResult {
let name = &self.name; let name = &self.name;
match &self.kind { match &self.kind {
HealthCheckResultKind::Success { message } => { HealthCheckResultKind::Success { message } => {
if let Some(message) = message {
write!(f, "{name}: Succeeded ({message})") write!(f, "{name}: Succeeded ({message})")
} else {
write!(f, "{name}: Succeeded")
}
}
HealthCheckResultKind::Disabled { message } => {
if let Some(message) = message {
write!(f, "{name}: Disabled ({message})")
} else {
write!(f, "{name}: Disabled")
}
}
HealthCheckResultKind::Starting { message } => {
if let Some(message) = message {
write!(f, "{name}: Starting ({message})")
} else {
write!(f, "{name}: Starting")
}
} }
HealthCheckResultKind::Disabled => write!(f, "{name}: Disabled"),
HealthCheckResultKind::Starting => write!(f, "{name}: Starting"),
HealthCheckResultKind::Loading { message } => write!(f, "{name}: Loading ({message})"), HealthCheckResultKind::Loading { message } => write!(f, "{name}: Loading ({message})"),
HealthCheckResultKind::Failure { message } => write!(f, "{name}: Failed ({message})"), HealthCheckResultKind::Failure { message } => write!(f, "{name}: Failed ({message})"),
} }

View File

@@ -101,6 +101,7 @@ export const mockPatchData: DataModel = {
'ephemeral-health-check': { 'ephemeral-health-check': {
name: 'Ephemeral Health Check', name: 'Ephemeral Health Check',
result: 'starting', result: 'starting',
message: null,
}, },
'chain-state': { 'chain-state': {
name: 'Chain State', name: 'Chain State',
@@ -120,6 +121,7 @@ export const mockPatchData: DataModel = {
'unnecessary-health-check': { 'unnecessary-health-check': {
name: 'Unnecessary Health Check', name: 'Unnecessary Health Check',
result: 'disabled', result: 'disabled',
message: null,
}, },
}, },
}, },