chore: Add some of the fixes to make the build work !!!

This commit is contained in:
J H
2024-03-13 17:44:13 -06:00
parent b6fe0be1b2
commit a089d544a5
16 changed files with 48 additions and 33 deletions

View File

@@ -1,4 +1,3 @@
// 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 interface CreateOverlayedImageParams { imageId: ImageId, }
export interface CreateOverlayedImageParams { imageId: string, }

View File

@@ -1,4 +1,3 @@
// 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 interface DestroyOverlayedImageParams { imageId: ImageId, guid: string, }
export interface DestroyOverlayedImageParams { imageId: string , guid: string, }

View File

@@ -1,5 +1,3 @@
// 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 interface ExecuteAction { serviceId: PackageId | null, actionId: ActionId, input: any, }
export interface ExecuteAction { serviceId: string | null, actionId: string, input: any, }

View File

@@ -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 interface ExposedUI { path: string, title: string, description: string | null, masked: boolean | null, copyable: boolean | null, qr: boolean | null, }

View File

@@ -1,5 +1,4 @@
// 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 { PackageId } from "./PackageId";
export interface GetServiceInterfaceParams { packageId: PackageId | null, serviceInterfaceId: string, callback: Callback, }
export interface GetServiceInterfaceParams { packageId: string | null, serviceInterfaceId: string, callback: Callback, }

View File

@@ -1,4 +1,3 @@
// 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 interface GetStoreParams { packageId: PackageId | null, path: string, }
export interface GetStoreParams { packageId: string | null, path: string, }

View File

@@ -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 HealthCheckString = "passing" | "disabled" | "starting" | "warning" | "failure";

View File

@@ -1,4 +1,3 @@
// 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 interface ParamsMaybePackageId { packageId: PackageId | null, }
export interface ParamsMaybePackageId { packageId: string | null, }

View File

@@ -1,4 +1,3 @@
// 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 interface ParamsPackageId { packageId: PackageId, }
export interface ParamsPackageId { packageId: string, }

View File

@@ -1,5 +1,4 @@
// 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 { HealthCheckString } from "./HealthCheckString";
export interface SetHealth { name: HealthCheckId, status: HealthCheckString, message: string | null, }
export interface SetHealth { name: string, status: HealthCheckString, message: string | null, }

View File

