mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-26 10:21:55 +00:00
feat: Add in the setupExports
This commit is contained in:
@@ -2,6 +2,7 @@ import { SetInterfaces } from "../interfaces/setupInterfaces"
|
||||
import { ExpectedExports } from "../types"
|
||||
import { createUtils } from "../util"
|
||||
import { Migrations } from "./migrations/setupMigrations"
|
||||
import { SetupExports } from "./setupExports"
|
||||
import { Install } from "./setupInstall"
|
||||
import { Uninstall } from "./setupUninstall"
|
||||
|
||||
@@ -10,19 +11,27 @@ export function setupInit<Store, Vault>(
|
||||
install: Install<Store, Vault>,
|
||||
uninstall: Uninstall<Store, Vault>,
|
||||
setInterfaces: SetInterfaces<Store, Vault, any, any>,
|
||||
setupExports: SetupExports<Store>,
|
||||
): {
|
||||
init: ExpectedExports.init
|
||||
uninit: ExpectedExports.uninit
|
||||
} {
|
||||
return {
|
||||
init: async (opts) => {
|
||||
const utils = createUtils<Store>(opts.effects)
|
||||
await migrations.init(opts)
|
||||
await install.init(opts)
|
||||
await setInterfaces({
|
||||
...opts,
|
||||
input: null,
|
||||
utils: createUtils<Store, Vault>(opts.effects),
|
||||
utils,
|
||||
})
|
||||
const { services, ui } = await setupExports({
|
||||
...opts,
|
||||
utils,
|
||||
})
|
||||
await opts.effects.exposeForDependents(services)
|
||||
await opts.effects.exposeUi(ui)
|
||||
},
|
||||
uninit: async (opts) => {
|
||||
await migrations.uninit(opts)
|
||||
|
||||
Reference in New Issue
Block a user