From 68c5a326cf380ddd531140d0fece79a582876f43 Mon Sep 17 00:00:00 2001 From: Blu-J Date: Mon, 5 Jun 2023 16:19:44 -0600 Subject: [PATCH 1/2] feat: Fixing small things like toml; --- lib/types.ts | 17 ++++++----------- lib/util/fileHelper.ts | 2 +- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/lib/types.ts b/lib/types.ts index dfec7b3..4b20a93 100644 --- a/lib/types.ts +++ b/lib/types.ts @@ -233,21 +233,13 @@ export type Effects = { }, ): DaemonReturned - /** Uses the chown on the system */ - chown(input: { volumeId: string; path: string; uid: string }): Promise - /** Uses the chmod on the system */ - chmod(input: { volumeId: string; path: string; mode: string }): Promise - executeAction(opts: { serviceId?: string input: Input }): Promise /** Sandbox mode lets us read but not write */ - is_sandboxed(): boolean - - /** Check that a file exists or not */ - exists(input: { volumeId: string; path: string }): Promise + is_sandboxed(): Promise /** Removes all network bindings */ clearBindings(): Promise @@ -425,11 +417,14 @@ export type Effects = { getSslCertificate: ( packageId: string, algorithm?: "ecdsa" | "ed25519", - ) => [string, string, string] + ) => Promise<[string, string, string]> /** * @returns PEM encoded ssl key (ecdsa) */ - getSslKey: (packageId: string, algorithm?: "ecdsa" | "ed25519") => string + getSslKey: ( + packageId: string, + algorithm?: "ecdsa" | "ed25519", + ) => Promise setHealth(o: { name: string diff --git a/lib/util/fileHelper.ts b/lib/util/fileHelper.ts index 5ea8110..3e0b88d 100644 --- a/lib/util/fileHelper.ts +++ b/lib/util/fileHelper.ts @@ -118,7 +118,7 @@ export class FileHelper { return new FileHelper( path, (inData) => { - return JSON.stringify(inData, null, 2) + return TOML.stringify(inData as any) }, (inString) => { return shape.unsafeCast(TOML.parse(inString)) From 5b7a0e17ec26a1122c9d0bcceff7c0417e10e40b Mon Sep 17 00:00:00 2001 From: Blu-J Date: Thu, 8 Jun 2023 10:23:49 -0600 Subject: [PATCH 2/2] chore: Remove effects There are effects that we don't need now that we are going node first. --- lib/types.ts | 68 +++++++++++++--------------------------------------- 1 file changed, 16 insertions(+), 52 deletions(-) diff --git a/lib/types.ts b/lib/types.ts index 4b20a93..a074b9f 100644 --- a/lib/types.ts +++ b/lib/types.ts @@ -219,20 +219,6 @@ export type ExposeUiPaths = Array<{ }> /** Used to reach out from the pure js runtime */ export type Effects = { - runCommand( - command: ValidIfNoStupidEscape | [string, ...string[]], - options?: { - timeoutMillis?: number - env?: Record - }, - ): Promise - runDaemon( - command: ValidIfNoStupidEscape | [string, ...string[]], - options?: { - env?: Record - }, - ): DaemonReturned - executeAction(opts: { serviceId?: string input: Input @@ -265,44 +251,22 @@ export type Effects = { callback: () => void }): Promise<[HostName, ...HostName[]]> - /** Similar to the fetch api via the mdn, this is simplified but the point is - * to get something from some website, and return the response. - */ - fetch( - url: string, - options?: { - method?: "GET" | "POST" | "PUT" | "DELETE" | "HEAD" | "PATCH" - headers?: Record - body?: string - }, - ): Promise<{ - method: string - ok: boolean - status: number - headers: Record - body?: string | null - /// Returns the body as a string - text(): Promise - /// Returns the body as a json - json(): Promise - }> - - /** - * Run rsync between two volumes. This is used to backup data between volumes. - * This is a long running process, and a structure that we can either wait for, or get the progress of. - */ - runRsync(options: { - srcVolume: string - dstVolume: string - srcPath: string - dstPath: string - // rsync options: https://linux.die.net/man/1/rsync - options: BackupOptions - }): { - id: () => Promise - wait: () => Promise - progress: () => Promise - } + // /** + // * Run rsync between two volumes. This is used to backup data between volumes. + // * This is a long running process, and a structure that we can either wait for, or get the progress of. + // */ + // runRsync(options: { + // srcVolume: string + // dstVolume: string + // srcPath: string + // dstPath: string + // // rsync options: https://linux.die.net/man/1/rsync + // options: BackupOptions + // }): { + // id: () => Promise + // wait: () => Promise + // progress: () => Promise + // } store: { /** Get a value in a json like data, can be observed and subscribed */