mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 04:23:40 +00:00
* add error status * update types * ṗ̶̰̙̓͒̈́ͅü̵̢̙̫̣ŗ̷̪̺̺͛g̴̲͉͎̬̒̇e̵̪̎̅͌ ̶̡̜̘͐͛t̶͎͍̣̿̍̐h̴͕̩͗̈́̎̑e̵͚͒̂͝ ̸̛͙̦͈͝v̶̱͙̬̽̔ọ̶̧̡̒̓i̸̬̲͍̋̈́d̴͉̀ * fix some extra voids * add `package.rebuild` * introduce error status and pkg rebuild and fix mocks * minor fixes * fix build --------- Co-authored-by: Matt Hill <mattnine@protonmail.com>
30 lines
732 B
TypeScript
30 lines
732 B
TypeScript
import * as T from "../../../base/lib/types"
|
|
|
|
export type UninstallFn<Manifest extends T.Manifest, Store> = (opts: {
|
|
effects: T.Effects
|
|
}) => Promise<null>
|
|
export class Uninstall<Manifest extends T.Manifest, Store> {
|
|
private constructor(readonly fn: UninstallFn<Manifest, Store>) {}
|
|
static of<Manifest extends T.Manifest, Store>(
|
|
fn: UninstallFn<Manifest, Store>,
|
|
) {
|
|
return new Uninstall(fn)
|
|
}
|
|
|
|
async uninstall({
|
|
effects,
|
|
nextVersion,
|
|
}: Parameters<T.ExpectedExports.packageUninit>[0]) {
|
|
if (!nextVersion)
|
|
await this.fn({
|
|
effects,
|
|
})
|
|
}
|
|
}
|
|
|
|
export function setupUninstall<Manifest extends T.Manifest, Store>(
|
|
fn: UninstallFn<Manifest, Store>,
|
|
) {
|
|
return Uninstall.of(fn)
|
|
}
|