mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 10:21:52 +00:00
Action Request updates + misc fixes (#2818)
* fix web manifest format error * fix setting optional dependencies * rework dependency actions to be nested * fix styling * fix styles * combine action requests into same component * only display actions header if they exist * fix storing polyfill dependencies * fix styling and button propagation * fixes for setting polyfill dependencies * revert to test * revert required deps setting logic * add logs and adjust logic * test * fix deps logic when changing config * remove logs; deps working as expected
This commit is contained in:
10
container-runtime/package-lock.json
generated
10
container-runtime/package-lock.json
generated
@@ -64,7 +64,7 @@
|
||||
},
|
||||
"../sdk/dist": {
|
||||
"name": "@start9labs/start-sdk",
|
||||
"version": "0.3.6-alpha8",
|
||||
"version": "0.3.6-beta.4",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@iarna/toml": "^2.2.5",
|
||||
@@ -72,8 +72,8 @@
|
||||
"@noble/hashes": "^1.4.0",
|
||||
"isomorphic-fetch": "^3.0.0",
|
||||
"lodash.merge": "^4.6.2",
|
||||
"mime": "^4.0.3",
|
||||
"ts-matches": "^5.5.1",
|
||||
"mime-types": "^2.1.35",
|
||||
"ts-matches": "^6.2.1",
|
||||
"yaml": "^2.2.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -6799,11 +6799,11 @@
|
||||
"isomorphic-fetch": "^3.0.0",
|
||||
"jest": "^29.4.3",
|
||||
"lodash.merge": "^4.6.2",
|
||||
"mime": "^4.0.3",
|
||||
"mime-types": "^2.1.35",
|
||||
"peggy": "^3.0.2",
|
||||
"prettier": "^3.2.5",
|
||||
"ts-jest": "^29.0.5",
|
||||
"ts-matches": "^5.5.1",
|
||||
"ts-matches": "^6.2.1",
|
||||
"ts-node": "^10.9.1",
|
||||
"ts-pegjs": "^4.2.1",
|
||||
"tsx": "^4.7.1",
|
||||
|
||||
@@ -51,6 +51,7 @@ function todo(): never {
|
||||
const MANIFEST_LOCATION = "/usr/lib/startos/package/embassyManifest.json"
|
||||
export const EMBASSY_JS_LOCATION = "/usr/lib/startos/package/embassy.js"
|
||||
const EMBASSY_POINTER_PATH_PREFIX = "/embassyConfig" as utils.StorePath
|
||||
const EMBASSY_DEPENDS_ON_PATH_PREFIX = "/embassyDependsOn" as utils.StorePath
|
||||
|
||||
const matchResult = object({
|
||||
result: any,
|
||||
@@ -314,7 +315,7 @@ export class SystemForEmbassy implements System {
|
||||
)
|
||||
.catch(() => []),
|
||||
)
|
||||
await this.setDependencies(effects, oldDeps)
|
||||
await this.setDependencies(effects, oldDeps, false)
|
||||
}
|
||||
|
||||
async exit(): Promise<void> {
|
||||
@@ -664,7 +665,7 @@ export class SystemForEmbassy implements System {
|
||||
),
|
||||
)
|
||||
const dependsOn = answer["depends-on"] ?? answer.dependsOn ?? {}
|
||||
await this.setDependencies(effects, dependsOn)
|
||||
await this.setDependencies(effects, dependsOn, true)
|
||||
return
|
||||
} else if (setConfigValue.type === "script") {
|
||||
const moduleCode = await this.moduleCode
|
||||
@@ -687,48 +688,47 @@ export class SystemForEmbassy implements System {
|
||||
}),
|
||||
)
|
||||
const dependsOn = answer["depends-on"] ?? answer.dependsOn ?? {}
|
||||
await this.setDependencies(effects, dependsOn)
|
||||
await this.setDependencies(effects, dependsOn, true)
|
||||
return
|
||||
}
|
||||
}
|
||||
private async setDependencies(
|
||||
effects: Effects,
|
||||
rawDepends: { [x: string]: readonly string[] },
|
||||
configuring: boolean,
|
||||
) {
|
||||
const dependsOn: Record<string, readonly string[] | null> = {
|
||||
const storedDependsOn = (await effects.store.get({
|
||||
packageId: this.manifest.id,
|
||||
path: EMBASSY_DEPENDS_ON_PATH_PREFIX,
|
||||
})) as Record<string, readonly string[]>
|
||||
|
||||
const requiredDeps = {
|
||||
...Object.fromEntries(
|
||||
Object.entries(this.manifest.dependencies || {})?.map((x) => [
|
||||
x[0],
|
||||
null,
|
||||
]) || [],
|
||||
Object.entries(this.manifest.dependencies || {})
|
||||
?.filter((x) => x[1].requirement.type === "required")
|
||||
.map((x) => [x[0], []]) || [],
|
||||
),
|
||||
...rawDepends,
|
||||
}
|
||||
|
||||
const dependsOn: Record<string, readonly string[]> = configuring
|
||||
? {
|
||||
...requiredDeps,
|
||||
...rawDepends,
|
||||
}
|
||||
: storedDependsOn
|
||||
? storedDependsOn
|
||||
: requiredDeps
|
||||
|
||||
await effects.store.set({
|
||||
path: EMBASSY_DEPENDS_ON_PATH_PREFIX,
|
||||
value: dependsOn,
|
||||
})
|
||||
|
||||
await effects.setDependencies({
|
||||
dependencies: Object.entries(dependsOn).flatMap(
|
||||
([key, value]): T.Dependencies => {
|
||||
const dependency = this.manifest.dependencies?.[key]
|
||||
if (!dependency) return []
|
||||
if (value == null) {
|
||||
const versionRange = dependency.version
|
||||
if (dependency.requirement.type === "required") {
|
||||
return [
|
||||
{
|
||||
id: key,
|
||||
versionRange,
|
||||
kind: "running",
|
||||
healthChecks: [],
|
||||
},
|
||||
]
|
||||
}
|
||||
return [
|
||||
{
|
||||
kind: "exists",
|
||||
id: key,
|
||||
versionRange,
|
||||
},
|
||||
]
|
||||
}
|
||||
const versionRange = dependency.version
|
||||
const kind = "running"
|
||||
return [
|
||||
|
||||
@@ -11,7 +11,7 @@ new RpcListener(getDependencies)
|
||||
|
||||
/**
|
||||
|
||||
So, this is going to be sent into a running comtainer along with any of the other node modules that are going to be needed and used.
|
||||
So, this is going to be sent into a running container along with any of the other node modules that are going to be needed and used.
|
||||
|
||||
Once the container is started, we will go into a loading/ await state.
|
||||
This is the init system, and it will always be running, and it will be waiting for a command to be sent to it.
|
||||
@@ -38,5 +38,5 @@ There are
|
||||
|
||||
/**
|
||||
TODO:
|
||||
Should I seperate those adapter in/out?
|
||||
Should I separate those adapter in/out?
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user