feat: Make the multi better

This commit is contained in:
BluJ
2023-05-11 16:31:31 -06:00
parent ed56e39f00
commit b18744d197
2 changed files with 7 additions and 9 deletions

View File

@@ -8,7 +8,7 @@ describe("host", () => {
test("Testing that the types work", () => {
async function test(effects: Effects) {
const utils = createUtils<never, never>(effects)
const foo = utils.host.multi({ id: "foo" })
const foo = utils.host.multi("foo")
const fooOrigin = await foo.bindPort(80, { protocol: "http" as const })
const fooInterface = new NetworkInterfaceBuilder({
effects,

View File

@@ -50,9 +50,9 @@ export type Utils<Store, Vault, WrapperOverWrite = { const: never }> = {
getSystemSmtp: () => GetSystemSmtp & WrapperOverWrite
host: {
of: (options: { kind: "static" | "single" | "multi"; id: string }) => Host
static: (options: { id: string }) => StaticHost
single: (options: { id: string }) => SingleHost
multi: (options: { id: string }) => MultiHost
static: (id: string) => StaticHost
single: (id: string) => SingleHost
multi: (id: string) => MultiHost
}
mountDependencies: <
In extends
@@ -120,11 +120,9 @@ export const utils = <
host: {
of: (options: { kind: "static" | "single" | "multi"; id: string }) =>
new Host({ ...options, effects }),
static: (options: { id: string }) =>
new StaticHost({ ...options, effects }),
single: (options: { id: string }) =>
new SingleHost({ ...options, effects }),
multi: (options: { id: string }) => new MultiHost({ ...options, effects }),
static: (id: string) => new StaticHost({ id, effects }),
single: (id: string) => new SingleHost({ id, effects }),
multi: (id: string) => new MultiHost({ id, effects }),
},
readFile: <A>(fileHelper: FileHelper<A>) => fileHelper.read(effects),
writeFile: <A>(fileHelper: FileHelper<A>, data: A) =>