import { SDKManifest } from "../manifest/ManifestTypes" import { Effects, ExpectedExports } from "../types" import { Utils, createUtils } from "../util/utils" export type InstallFn = (opts: { effects: Effects utils: Utils }) => Promise export class Install { private constructor(readonly fn: InstallFn) {} static of( fn: InstallFn, ) { return new Install(fn) } async init({ effects, previousVersion, }: Parameters[0]) { if (!previousVersion) await this.fn({ effects, utils: createUtils(effects), }) } } export function setupInstall( fn: InstallFn, ) { return Install.of(fn) }