sdk tweaks (#2760)

* sdk tweaks

* update action result types

* accommodate new action response types

* fix: show action value labels

* Feature/get status effect (#2765)

* wip: get status

* feat: Add the get_status for effects

* feat: Do a callback

---------

Co-authored-by: J H <dragondef@gmail.com>

---------

Co-authored-by: Matt Hill <mattnine@protonmail.com>
Co-authored-by: waterplea <alexander@inkin.ru>
Co-authored-by: J H <dragondef@gmail.com>
This commit is contained in:
Aiden McClelland
2024-10-28 12:12:36 -06:00
committed by GitHub
parent 42cfd69463
commit 26ae0bf207
28 changed files with 871 additions and 456 deletions

View File

@@ -14,6 +14,7 @@ import {
ServiceInterface,
ActionRequest,
RequestActionParams,
MainStatus,
} from "./osBindings"
import { StorePath } from "./util/PathBuilder"
import {
@@ -61,6 +62,11 @@ export type Effects = {
restart(): Promise<null>
/** stop this service's main function */
shutdown(): Promise<null>
/** ask the host os what the service's current status is */
getStatus(options: {
packageId?: PackageId
callback?: () => void
}): Promise<MainStatus>
/** indicate to the host os what runstate the service is in */
setMainStatus(options: SetMainStatus): Promise<null>

View File

@@ -0,0 +1,15 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type ActionResultMember = {
name: string
description: string | null
} & (
| {
type: "single"
value: string
copyable: boolean
qr: boolean
masked: boolean
}
| { type: "group"; value: Array<ActionResultMember> }
)

View File

@@ -1,18 +1,8 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { ActionResultValue } from "./ActionResultValue"
export type ActionResultV1 =
| {
type: "string"
name: string
value: string
description: string | null
copyable: boolean
qr: boolean
masked: boolean
}
| {
type: "object"
name: string
value: Array<ActionResultV1>
description?: string
}
export type ActionResultV1 = {
title: string
message: string | null
result: ActionResultValue | null
}

View File

@@ -0,0 +1,12 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { ActionResultMember } from "./ActionResultMember"
export type ActionResultValue =
| {
type: "single"
value: string
copyable: boolean
qr: boolean
masked: boolean
}
| { type: "group"; value: Array<ActionResultMember> }

View File

@@ -0,0 +1,5 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { CallbackId } from "./CallbackId"
import type { PackageId } from "./PackageId"
export type GetStatusParams = { packageId?: PackageId; callback?: CallbackId }

View File

@@ -7,9 +7,11 @@ export { ActionRequestEntry } from "./ActionRequestEntry"
export { ActionRequestInput } from "./ActionRequestInput"
export { ActionRequestTrigger } from "./ActionRequestTrigger"
export { ActionRequest } from "./ActionRequest"
export { ActionResultMember } from "./ActionResultMember"
export { ActionResult } from "./ActionResult"
export { ActionResultV0 } from "./ActionResultV0"
export { ActionResultV1 } from "./ActionResultV1"
export { ActionResultValue } from "./ActionResultValue"
export { ActionSeverity } from "./ActionSeverity"
export { ActionVisibility } from "./ActionVisibility"
export { AddAdminParams } from "./AddAdminParams"
@@ -79,6 +81,7 @@ export { GetServiceInterfaceParams } from "./GetServiceInterfaceParams"
export { GetServicePortForwardParams } from "./GetServicePortForwardParams"
export { GetSslCertificateParams } from "./GetSslCertificateParams"
export { GetSslKeyParams } from "./GetSslKeyParams"
export { GetStatusParams } from "./GetStatusParams"
export { GetStoreParams } from "./GetStoreParams"
export { GetSystemSmtpParams } from "./GetSystemSmtpParams"
export { Governor } from "./Governor"

View File

@@ -7,6 +7,7 @@ import {
ClearCallbacksParams,
ClearServiceInterfacesParams,
GetActionInputParams,
GetStatusParams,
GetStoreParams,
RequestActionParams,
RunActionParams,
@@ -89,6 +90,7 @@ describe("startosTypeValidation ", () => {
mount: {} as MountParams,
checkDependencies: {} as CheckDependenciesParam,
getDependencies: undefined,
getStatus: {} as WithCallback<GetStatusParams>,
setMainStatus: {} as SetMainStatus,
})
})