feat: creating the rest of the sdk

This commit is contained in:
BluJ
2023-05-09 11:42:26 -06:00
parent 72df4cb502
commit 07493551b1
30 changed files with 568 additions and 504 deletions

View File

@@ -1,8 +1,8 @@
import { HealthReceipt } from "../health/HealthReceipt"
import { CheckResult } from "../health/checkFns"
import { Trigger } from "../health/trigger"
import { TriggerInput } from "../health/trigger/TriggerInput"
import { defaultTrigger } from "../health/trigger/defaultTrigger"
import { Trigger } from "../trigger"
import { TriggerInput } from "../trigger/TriggerInput"
import { defaultTrigger } from "../trigger/defaultTrigger"
import { DaemonReturned, Effects, ValidIfNoStupidEscape } from "../types"
import { InterfaceReceipt } from "./interfaceReceipt"
type Daemon<Ids extends string, Command extends string, Id extends string> = {

View File

@@ -1,5 +1,6 @@
import { Effects, ExpectedExports } from "../types"
import { createMainUtils, Utils, utils } from "../util"
import { createMainUtils } from "../util"
import { Utils, utils } from "../util/utils"
import { Daemons } from "./Daemons"
import "./exportInterfaces"
import "./LocalBinding"
@@ -11,7 +12,6 @@ import "./TorBinding"
import "./TorHostname"
import "./Daemons"
import { WrapperDataContract } from "../wrapperData/wrapperDataContract"
/**
* Used to ensure that the main function is running with the valid proofs.
@@ -23,18 +23,17 @@ import { WrapperDataContract } from "../wrapperData/wrapperDataContract"
* @param fn
* @returns
*/
export const setupMain = <WD>(
wrapperDataContract: WrapperDataContract<WD>,
export const setupMain = <Store>(
fn: (o: {
effects: Effects
started(onTerm: () => void): null
utils: Utils<WD, {}>
utils: Utils<Store, {}>
}) => Promise<Daemons<any>>,
): ExpectedExports.main => {
return async (options) => {
const result = await fn({
...options,
utils: createMainUtils(wrapperDataContract, options.effects),
utils: createMainUtils<Store>(options.effects),
})
await result.build().then((x) => x.wait())
}