mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 18:31:52 +00:00
* create version graph to handle migrations * Fix some version alpha test * connect dataVersion api * rename init fns * improve types and add tests * set data version after backup restore * chore: Add some types tests for version info * wip: More changes to versionInfo tests * wip: fix my stupid * update mocks * update runtime * chore: Fix the loop --------- Co-authored-by: Jade <2364004+Blu-J@users.noreply.github.com> Co-authored-by: J H <dragondef@gmail.com>
26 lines
638 B
TypeScript
26 lines
638 B
TypeScript
import * as T from "../types"
|
|
|
|
export type InstallFn<Manifest extends T.Manifest, Store> = (opts: {
|
|
effects: T.Effects
|
|
}) => Promise<void>
|
|
export class Install<Manifest extends T.Manifest, Store> {
|
|
private constructor(readonly fn: InstallFn<Manifest, Store>) {}
|
|
static of<Manifest extends T.Manifest, Store>(
|
|
fn: InstallFn<Manifest, Store>,
|
|
) {
|
|
return new Install(fn)
|
|
}
|
|
|
|
async install({ effects }: Parameters<T.ExpectedExports.init>[0]) {
|
|
await this.fn({
|
|
effects,
|
|
})
|
|
}
|
|
}
|
|
|
|
export function setupInstall<Manifest extends T.Manifest, Store>(
|
|
fn: InstallFn<Manifest, Store>,
|
|
) {
|
|
return Install.of(fn)
|
|
}
|