mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 10:21:52 +00:00
* misc sdk changes * delete the store ☠️ * port comments * fix build * fix removing * fix tests * beta.20 --------- Co-authored-by: Matt Hill <mattnine@protonmail.com>
28 lines
705 B
TypeScript
28 lines
705 B
TypeScript
import * as T from "../../../base/lib/types"
|
|
|
|
export type UninstallFn<Manifest extends T.SDKManifest> = (opts: {
|
|
effects: T.Effects
|
|
}) => Promise<null | void | undefined>
|
|
export class Uninstall<Manifest extends T.SDKManifest> {
|
|
private constructor(readonly fn: UninstallFn<Manifest>) {}
|
|
static of<Manifest extends T.SDKManifest>(fn: UninstallFn<Manifest>) {
|
|
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.SDKManifest>(
|
|
fn: UninstallFn<Manifest>,
|
|
) {
|
|
return Uninstall.of(fn)
|
|
}
|