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:
Jade
2024-04-26 17:51:33 -06:00
committed by GitHub
parent e08d93b2aa
commit 8a38666105
24 changed files with 417 additions and 39 deletions

View File

@@ -1,6 +1,11 @@
export * as configTypes from "./config/configTypes"
import { HealthCheckId } from "./osBindings"
import { HealthCheckResult } from "./osBindings"
import {
DependencyRequirement,
SetHealth,
HealthCheckResult,
} from "./osBindings"
import { MainEffects, ServiceInterfaceType, Signals } from "./StartSdk"
import { InputSpec } from "./config/configTypes"
import { DependenciesReceipt } from "./config/setupConfig"
@@ -11,6 +16,7 @@ import { ExposedStorePaths } from "./store/setupExposeStore"
import { UrlString } from "./util/getServiceInterface"
export * from "./osBindings"
export { SDKManifest } from "./manifest/ManifestTypes"
export { HealthReceipt } from "./health/HealthReceipt"
export type ExportedAction = (options: {
effects: Effects
@@ -471,16 +477,22 @@ export type Effects = {
algorithm: "ecdsa" | "ed25519" | null
}) => Promise<string>
setHealth(
o: HealthCheckResult & {
id: HealthCheckId
},
): Promise<void>
setHealth(o: SetHealth): Promise<void>
/** Set the dependencies of what the service needs, usually ran during the set config as a best practice */
setDependencies(options: {
dependencies: Dependencies
}): Promise<DependenciesReceipt>
/** Get the list of the dependencies, both the dynamic set by the effect of setDependencies and the end result any required in the manifest */
getDependencies(): Promise<DependencyRequirement[]>
/** When one wants to checks the status of several services during the checking of dependencies. The result will include things like the status
* of the service and what the current health checks are.
*/
checkDependencies(options: {
packageIds: PackageId[] | null
}): Promise<CheckDependencyResult[]>
/** Exists could be useful during the runtime to know if some service exists, option dep */
exists(options: { packageId: PackageId }): Promise<boolean>
/** Exists could be useful during the runtime to know if some service is running, option dep */
@@ -578,13 +590,17 @@ export type KnownError =
errorCode: [number, string] | readonly [number, string]
}
export type Dependency = {
id: PackageId
versionSpec: string
registryUrl: string
} & ({ kind: "exists" } | { kind: "running"; healthChecks: string[] })
export type Dependencies = Array<Dependency>
export type Dependencies = Array<DependencyRequirement>
export type DeepPartial<T> = T extends {}
? { [P in keyof T]?: DeepPartial<T[P]> }
: T
export type CheckDependencyResult = {
packageId: PackageId
isInstalled: boolean
isRunning: boolean
healthChecks: SetHealth[]
version: string | null
}
export type CheckResults = CheckDependencyResult[]