misc sdk changes (#2934)

* misc sdk changes

* delete the store ☠️

* port comments

* fix build

* fix removing

* fix tests

* beta.20

---------

Co-authored-by: Matt Hill <mattnine@protonmail.com>
This commit is contained in:
Aiden McClelland
2025-05-09 15:10:51 -06:00
committed by GitHub
parent d2c4741f0b
commit 7750e33f82
62 changed files with 1255 additions and 2130 deletions

View File

@@ -1,25 +1,21 @@
import { Actions } from "../../../base/lib/actions/setupActions"
import { ExtendedVersion } from "../../../base/lib/exver"
import { UpdateServiceInterfaces } from "../../../base/lib/interfaces/setupInterfaces"
import { ExposedStorePaths } from "../../../base/lib/types"
import * as T from "../../../base/lib/types"
import { StorePath } from "../util"
import { VersionGraph } from "../version/VersionGraph"
import { PostInstall, PreInstall } from "./setupInstall"
import { Uninstall } from "./setupUninstall"
export function setupInit<Manifest extends T.SDKManifest, Store>(
export function setupInit<Manifest extends T.SDKManifest>(
versions: VersionGraph<string>,
preInstall: PreInstall<Manifest, Store>,
postInstall: PostInstall<Manifest, Store>,
uninstall: Uninstall<Manifest, Store>,
preInstall: PreInstall<Manifest>,
postInstall: PostInstall<Manifest>,
uninstall: Uninstall<Manifest>,
setServiceInterfaces: UpdateServiceInterfaces<any>,
setDependencies: (options: {
effects: T.Effects
}) => Promise<null | void | undefined>,
actions: Actions<Store, any>,
initStore: Store,
exposedStore: ExposedStorePaths,
actions: Actions<any>,
): {
packageInit: T.ExpectedExports.packageInit
packageUninit: T.ExpectedExports.packageUninit
@@ -58,17 +54,12 @@ export function setupInit<Manifest extends T.SDKManifest, Store>(
containerInit: async (opts) => {
const prev = await opts.effects.getDataVersion()
if (!prev) {
await opts.effects.store.set({
path: "" as StorePath,
value: initStore,
})
await preInstall.preInstall(opts)
}
await setServiceInterfaces({
...opts,
})
await actions.update({ effects: opts.effects })
await opts.effects.exposeForDependents({ paths: exposedStore })
await setDependencies({ effects: opts.effects })
},
}