Spaces:
Configuration error
Configuration error
File size: 1,026 Bytes
3a65265 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
import { Writable } from "node:stream";
import type { GatewayService } from "../../daemon/service.js";
import { defaultRuntime } from "../../runtime.js";
export type DaemonAction = "install" | "uninstall" | "start" | "stop" | "restart";
export type DaemonActionResponse = {
ok: boolean;
action: DaemonAction;
result?: string;
message?: string;
error?: string;
hints?: string[];
warnings?: string[];
service?: {
label: string;
loaded: boolean;
loadedText: string;
notLoadedText: string;
};
};
export function emitDaemonActionJson(payload: DaemonActionResponse) {
defaultRuntime.log(JSON.stringify(payload, null, 2));
}
export function buildDaemonServiceSnapshot(service: GatewayService, loaded: boolean) {
return {
label: service.label,
loaded,
loadedText: service.loadedText,
notLoadedText: service.notLoadedText,
};
}
export function createNullWriter(): Writable {
return new Writable({
write(_chunk, _encoding, callback) {
callback();
},
});
}
|