mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-04 22:39:46 +00:00
Feature/sdk040dependencies (#2609)
* update registry upload to take id for new admin permissions (#2605) * wip * wip: Get the get dependencies * wip check_dependencies * wip: Get the build working to the vm * wip: Add in the last of the things that where needed for the new sdk * Add fix * wip: implement the changes * wip: Fix the naming --------- Co-authored-by: Lucy <12953208+elvece@users.noreply.github.com>
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
import { SDKManifest } from "../manifest/ManifestTypes"
|
||||
import { Dependency } from "../types"
|
||||
import { Dependencies } from "../types"
|
||||
|
||||
export type ConfigDependencies<T extends SDKManifest> = {
|
||||
exists(id: keyof T["dependencies"]): Dependency
|
||||
running(id: keyof T["dependencies"], healthChecks: string[]): Dependency
|
||||
exists(id: keyof T["dependencies"]): Dependencies[number]
|
||||
running(
|
||||
id: keyof T["dependencies"],
|
||||
healthChecks: string[],
|
||||
): Dependencies[number]
|
||||
}
|
||||
|
||||
export const configDependenciesSet = <
|
||||
@@ -13,7 +16,7 @@ export const configDependenciesSet = <
|
||||
return {
|
||||
id,
|
||||
kind: "exists",
|
||||
} as Dependency
|
||||
} as Dependencies[number]
|
||||
},
|
||||
|
||||
running(id: keyof T["dependencies"], healthChecks: string[]) {
|
||||
@@ -21,6 +24,6 @@ export const configDependenciesSet = <
|
||||
id,
|
||||
kind: "running",
|
||||
healthChecks,
|
||||
} as Dependency
|
||||
} as Dependencies[number]
|
||||
},
|
||||
})
|
||||
|
||||
@@ -11,16 +11,13 @@ export type DependenciesReceipt = void & {
|
||||
}
|
||||
|
||||
export type Save<
|
||||
Store,
|
||||
A extends
|
||||
| Record<string, any>
|
||||
| Config<Record<string, any>, any>
|
||||
| Config<Record<string, never>, never>,
|
||||
Manifest extends SDKManifest,
|
||||
> = (options: {
|
||||
effects: Effects
|
||||
input: ExtractConfigType<A> & Record<string, any>
|
||||
dependencies: D.ConfigDependencies<Manifest>
|
||||
}) => Promise<{
|
||||
dependenciesReceipt: DependenciesReceipt
|
||||
interfacesReceipt: InterfacesReceipt
|
||||
@@ -53,7 +50,7 @@ export function setupConfig<
|
||||
Type extends Record<string, any> = ExtractConfigType<ConfigType>,
|
||||
>(
|
||||
spec: Config<Type, Store> | Config<Type, never>,
|
||||
write: Save<Store, Type, Manifest>,
|
||||
write: Save<Type>,
|
||||
read: Read<Manifest, Store, Type>,
|
||||
) {
|
||||
const validator = spec.validator
|
||||
@@ -66,9 +63,8 @@ export function setupConfig<
|
||||
await effects.clearBindings()
|
||||
await effects.clearServiceInterfaces()
|
||||
const { restart } = await write({
|
||||
input: JSON.parse(JSON.stringify(input)),
|
||||
input: JSON.parse(JSON.stringify(input)) as any,
|
||||
effects,
|
||||
dependencies: D.configDependenciesSet<Manifest>(),
|
||||
})
|
||||
if (restart) {
|
||||
await effects.restart()
|
||||
|
||||
Reference in New Issue
Block a user