Files
start-os/container-runtime/src/Interfaces/System.ts
Aiden McClelland b36b62c68e Feature/callbacks (#2678)
* wip

* initialize callbacks

* wip

* smtp

* list_service_interfaces

* wip

* wip

* fix domains

* fix hostname handling in NetService

* misc fixes

* getInstalledPackages

* misc fixes

* publish v6 lib

* refactor service effects

* fix import

* fix container runtime

* fix tests

* apply suggestions from review
2024-07-25 17:44:51 +00:00

55 lines
1.2 KiB
TypeScript

import { types as T } from "@start9labs/start-sdk"
import { RpcResult } from "../Adapters/RpcListener"
import { Effects } from "../Models/Effects"
import { CallbackHolder } from "../Models/CallbackHolder"
import { MainEffects } from "@start9labs/start-sdk/cjs/lib/StartSdk"
export type Procedure =
| "/init"
| "/uninit"
| "/config/set"
| "/config/get"
| "/backup/create"
| "/backup/restore"
| "/actions/metadata"
| "/properties"
| `/actions/${string}/get`
| `/actions/${string}/run`
| `/dependencies/${string}/query`
| `/dependencies/${string}/update`
export type ExecuteResult =
| { ok: unknown }
| { err: { code: number; message: string } }
export type System = {
init(): Promise<void>
start(effects: MainEffects): Promise<void>
callCallback(callback: number, args: any[]): void
stop(): Promise<void>
execute(
effects: Effects,
options: {
procedure: Procedure
input: unknown
timeout?: number
},
): Promise<RpcResult>
sandbox(
effects: Effects,
options: {
procedure: Procedure
input: unknown
timeout?: number
},
): Promise<RpcResult>
exit(): Promise<void>
}
export type RunningMain = {
callbacks: CallbackHolder
stop(): Promise<void>
}