import * as T from "../../../base/lib/types" export type InstallFn = (opts: { effects: T.Effects }) => Promise export class Install { protected constructor(readonly fn: InstallFn) {} } export class PreInstall< Manifest extends T.SDKManifest, > extends Install { private constructor(fn: InstallFn) { super(fn) } static of(fn: InstallFn) { return new PreInstall(fn) } async preInstall({ effects }: Parameters[0]) { await this.fn({ effects, }) } } export function setupPreInstall( fn: InstallFn, ) { return PreInstall.of(fn) } export class PostInstall< Manifest extends T.SDKManifest, > extends Install { private constructor(fn: InstallFn) { super(fn) } static of(fn: InstallFn) { return new PostInstall(fn) } async postInstall({ effects }: Parameters[0]) { await this.fn({ effects, }) } } export function setupPostInstall( fn: InstallFn, ) { return PostInstall.of(fn) }