Chore/refactoring effects (#2644)

* fix mac build

* wip

* chore: Update the effects to get rid of bad pattern

* chore: Some small changes

---------

Co-authored-by: Aiden McClelland <me@drbonez.dev>
This commit is contained in:
Jade
2024-06-14 14:16:12 -06:00
committed by GitHub
parent 3f380fa0da
commit bb514d6216
10 changed files with 704 additions and 693 deletions

View File

@@ -1,7 +1,7 @@
import { ExecuteResult, System } from "../../Interfaces/System"
import { unNestPath } from "../../Models/JsonPath"
import matches, { any, number, object, string, tuple } from "ts-matches"
import { HostSystemStartOs } from "../HostSystemStartOs"
import { hostSystemStartOs } from "../HostSystemStartOs"
import { Effects } from "../../Models/Effects"
import { RpcResult, matchRpcResult } from "../RpcListener"
import { duration } from "../../Models/Duration"
@@ -15,7 +15,7 @@ export class SystemForStartOs implements System {
}
constructor(readonly abi: T.ABI) {}
async execute(
effects: HostSystemStartOs,
effectCreator: ReturnType<typeof hostSystemStartOs>,
options: {
id: string
procedure:
@@ -36,8 +36,7 @@ export class SystemForStartOs implements System {
timeout?: number | undefined
},
): Promise<RpcResult> {
effects = Object.create(effects)
effects.procedureId = options.id
const effects = effectCreator(options.id)
return this._execute(effects, options)
.then((x) =>
matches(x)