@@ -531,6 +531,7 @@ pub struct ExposedDependent {
}
#[derive(Clone, Debug, Deserialize, Serialize, HasModel, ts_rs::TS)]
#[model = "Model<Self>"]
#[ts(export)]
pub struct ExposedUI {
#[ts(type = "string")]
pub path: JsonPointer,

View File

@@ -222,6 +222,7 @@ async fn bind(_: AnyContext, BindParams { .. }: BindParams) -> Result<Value, Err
#[serde(rename_all = "camelCase")]
#[ts(export)]
struct GetServiceInterfaceParams {
#[ts(type = "string | null")]
package_id: Option<PackageId>,
service_interface_id: String,
callback: Callback,
@@ -375,6 +376,7 @@ async fn get_ssl_key(
#[serde(rename_all = "camelCase")]
#[ts(export)]
struct GetStoreParams {
#[ts(type = "string | null")]
package_id: Option<PackageId>,
#[ts(type = "string")]
path: JsonPointer,
@@ -494,10 +496,11 @@ async fn expose_ui(
.await?;
Ok(())
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, TS)]
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Parser, TS)]
#[ts(export)]
#[serde(rename_all = "camelCase")]
struct ParamsPackageId {
#[ts(type = "string")]
package_id: PackageId,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Parser, TS)]
@@ -505,6 +508,7 @@ struct ParamsPackageId {
#[command(rename_all = "camelCase")]
#[ts(export)]
struct ParamsMaybePackageId {
#[ts(type = "string | null")]
package_id: Option<PackageId>,
}
@@ -523,7 +527,9 @@ async fn exists(context: EffectContext, params: ParamsPackageId) -> Result<Value
#[serde(rename_all = "camelCase")]
#[ts(export)]
struct ExecuteAction {
#[ts(type = "string | null")]
service_id: Option<PackageId>,
#[ts(type = "string")]
action_id: ActionId,
#[ts(type = "any")]
input: Value,
@@ -584,11 +590,11 @@ async fn stopped(context: EffectContext, params: ParamsMaybePackageId) -> Result
.de()?;
Ok(json!(matches!(package, MainStatus::Stopped)))
}
async fn running(context: EffectContext, params: ParamsMaybePackageId) -> Result<Value, Error> {
async fn running(context: EffectContext, params: ParamsPackageId) -> Result<Value, Error> {
dbg!("Starting the running {params:?}");
let context = context.deref()?;
let peeked = context.ctx.db.peek().await;
let package_id = params.package_id.unwrap_or_else(|| context.id.clone());
let package_id = params.package_id;
let package = peeked
.as_public()
.as_package_data()
@@ -701,6 +707,7 @@ async fn set_main_status(context: EffectContext, params: SetMainStatus) -> Resul
#[serde(rename_all = "camelCase")]
#[ts(export)]
struct SetHealth {
#[ts(type = "string")]
name: HealthCheckId,
status: HealthCheckString,
message: Option<String>,
@@ -771,6 +778,7 @@ async fn set_health(
#[command(rename_all = "camelCase")]
#[ts(export)]
pub struct DestroyOverlayedImageParams {
#[ts(type = "string ")]
image_id: ImageId,
#[ts(type = "string")]
guid: InternedString,
@@ -799,6 +807,7 @@ pub async fn destroy_overlayed_image(
#[command(rename_all = "camelCase")]
#[ts(export)]
pub struct CreateOverlayedImageParams {
#[ts(type = "string")]
image_id: ImageId,
}

View File

@@ -25,6 +25,7 @@ impl std::fmt::Display for HealthCheckResult {
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq, ts_rs::TS)]
#[serde(rename_all = "camelCase")]
#[ts(export)]
pub enum HealthCheckString {
Passing,
Disabled,

View File

@@ -32,7 +32,14 @@ export function setupInit<Manifest extends SDKManifest, Store>(
utils,
})
await opts.effects.exposeForDependents(services)
await opts.effects.exposeUi({ paths: ui })
await opts.effects.exposeUi({
paths: ui.map((x) => ({
description: null,
copyable: null,
qr: null,
...x,
})),
})
},
uninit: async (opts) => {
await migrations.uninit(opts)

View File

@@ -57,7 +57,7 @@ describe("startosTypeValidation ", () => {
exists: {} as ParamsPackageId,
getConfigured: undefined,
stopped: {} as ParamsMaybePackageId,
running: {} as ParamsMaybePackageId,
running: {} as ParamsPackageId,
restart: undefined,
shutdown: undefined,
setConfigured: {} as SetConfigured,

View File

@@ -269,7 +269,7 @@ export type ExposeUiPaths<Store> = Array<{
/** A human readable description or explanation of the value */
description?: string
/** (string/number only) Whether or not to mask the value, for example, when displaying a password */
masked?: boolean
masked: boolean
/** (string/number only) Whether or not to include a button for copying the value to clipboard */
copyable?: boolean
/** (string/number only) Whether or not to include a button for displaying the value as a QR code */
@@ -278,7 +278,7 @@ export type ExposeUiPaths<Store> = Array<{
/** Used to reach out from the pure js runtime */
export type Effects = {
executeAction<Input>(opts: {
serviceId?: string
serviceId: string | null
input: Input
}): Promise<unknown>
@@ -362,10 +362,10 @@ export type Effects = {
/**
* Get the port address for another service
*/
getServicePortForward(
internalPort: number,
packageId?: string,
): Promise<number>
getServicePortForward(options: {
internalPort: number
packageId: string | null
}): Promise<number>
/** Removes all network interfaces */
clearServiceInterfaces(): Promise<void>
@@ -379,11 +379,11 @@ export type Effects = {
exposeUi<Store = never>(options: {
paths: {
path: string
title: string
description?: string | undefined
masked?: boolean | undefined
copyable?: boolean | undefined
qr?: boolean | undefined
title: string | null
description: string | null
masked: boolean | null
copyable: boolean | null
qr: boolean | null
}[]
}): Promise<void>
/**