From a35baca5807eccfdb12dab3a3d017543fd3702ba Mon Sep 17 00:00:00 2001 From: Aiden McClelland Date: Thu, 21 Mar 2024 17:53:34 -0600 Subject: [PATCH] update rust types to match sdk changes --- core/startos/bindings/ActionMetadata.ts | 4 ++++ core/startos/bindings/AllowedStatuses.ts | 2 +- core/startos/bindings/ExportActionParams.ts | 4 ++-- core/startos/src/service/service_effect_handler.rs | 12 ++++++++++-- sdk/lib/types.ts | 2 +- 5 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 core/startos/bindings/ActionMetadata.ts diff --git a/core/startos/bindings/ActionMetadata.ts b/core/startos/bindings/ActionMetadata.ts new file mode 100644 index 000000000..e2e0a8fb8 --- /dev/null +++ b/core/startos/bindings/ActionMetadata.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 { AllowedStatuses } from "./AllowedStatuses"; + +export interface ActionMetadata { name: string, description: string, warning: string | null, disabled: boolean, input: {[key: string]: any}, allowedStatuses: AllowedStatuses, group: string | null, } \ No newline at end of file diff --git a/core/startos/bindings/AllowedStatuses.ts b/core/startos/bindings/AllowedStatuses.ts index 87d122f70..e81a1639f 100644 --- a/core/startos/bindings/AllowedStatuses.ts +++ b/core/startos/bindings/AllowedStatuses.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type AllowedStatuses = "only-running" | "only-stopped" | "any" | "disabled"; \ No newline at end of file +export type AllowedStatuses = "only-running" | "only-stopped" | "any"; \ No newline at end of file diff --git a/core/startos/bindings/ExportActionParams.ts b/core/startos/bindings/ExportActionParams.ts index 413a63183..e96194745 100644 --- a/core/startos/bindings/ExportActionParams.ts +++ b/core/startos/bindings/ExportActionParams.ts @@ -1,4 +1,4 @@ // 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 { ActionMetadata } from "./ActionMetadata"; -export interface ExportActionParams { name: string, description: string, id: string, input: {[key: string]: any}, allowedStatuses: AllowedStatuses, group: string | null, } \ No newline at end of file +export interface ExportActionParams { id: string, metadata: ActionMetadata, } \ No newline at end of file diff --git a/core/startos/src/service/service_effect_handler.rs b/core/startos/src/service/service_effect_handler.rs index 81ea40eaa..cdeb98e56 100644 --- a/core/startos/src/service/service_effect_handler.rs +++ b/core/startos/src/service/service_effect_handler.rs @@ -260,16 +260,24 @@ enum AllowedStatuses { OnlyRunning, OnlyStopped, Any, - Disabled, } #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, TS)] #[ts(export)] #[serde(rename_all = "camelCase")] struct ExportActionParams { + #[ts(type = "string")] + id: ActionId, + metadata: ActionMetadata +} +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, TS)] +#[ts(export)] +#[serde(rename_all = "camelCase")] +struct ActionMetadata { name: String, description: String, - id: String, + warning: Option, + disabled: bool, #[ts(type = "{[key: string]: any}")] input: Value, allowed_statuses: AllowedStatuses, diff --git a/sdk/lib/types.ts b/sdk/lib/types.ts index 5796a9fcc..ee0574164 100644 --- a/sdk/lib/types.ts +++ b/sdk/lib/types.ts @@ -444,7 +444,7 @@ export type Effects = { * * @param options */ - exportAction(options: ActionMetadata): Promise + exportAction(options: { id: string; metadata: ActionMetadata }): Promise /** * Remove an action that was exported. Used problably during main or during setConfig. */