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